Reputation: 83
According to http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0056d/Cihcciij.html
, if my ARM assembly code need to access a C global variable named globvar
, I should use import
and load
instructions like that:
AREA globals,CODE,READONLY
EXPORT asmsubroutine
IMPORT globvar
asmsubroutine
LDR r1, =globvar ; read address of globvar into
; r1 from literal pool
LDR r0, [r1]
ADD r0, r0, #2
STR r0, [r1]
MOV pc, lr
END
, but when I use it in my code, there is an error as "bad instruction
import globvar'"`.
I'm using armv7-android-gcc compiler. I also looked for the analogous problem in this forum, but I get no useful result, so could anybody help me out of this? Thanks a lot.
Upvotes: 5
Views: 4767