How to read stack pointer, Link register and program counter value for S32K146 (Arm Cortex-M4)

cancel
Showing results for 
Search instead for 
Did you mean: 

How to read stack pointer, Link register and program counter value for S32K146 (Arm Cortex-M4)

846 Views
pratheek_b
Contributor II

How to read the below registers value?

1) Stack pointer(SP) - R13
2) Link Register(LR) - R14
3) Program Counter - R15
4) Exception and Reset Control Registers
5) Program Status Register

 

@S32k146, @ArmCortexM

0 Kudos
1 Reply

834 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @pratheek_b,

Do you want to read it with the core in C?

If so. use inline assembler.

You can refer to this example:

https://community.nxp.com/t5/S32K-Knowledge-Base/Fault-handling-on-S32K14x/ta-p/1114447

fault_exceptions.c

 

BR, Daniel

0 Kudos