【发布时间】:2013-12-16 13:23:42
【问题描述】:
我不得不问它......它确实已经让我发疯了好几天。在选择 arm-none-eabi 作为工具链后,我的生活变成了一场噩梦,原因很简单 - arm-none-eabi-as 将每条评论都视为指令,而且有时它只是不理解 ARM汇编程序抛出花哨的错误,例如“AREA 是错误指令”...
这是我从 keil 的文档中复制并粘贴的代码:
AREA Loadcon, CODE, READONLY
ENTRY ; Mark first instruction to execute
start
BL func1 ; Branch to first subroutine
BL func2 ; Branch to second subroutine
stop
MOV r0, #0x18 ; angel_SWIreason_ReportException
LDR r1, =0x20026 ; ADP_Stopped_ApplicationExit
SVC #0x123456 ; ARM semihosting (formerly SWI)
func1
LDR r0, =42 ; => MOV R0, #42
LDR r1, =0x55555555 ; => LDR R1, [PC, #offset to
; Literal Pool 1]
LDR r2, =0xFFFFFFFF ; => MVN R2, #0
BX lr
LTORG ; Literal Pool 1 contains
; literal Ox55555555
func2
LDR r3, =0x55555555 ; => LDR R3, [PC, #offset to
; Literal Pool 1]
; LDR r4, =0x66666666 ; If this is uncommented it
; fails, because Literal Pool 2
; is out of reach
BX lr
LargeTable
SPACE 4200 ; Starting at the current location,
; clears a 4200 byte area of memory
; to zero
END ; Literal Pool 2 is empty
我的问题是:我应该使用什么标志来使 arm-none-eabi-as 理解它自己的汇编指令并将 cmets 视为 cmets?
*添加:* 这是我用来编译这段代码的命令:
arm-none-eabi-gcc hello.S -Os -g -mthumb -mcpu=cortex-m3 -msoft-float -o hello.elf
【问题讨论】: