This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Invalid assembly instruction MOV PC, R13 Cortex M3

Note: This was originally posted on 24th March 2009 at http://forums.arm.com

Hi,

I am trying to compile linux kernel 2.27 with CodeSourcery GNU toolchain 4.3.2 and somehow I am getting assembler error for instruction

MOV PC, R13

Well, for some reason ARM Cortex M3 assembler is not happy with moving link register (LR a.k.a R13) to program counter.

I tried to find some documentation about this issue on arm site but no luck so far. I have a way to find a solution for this which is first moving R13 (LR) to a general purpose register and then moving general purpose register to program counter (PC).

MOV R0, R13
MOV PC, R0

Thanks for the comments.
Parents
  • Note: This was originally posted on 24th March 2009 at http://forums.arm.com

    Thumb2 reduces the number of operations which can target the SP, LR and PC as they have become much more heavily architected to allow hardware stack support for example. That said - not sure why MOV PC, LR isn't working - it is still allowed as far as I can tell...

    The recommended approach for modifying the PC is to use B lr or BX lr - that should still work and have the same effect.
Reply
  • Note: This was originally posted on 24th March 2009 at http://forums.arm.com

    Thumb2 reduces the number of operations which can target the SP, LR and PC as they have become much more heavily architected to allow hardware stack support for example. That said - not sure why MOV PC, LR isn't working - it is still allowed as far as I can tell...

    The recommended approach for modifying the PC is to use B lr or BX lr - that should still work and have the same effect.
Children
No data