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

serial wire debug

sir,

     I am working with SWD(serial wire debug protocol) on cortex m4 architecture, one thing  i don't understand that i am unable to write value into registers r13 and r14 the remaining registers all are updating but for r13 and r14 i am unable to write into it?? i don't know what the reason would be could any one please help me??

  • R13 is the stack pointer and there are special instructions to update the stack pointer. I think it is MSR instruction which can be used to write to special register. See here.

    Also, as per the user guide page 3-12 here

    3.3.2 Restrictions when using PC or SP

    Many instructions have restrictions on whether you can use the Program Counter (PC) or Stack Pointer (SP) for the operands or destination register. See instruction descriptions for more information.

    R14 is the link register and is used to store return address of subroutines

    BL and BLX instructions write the address of the next instruction to LR (the link register, R14).

    Hope it helps.