Skip to main content
steffen23
Visitor II
May 28, 2010
Question

Testing Register R0-R12

  • May 28, 2010
  • 2 replies
  • 601 views
Posted on May 28, 2010 at 10:07

Testing Register R0-R12

    This topic has been closed for replies.

    2 replies

    picguy2
    Associate III
    May 17, 2011
    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.

    t1_it
    Visitor II
    May 17, 2011
    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.