一.环境搭建
1.汇编集成环境:Keil uVision5,可网上查找破解版与基本使用方式
2.由于实验基于ARM9进行,因此需要继续安装ARM9支持包,具体安装方式可参考此链接:MDK5搭建ARM9开发环境
二.Keil运行c/c++程序提示错误
1.Error: L6630E: Invalid token start expected number or ( but found n at position 5 on line 5
解决方法:
在options 的Linker选项卡中不要选择 【Use Memory Layout from …】,并且把下边自动生成的Scatter file文本框清空。
2. L6218E: Undefined symbol Image ERROM1 RO$$Length (referred from s3c2440.o).
解决方法:
options的Asm选项卡下的define栏中输入__EVAL,即定义__EVAL
三.Arm汇编程序(.s)调用c/c++函数
1.在c/c++文件内定义函数
2.假设调用函数名为int Ledlamp(),则需要在文件头写入:IMPORT Ledlamp
3.若提示错误:Error: L6238E: test.o(DATA) contains invalid call from '~PRES8 (The user did not require 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 data items)' function Ledlamp.
解决方法:
在汇编文件的开头,添加“PRESERVE8
”指令
;for example
PRESERVE8
IMPORT Ledlamp
AREA |DATA|,CODE,READONLY
ENTRY
LDR R13,=0x1000
BL Ledlamp
END
Comment