您的位置:首页 > 编程语言

写ARM汇编程序的一个注意事项

2009-04-01 09:53 441 查看
2009-04-01 09:54:32

刚才,给nboot加入了一个汇编的宏,结果导致大面积错误。如下

; Turn on all LEDs.
MACRO
pLED_ON $data

ldr r0, =GPFCON
ldr r1, =0x55aa
str r1, [r0]
ldr r0, =GPFUP
ldr r1, =0xff
str r1, [r0]
ldr r0, =GPFDAT
ldr r1, =$data
str r1, [r0]
b . ; programme is dead here

MEND



BUILD: [01:0000000025:ERRORE] C:/WINCE500/PLATFORM/SMDK2440A/Src/Bootloader/Stepldr/startup.s(75) : error A0051: unknown opcode: pLED_ON
BUILD: [01:0000000027:ERRORE] C:/WINCE500/PLATFORM/SMDK2440A/Src/Bootloader/Stepldr/startup.s(77) : error A0064: code inside data section
BUILD: [01:0000000029:ERRORE] C:/WINCE500/PLATFORM/SMDK2440A/Src/Bootloader/Stepldr/startup.s(78) : error A0064: code inside data section
BUILD: [01:0000000031:ERRORE] C:/WINCE500/PLATFORM/SMDK2440A/Src/Bootloader/Stepldr/startup.s(79) : error A0064: code inside data section
BUILD: [01:0000000033:ERRORE] C:/WINCE500/PLATFORM/SMDK2440A/Src/Bootloader/Stepldr/startup.s(80) : error A0064: code inside data section
BUILD: [01:0000000035:ERRORE] C:/WINCE500/PLATFORM/SMDK2440A/Src/Bootloader/Stepldr/startup.s(81) : error A0064: code inside data section
BUILD: [01:0000000037:ERRORE] C:/WINCE500/PLATFORM/SMDK2440A/Src/Bootloader/Stepldr/startup.s(82) : error A0064: code inside data section
BUILD: [01:0000000039:ERRORE] C:/WINCE500/PLATFORM/SMDK2440A/Src/Bootloader/Stepldr/startup.s(83) : error A0064: code inside data section
BUILD: [01:0000000041:ERRORE] C:/WINCE500/PLATFORM/SMDK2440A/Src/Bootloader/Stepldr/startup.s(84) : error A0064: code inside data section
BUILD: [01:0000000043:ERRORE] C:/WINCE500/PLATFORM/SMDK2440A/Src/Bootloader/Stepldr/startup.s(84) : error A0017: illegal $ substitution, non assembler variable
BUILD: [01:0000000045:ERRORE] C:/WINCE500/PLATFORM/SMDK2440A/Src/Bootloader/Stepldr/startup.s(84) : error A0227: syntax error in expression
BUILD: [01:0000000047:ERRORE] C:/WINCE500/PLATFORM/SMDK2440A/Src/Bootloader/Stepldr/startup.s(85) : error A0064: code inside data section
BUILD: [01:0000000049:ERRORE] C:/WINCE500/PLATFORM/SMDK2440A/Src/Bootloader/Stepldr/startup.s(86) : error A0064: code inside data section



后来发现是MACRO定格导致的问题,缩进就好了

; Turn on all LEDs.
MACRO
pLED_ON $data

ldr r0, =GPFCON
ldr r1, =0x55aa
str r1, [r0]
ldr r0, =GPFUP
ldr r1, =0xff
str r1, [r0]
ldr r0, =GPFDAT
ldr r1, =$data
str r1, [r0]
b . ; programme is dead here

MEND
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: