Other Parts Discussed in Thread: CC3551E
器件型号: CC3551E
我正在与一位使用 TI Clang 和 CC3551E 的客户合作。 在该器件中、内部 SRAM 分为通用 DRAM (~512K) 和紧密耦合 DRAM (~128K)。 在默认的 Network Terminal 项目中、为这些内存区域分配了一个组分配、如下所示:
GROUP {
.sysmem: {} palign(4) /* This is where the malloc heap goes */
.bss: {} palign(4) /* This is where uninitialized globals go */
.data: {} palign(4) /* This is where initialized globals and static go */
RUN_START(__BSS_START)
RUN_END(__BSS_END)
.stack: {} palign(4) /* This is where the main() stack goes */
} > DRAM_NON_SECURE | TCM_DRAM_NON_SECURE
问题是、这些单独的段(特别是.bss 和.data)实际上并不会在这两个段之间拆分。 假设.sysmem 和.stack 将需要是连续的、因此我们不应该将它们拆分、我们希望将链接器命令文件设置更改为:
GROUP {
.sysmem: {} palign(4) /* This is where the malloc heap goes */
.stack: {} palign(4) /* This is where the main() stack goes */
} > DRAM_NON_SECURE | TCM_DRAM_NON_SECURE
GROUP {
.bss: /* This is where uninitialized globals go */
.data: /* This is where initialized globals and static go */
RUN_START(__BSS_START)
RUN_END(__BSS_END)
} >> DRAM_NON_SECURE | TCM_DRAM_NON_SECURE
...note 在具有.bss 和.data 的第二个组中使用“>>"而“而不是“>>"。“。 然而、这就提出了一个问题、即在不连续的存储器区域之间拆分.data 是否安全。 转换器为__bss_start、并且可以使用__bss_end 来迭代该段、例如、使初始化为零。 调查生成的*。map 文件后、看起来这些符号未使用并获得链接。
进一步调查编译器的_c_int_00 ()->_TI_auto_init ()-> run_binit ()-> copy_in () 零初始化启动序列、似乎一个 init 表用于.bss init、因此我期望.bss 跨越两个非连续存储器区域是安全的。
.bss 跨越两个非连续的存储器区域并从链接器命令文件中删除__bss_start 和__bss_end 是否安全。
GROUP {
.sysmem: {} palign(4) /* This is where the malloc heap goes */
.stack: {} palign(4) /* This is where the main() stack goes */
} > DRAM_NON_SECURE | TCM_DRAM_NON_SECURE
GROUP {
.bss: /* This is where uninitialized globals go */
.data: /* This is where initialized globals and static go */
} >> DRAM_NON_SECURE | TCM_DRAM_NON_SECURE
谢谢、
Stuart


