I am trying to work with icachetest and it has a file in it named icache.s
contains:
#define LOOP \
subs r2, r2, #1 ; \
mov r0, r0 ; \
mov r0, r0 ; \
mov r0, r0 ; \
mov r0, r0 ; \
mov r0, r0 ; \
beq end_loop ; \
mov r0, r0 ; \
I am using arm-eabi-as
to compile this project but I get this error:
AS icache.S
icache.S: Assembler messages:
icache.S:16: Error: junk at end of line, first unrecognized character is `\'
icache.S:17: Error: junk at end of line, first unrecognized character is `\'
icache.S:18: Error: junk at end of line, first unrecognized character is `\'
icache.S:19: Error: junk at end of line, first unrecognized character is `\'
icache.S:20: Error: junk at end of line, first unrecognized character is `\'
icache.S:21: Error: junk at end of line, first unrecognized character is `\'
icache.S:22: Error: junk at end of line, first unrecognized character is `\'
icache.S:23: Error: junk at end of line, first unrecognized character is `\'
icache.S:52: Error: bad instruction `loop LOOP LOOP LOOP LOOP LOOP LOOP LOOP LOOP LOOP LOOP LOOP LOOP LOOP LOOP LOOP'
icache.S:53: Error: bad instruction `loop LOOP LOOP LOOP LOOP LOOP LOOP LOOP LOOP LOOP LOOP LOOP LOOP LOOP LOOP LOOP'
icache.S:54: Error: bad instruction `loop LOOP LOOP LOOP LOOP LOOP LOOP LOOP LOOP LOOP LOOP LOOP LOOP LOOP LOOP LOOP'
The LOOP
is a C macro as others have pointed out. As it has no parameters or conditionals, it is easily replaced with a gas
macro.
.macro LOOP
subs r2, r2, #1
mov r0, r0
mov r0, r0
mov r0, r0
mov r0, r0
mov r0, r0
beq end_loop
mov r0, r0
.endm
It will behave the same as a #define
after this, with the caveat that only one is allowed per line. The ARM assembler does allow multiple op-codes on a line (as far as I know).
You can use .rept
to repeat the macro.
.rept 2048
LOOP
.endr
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.