我需要在STM32F4的.text部分的特定地址上放置一个const字符串。这就是我的记忆应该是这样的:
0x08000000 - 0x08007FFF reserved for bootloader
0x08008000 - 0x08012FFF .text (part1)
0x08013000 - 0x0801303F String constant (64 bytes reserved)
0x08013040 - (end of flash) .text (part2)
LD脚本目前定义如下:
MEMORY
{
ROM (rx) : ORIGIN = 0x08008000, LENGTH = 512K
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 128K
}
_IDENTIFICATION_START = 0x8013000;
SECTIONS
{
.text :
{
KEEP(*(.isr_vector))
*(.text*)
/* < init, ctors, dtors & rodata truncated for readability> */
} > ROM
.identification _IDENTIFICATION_START :
{
KEEP(*(.identification)) ;
}
/* < truncated for readability> */
}
但得到重叠警告。 我试过这个:
MEMORY
{
ROM1 (rx) : ORIGIN = 0x08008000, LENGTH = 0xB000
ROM2 (rx) : ORIGIN = 0x08013080, LENGTH = 512K
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 128K
}
_IDENTIFICATION_START = 0x8013000;
_FWADDRESS_START = 0x8013020;
SECTIONS
{
.text :
{
KEEP(*(.isr_vector))
*(.text*)
} > ROM1
.text :
{
*(.text*)
/* < init, ctors, dtors & rodata truncated for readability> */
} > ROM2
.identification _IDENTIFICATION_START :
{
KEEP(*(.identification)) ;
}
/* < truncated for readability> */
}
现在它完全忽略区域ROM1,将所有内容放在ROM2中,但我还需要在0x08008000处启动代码,因为这是引导加载程序跳转到的地址。
有谁知道如何分割.text,留下一个空格,我可以放置字符串const?