大家好、
问题:客户声明的易失性变量、易失性关键字不有用、并且在映射文件中找不到相应的地址。 例如,静态易失性 uint32_t testVolatile;映射文件没有 testVolatile。
客户想知道原因是什么。 谢谢!
此致、
樱桃
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.
大家好、
问题:客户声明的易失性变量、易失性关键字不有用、并且在映射文件中找不到相应的地址。 例如,静态易失性 uint32_t testVolatile;映射文件没有 testVolatile。
客户想知道原因是什么。 谢谢!
此致、
樱桃
您可以使用 RETAIN pragma
已使用 TI v20.2.5编译器尝试以下示例代码:
#include <stdint.h>
#pragma RETAIN (testVolatile)
static volatile uint32_t testVolatile;
int main(void)
{
return 0;
}
使用 --mapfile_contents=sym_defs 链接器选项时,生成的映射文件报告了 testVolatile 变量:
main.obj Run/Load Value Binding Name (Section) -------- -------- --------------- 00000134 local $a (.text) 00000140 local .bss:retain (.bss:retain) 00000134 local .text (.text) 00000134 global main (.text) 00000140 local testVolatile (.bss:retain)