参考:
https://www.stmcu.org.cn/article/id-328210?=edm
https://blog.csdn.net/sinlog/article/details/81230818
https://blog.csdn.net/lijianboyangting/article/details/78471045
以下实测可用,针对NXP LPC54XXX
一、针对从flash启动,单个函数从flash复制到SRAM中执行。
flash起始地址:0x10000000
RAM起始地址:0x20000000
分散加载文件scatter中
scf文件
LR_IROM1 0x10004000 0x00004000
{
ER_IROM1 0x10004000 0x00004000
{
*(InRoot$$Sections)
.ANY (+RO)
}
RW_IRAM1 0x20000000 0x0000ffff
{
*.o(RAMCODE)
*(+RW,+ZI)
}
}
C文件中定义,
#pragma arm section code = "RAMCODE"
void AAAAAtest()
{
while (1)
{
/* Delay 1000 ms */
SysTick_DelayTicks(1000U);
PRINTF("hello 1111world.\r\n");
}
}
#pragma arm section
查看编译后的map文件