I've been reading the ARM assembly language output produced by arm-none-eabi-gcc (the gcc compiler than comes within the Maple IDE).
I thought registers are either r0 to r15, or
Stack ptr register: sp
Frame ptr register: fp
Link (return) register: lr
Instruction Pointer/Program Counter: ip
For example, those are the meanings in microcross.com/GNU-ARM-Assy-Quick-Ref.pdf
Irritatingly, the documentation at CodeSourcery for as, the assembler says:
"9.3.2.3 Register Names
*TODO* Explain about ARM register naming, and the predefined names."
So I had thought "ip" was the name of the Instruction Pointer/Program Counter, but can't find a definitive answer.
But ip = program counter that makes these weird:
cmp ip, #32 // I think this is position independent code, or relocatable code
...
...
movs r5, #1
...
and ip, ip, r5 // "The definitive guide to the Cortex-M3", ed 2, says this is illegal
even these seem a bit odd:
mov ip, r4 // a computed branch?
str ip, [r6, #12] // store the value in ip to a peripheral pin address?
add ip, ip, #2 // skip a thumb instruction?
I am very inclined to believe ip is not the program counter, but what else might it be?
Can anyone confirm that ip is the program counter, or tell me the correct meaning?
Edit: I am pretty sure some of the assembly language instructions in the program are illegal if ip is the program counter.