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.
Hi Team,
#pragma DATA_SECTION(Name,"myconstants"); const unsigned int Name[10] = {0,1,2,3,4,5,6,7,8,9};
myconstants : > FLASH_BANK0_SEC2,PAGE = 0, ALIGN(4)
According to customer's feedback and my test, These code above can work on F280049C and F28035:
But cannot work on F280025C.
--
Thanks & Regards
Yale
Yale,
Could you clarify with some more information? Are you getting a compiler or linker error, or are the Flash contents not as expected?
If your code compiled successfully, could you provide the contents of timer_ex1_timers.map so we can confirm the location of the symbol Name?
Thanks,
Ibukun
Ibukun,
No error, no warning. Just want to put the array to the specified Flash address. I use same demo(timer_ex1_cputimers) to test. After add these code to timer_ex1_cputimers.c and .cmd file respectively for both of F28004x and F28002x's project, I can find the array "Name" on specified address on F28004x, and cannot find on F28002x.
Here are the map files:
It also demonstrate the result.
--
Thanks & Regards
Yale
Yale,
The F28004x program has been compiled using the COFF format, while the F28002x program uses the newer EABI (Elf) format. When using EABI, any section that is not directly referenced or linked to is removed by default, unless it is explicitly retained by using the #pragma RETAIN(`SECTIONNAME`) directive or passing the --retain option to the linker command line. This would not be necessary in a regular application case, as the section is retained once there is a reference or link to it elsewhere in the code.
You can change the format of the F28002x program to the older COFF format, or add the following line to your code:
/* Do not optimize out the myconstants section for testing purposes */ #pragma RETAIN(`myconstants`) #pragma DATA_SECTION(Name, "myconstants") const unsigned int Name[10] = {0,1,2,3,4,5,6,7,8,9};
For more information about how to migrate your existing code from COFF to EABI, please read C2000 Migration from COFF to EABI.
Best regards,
Ibukun