Get stack pointer of interrupted task

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Get stack pointer of interrupted task

520 Views
hbouch
Contributor III

Hello,

Is it possible to get the address of the instruction that will be executed first upon a return from interrupt?

Actually, we would like to know the address of the last executed instruction before SWT watchdog is trigger. This address is saved in a part of RAM that is not initialized at startup and thus can be read by the application during initialization. But since MQX switches stack for interrupt, I'm wondering if there is a way to read the stack of the task that was interrupted.

Thanks,

Hugo

0 Kudos
2 Replies

348 Views
danielchen
NXP TechSupport
NXP TechSupport

HI

From the ARM architecture reference.

pastedImage_1.png

This is for arm,I think the concept is similar to other processors.

Regards

Daniel

0 Kudos

348 Views
hbouch
Contributor III

Hello Daniel,

Thanks for your answer. However, R13 and R14 will contain the SP and LR of the ISR. The LR should contain the return address to _int_kernel_isr.

I'm sure there is a way of reading the saved registers (in the kernel data maybe ?) to see the value of R13 and R14 registers but how?

Regards,

Hugo

0 Kudos