I want branchto a specific address (NOT a label) using ARM assemblywithout changing case LR. So I go with Binstead of BLor BX. I want this done in GCC inline asm.
There is documentation here, and here is what I tried:
#define JMP(addr) \
__asm__("b %0" \
: \
: \
"r" (addr) \
);
This is a C macro that can be invoked with address. When I run it, I get the following error:
error: undefined reference to 'r3'
Error related to use "r". I looked into it a bit and I found that it could be a bug in gcc version 4.9. *.
By the way, I use Android/Linux Gcc 4.9 cross compiler, on OSX. Also, I don’t know what I should have downloaded something on Rm.
Hooray!
Edit:
, undefined reference to r3 and r4:
#define JMP(addr) \
__asm__("LDR r5,=%0\n\t" \
"LDR r4,[r5]\n\t"\
"ADD r4,#1\n\t" \
"B r4" \
: \
: \
"r" (addr) \
: \
"r4" ,"r5" \
);
:
r5, r4. 1 LSB (emm, ARM?). , , .