Stack Frame Inspection
Write a fault handler prologue that captures the stacked register frame so a crash dump can report the faulting PC and LR.
Constraints
- Determine whether MSP or PSP was in use from bit 2 of EXC_RETURN in LR.
- Pass the stack frame pointer to a C function in r0.
- Do not disturb the stacked frame.
- Must work for both handler-mode and thread-mode faults.
- Tail-call the C handler.
- Cortex-M syntax.
1.global HardFault_Handler2HardFault_Handler:3 @ TODO4 b .