Get stack pointer of interrupted task

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Get stack pointer of interrupted task

542 次查看
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 项奖励
2 回复数

370 次查看
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 项奖励

370 次查看
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 项奖励