1.如果直接将 ADS 下的启动代码copy 到 MDK 下,编译会提示出错,一般错误
是:.\OutPutFiles\LCD1.axf: Error: L6238E:2440_init.o(Init_2440) contains invalid call from '~PRES8 (The user did notrequire code to preserve 8-byte aligment of 8-byte data objects)' function to'REQ8 (Code was permitted to depend on the 8-byte aligment of 8-byte dataitems)' function App_Main.
解决方法是在代码段前部添加:PRESERVE8,如图 1
2.
Scatter 文件内容:
/*-------------------------------------------------------------
运行域在 SRAM中,可使用以下写法,也可直接将 WR,ZI 段跟在 ROM 后面
LR_ROM1 0x30000000 { ; load region
RO 0x30000000 0x0800000 { ; load address = execution address
*.o (Init, +First)
*(InRoot$$Sections)
.ANY (+RO)
}
RW 0x30800000 0x0800000 { ; RW data
.ANY (+RW +ZI)
}
ZI 0x40000000 0x00001000 {
.ANY (+RW +ZI)
}
}
很多同志会遇到.\OutPutFiles\LCD1.axf: Error: L6218E:Undefined symbol
Image$$RO$$Base (referred from2440_init.o).
原因:
从 ADS copy 过来的和 KEIL 默认的标号是不一致的,修改 scatter 文件里面的 ER_ROM1为 RO 标号,RW_RAM1 为 RW,RW_IRAM1为ZI 以此类推即可。
3.由于 MDK 默认生成的输出文件时HEX 的,要使之生成 BIN 的需要添加一条命令:
D:\Keil\ARM\BIN40\fromelf.exe --bin --output=./LCD1.bin LCD1.axf