*******************************************************************************
The purpose of this demo application is to present a usage of the
Hardfault handling for the S32K3xx MCU.
------------------------------------------------------------------------------
* Test HW: S32K3X2EVB-Q172
* MCU: S32K312
* Compiler: S32DS3.5
* SDK release: RTD 3.0.0
* Debugger: PE micro
* Target: internal_FLASH
********************************************************************************
An example on S32K312:
Read an unimplemented memory (0x80000):
volatile uint32_t read = *((uint32_t*)0x00080000);
Hardfault will occur :--
Read Stack pointer when the HARDFAULT occur :--
SP = 0x2000ffd0
Go to this memory location , 0x2000ffd0 :--
When the program enters an exception handler, the stack frame is pushed onto the stack including the program counter value of the fault instruction.
At exception entry, the processor saves R0 R3, R12, LR, PC and PSR on the stack.
hardfault occurred at, 0x00400e48, this is how to decode the address :--
Now How to reach this address 0x00400e48, using disassembly window :--
This is same place in main() function :--
volatile uint32_t read = *((uint32_t*)0x00080000);