Hello,
I am running into some random hard faults and I would like to get more information on whats causing it.
Would be great if I can get a custom HardFault_Handler function that reads the right registers to find the cause of the hard fault.
I read many forums posts but haven't got a direct answer.
Thanks for your help!
Gaurav.
Hi Gaurav,
there is a hard fault handler widely used for Cortex-M listed here:
Debugging Hard Faults on ARM Cortex-M
If using gdb, you can use the one listed here with GDB scripts:
Debugging ARM Cortex-M Hard Faults with GDB Custom Command
You can find the hard fault handler on GitHub:
McuOnEclipseLibrary/McuHardFault.c at master · GitHub
I hope this helps,
Erich
Hi Erich,
I am using Keil for development on my KL03z and I don't have processor expert mode.
I have actually seen these links before but I couldn't get much out of those.
Would be nice if I could get a HardFault_Handler() function implemented so that it captures the ARM registers just before entering the fault handling and captures the fault status registers.
Thanks,
Gaurav.