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

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

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值