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.

[参考译文] 编译器:如何将地址分配给链接器命令文件中data_section定义的多个变量?

Guru**** 2616675 points
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/tools/code-composer-studio-group/ccs/f/code-composer-studio-forum/654570/compiler-how-to-assigns-address-to-multiple-variable-defined-by-data_section-in-linker-command-file

工具/软件:TI C/C++编译器

您好Champs

我有三个由data_section定义的变量,我希望链接器文件能够根据顺序自动分配地址。   三个变量的大小可能因版本而异。 我希望有一个链接程序文件来处理所有版本。

   #pragma data_section(log_union_flash_a,"Log_A");
   #pragma data_section(log_union_flash_b,"Log_B");

  #pragma data_section(defaults,     "Defaults";

Log_A和Log_B大小相同,默认值的大小比log大得多。

理想情况下 ,这三个变量应具有以下地址规则:

LOG_A应位于数据闪存的开始处,LOG_B在之后,Defautls为最后一个。 每个可变的均应进行32B对齐,无任何其他间隙。

我的命令文件中有下面的内容,但结果是数据闪存开始时出现了alwasy Defautls。

内存

   DFLASH (RX)   :原点= 0x1.88万,长度= 0x0.08万

}

章节

LOG_A ::{}>(DFLASH校准(32)

LOG_B ::{}>(DFLASH ALIGIN(32)

缺省值:{}>(DFLASH align(32)

}

如何让链接根据我的需要分配地址。

此致

Yihe