Hi,
I have been trying to insert a version number of my application into its binary. I noticed that the Freedom Bootloader example has this implemented and I have been trying to use something similar with the LED blinky example as a start. However, so far I have not been able to insert the version like the Bootloader example does. I tried porting the property_kinetis source file and the property header file to work with the blinky example as I noticed these are key for the bootloader example but no success so far. What is the best way to approach this and is it possible at all?
Solved! Go to Solution.
You need to reference your version number information somehow from your application, otherwise it gets removed by the linker.
something like this:
static const unsigned char *versionInfo="1.2.2.4";
int main(void) {
if (versionInfo[0] == '\0') { /* check just to reference it. */
return -1;
}
...
....
}
You need to reference your version number information somehow from your application, otherwise it gets removed by the linker.
something like this:
static const unsigned char *versionInfo="1.2.2.4";
int main(void) {
if (versionInfo[0] == '\0') { /* check just to reference it. */
return -1;
}
...
....
}
Marking with the 'used' attribute, if using GCC, will also prevent the linker from removing what it thinks is unused.
#define ATTR_USED __attribute__ ((used))
static const unsigned char *versionInfo="1.2.2.4" ATTR_USED: