我创建了一个内存链接器脚本并将其保存为eclipse中的memory.ld:项目:属性:gcc链接器:杂项:我添加了-M -T memory.ld
memory.ld:
MEMORY
{
ram (rw) : ORIGIN = 0x4000000 , LENGTH = 2M
}
SECTIONS
{
RAM : { *(.myvarloc)
} > ram }
Run Code Online (Sandbox Code Playgroud)
在我的c程序中:我做了一个全局声明:
__attribute__ ((section(".myvarloc")))
uint8 measurements [30];
Run Code Online (Sandbox Code Playgroud)
错误:
/usr/bin/ld: FEBRUARY section `.text' will not fit in region `ram'
/usr/bin/ld: region `ram' overflowed by 20018 bytes
/usr/lib/i386-linux-gnu/libc_nonshared.a(elf-init.oS): In function `__libc_csu_init':
(.text+0x2b): undefined reference to `__init_array_end'
/usr/lib/i386-linux-gnu/libc_nonshared.a(elf-init.oS): In function `__libc_csu_init':
(.text+0x31): undefined reference to `__init_array_start'
/usr/lib/i386-linux-gnu/libc_nonshared.a(elf-init.oS): In function `__libc_csu_init':
(.text+0x57): undefined reference to `__init_array_start'
/usr/bin/ld: FEBRUARY: …Run Code Online (Sandbox Code Playgroud)