Home arrow Support arrow Forums

Luminary Micro Forums

ravaz

Platinum Boarder

2008/08/13 11:27

Re:stack pointer access?

Yes, you must get it from the stack. Just pay attention to use the correct stack pointer. The interrupts always use the main stack pointer and the user code can use the process or the main stack pointer.

Once you know which stack pointer you user code is using you will find the PC at StackPointer + 24.

In case you must get the process stack pointer you must use the following instruction:

mrs r0, psp

This instruction will load the current process stack pointer to the register r0.

To load then the PC to the register r0 you can then use (assuming the correct stack pointer is stored in r0 before):

ldr r0, [r0, #24]


Hope can help,


Ravaz

Post edited by: ravaz, at: 2008/08/13 19:45

login or register to reply

      Topics Author Date
    thread link
stack pointer access?
blechman 2008/08/12 13:46
    thread link
thread linkthread link Re:stack pointer access?
ravaz 2008/08/13 11:27
    thread link
thread linkthread linkthread link Re:stack pointer access?
blechman 2008/08/13 12:54
    thread link
thread linkthread linkthread linkthread link Re:stack pointer access?
blechman 2008/08/13 16:53
    thread link
thread linkthread linkthread linkthread linkthread link Re:stack pointer access?
ravaz 2008/08/13 19:49
    thread link
thread linkthread linkthread linkthread linkthread link Re:stack pointer access?
joseph_yiu 2008/08/14 04:41
    thread link
thread linkthread linkthread linkthread linkthread linkthread link Re:stack pointer access?
blechman 2008/08/14 12:00