Arm assembler - branch by a programmable amount
I want to manipulate the program counter in an assembler function by branching down a list of instructions by a programmable amount
.syntax unified
.global myasm
myasm: PUSH {R0,R1,r2,r4,R5}
ADD R15,#4
is rejected by the assembler
.syntax unified
.global myasm
myasm: PUSH {R0,R1,r2,r4,R5}
mov r5,r2,lsl #2
ADD R15,r5
is accepted but isn't doing what I want. I assume that R15 increments by 4 for each instruction so I'm making sure that I'm always adding multiples of 4.
This is a technique I've uased on other processors from the PDP11 onwards but the ARM crashes as soon as the ADD instruction executes
Any help appreciated
