How to write sting Software version in fixed flash address? And I need read this software version in the hex file. Hope to given an example.
Thanks.
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
How to write sting Software version in fixed flash address? And I need read this software version in the hex file. Hope to given an example.
Thanks.
Hi Vehinfo,
I recommend that you reserve the flash space in your command linker (.cmd) file:
#define OAD_HDR_START FLASH_BASE #define OAD_HDR_SIZE 0xA8 #define OAD_HDR_END (OAD_HDR_START + OAD_HDR_SIZE - 1) //... MEMORY { ENTRY (RX) : origin = ENTRY_START, length = ENTRY_SIZE FLASH_IMG_HDR (RX) : origin = OAD_HDR_START, length = OAD_HDR_SIZE //... GROUP > FLASH_IMG_HDR { .image_header //align PAGE_SIZE }
Then you create a data section inside your project files:
#ifdef __TI_COMPILER_VERSION__ #pragma DATA_SECTION(_imgHdr, ".image_header") #pragma RETAIN(_imgHdr) const imgHdr_t _imgHdr = #elif defined(__IAR_SYSTEMS_ICC__) #pragma location=".img_hdr" const imgHdr_t _imgHdr @ ".img_hdr" = #elif defined(__clang__) const imgHdr_t _imgHdr __attribute__((section( ".image_header"))) __attribute__((used)) = #endif
And populate it with whatever information you would like. I provided an example from an OAD project for you to reference.
Regards,
Ryan