cancel
Showing results for 
Search instead for 
Did you mean: 

Testing Register R0-R12

steffen23
Associate
Posted on May 28, 2010 at 10:07

Testing Register R0-R12

2 REPLIES 2
t1
Associate II
Posted on May 17, 2011 at 13:52

''I found out that the problem is that I destroy R7, when I take a look after compiling to my assembler code I can see that my application is moveing R7 to the stack pointer?!? But why?''

I would guess that the compiler is saving R13 in a register and that register happens to end up being (after register allocation) R7.

Do as PICguy suggests.  Only R0 to R3 are scratch registers and so other registers need to be specifically preserved.

picguy2
Associate II
Posted on May 17, 2011 at 13:52

A quick push of r4-r12 before your test followed by the corresponding pop should solve your problem.  ARM C code expects r4-r12 to be preserved on subroutine calls.  Possibly useful: add LR to your push and PC to your pop.