- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello, I have implemented the updatable stack OTA (over the air) scenario.
I would now like to put the STACK build date time (__DATE__ and __TIME__) into a global / const area of the stack application and be able to access it from my user APPLICATION code. I would like this so I can query the build date/time of both stack and application from my phone and decide if an update for either is needed.
I would imagine there is a way to share variables across the stack / application since the entire stack is shared across that boundary (and the linker script must be handling that)....?
Is there documentation on how to define something in the stack that will be 'exported' and how to then 'import' it by the application? I had previously seen something about pragmas and sections that might be what I need but didn't bookmark it and can't find it now...
Any help is appreciated including just pointing me at a link...
Thanks!
-Kevin
Solved! Go to Solution.
- Labels:
-
BLE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I was interested in having one place to store the build date/time for each part of the OTA launcher/stack/app. By putting it in the launcher flash area, I wouldn't have to worry about it moving around since that remains static (is never updated vs the stack and app)...
Ultimately, I did the following....
1- create const variables in the Launcher app:
const char launcherDT[24] CY_SECTION(".DATA") = __DATE__ " " __TIME__;
const char stackDT[24] CY_SECTION(".DATA") = "N/A";
const char appDT[24] CY_SECTION(".DATA") = "N/A";
2- access them in a simple fashion in the launcher (or the optimizer removed them!)
char msgBuff[24];
strcat(msgBuff, launcherDT);
strcat(msgBuff, stackDT);
strcat(msgBuff, appDT);
3- look at the generated map file to find the memory location they were going to be put at:
.DATA 0x00000ab8 0x48 .\CortexM0\ARM_GCC_541\Debug\main.o
0x00000ab8 launcherDT
0x00000ad0 stackDT
0x00000ae8 appDT
4- use those memory locations later in STACK and APP to write to the locations:
// these are the locations in the Launcher part of the flash
const char *launcherDT = (char *)0x00000ab8;
const char *stackDT = (char *)0x00000ad0;
const char *appDT = (char *)0x00000ae8;
// keep this for us to put stackDT above
const char *buildDT = __DATE__ " " __TIME__;
CyBle_StoreAppData((uint8 *)(buildDT), (const uint8 *)(stackDT), 20, 1);
5- read from those locations
UART_UartPutString(launcherDT);
UART_UartPutString("\r\n");
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am still interested in the answer to this (sharing const data from the stack to the application) but for now am instead just trying to have the Stack save the data to the User Flash space with CyBle_StoreAppData. I'm about to post another question about that...
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I was interested in having one place to store the build date/time for each part of the OTA launcher/stack/app. By putting it in the launcher flash area, I wouldn't have to worry about it moving around since that remains static (is never updated vs the stack and app)...
Ultimately, I did the following....
1- create const variables in the Launcher app:
const char launcherDT[24] CY_SECTION(".DATA") = __DATE__ " " __TIME__;
const char stackDT[24] CY_SECTION(".DATA") = "N/A";
const char appDT[24] CY_SECTION(".DATA") = "N/A";
2- access them in a simple fashion in the launcher (or the optimizer removed them!)
char msgBuff[24];
strcat(msgBuff, launcherDT);
strcat(msgBuff, stackDT);
strcat(msgBuff, appDT);
3- look at the generated map file to find the memory location they were going to be put at:
.DATA 0x00000ab8 0x48 .\CortexM0\ARM_GCC_541\Debug\main.o
0x00000ab8 launcherDT
0x00000ad0 stackDT
0x00000ae8 appDT
4- use those memory locations later in STACK and APP to write to the locations:
// these are the locations in the Launcher part of the flash
const char *launcherDT = (char *)0x00000ab8;
const char *stackDT = (char *)0x00000ad0;
const char *appDT = (char *)0x00000ae8;
// keep this for us to put stackDT above
const char *buildDT = __DATE__ " " __TIME__;
CyBle_StoreAppData((uint8 *)(buildDT), (const uint8 *)(stackDT), 20, 1);
5- read from those locations
UART_UartPutString(launcherDT);
UART_UartPutString("\r\n");