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.
#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)
在TMS320F28035上可以固化,在TMS320F280025C就不行
F28004x的程序是以COFF格式被编译的,而F28002x是EABI(Elf)。使用 EABI 时,默认情况下会删除任何未直接引用或链接到的部分,除非通过使用 #pragma RETAIN(`SECTIONNAME`) 指令或将 --retain 选项传递给链接器命令行来明确保留它。一般情况下没有必要这么做,因为一旦在代码中的其他地方有引用或链接,该部分就会被保留。
你可以将 F28002x 程序的格式更改为旧的 COFF 格式,或将以下代码添加到你的代码中:
/* 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};
有关如何将现有代码从 COFF 迁移到 EABI 的更多信息,请阅读C2000 Migration from COFF to EABI。