2021-01-12 03:44 AM
Hello, I need suggestion in debugging hardfault. I got stack as below, I am kind of unsure how to debug it.
CFSR value is 0x00020000 means its INVSTATE.
2021-01-12 04:55 AM
There is a hard fault analyzer window in the IDE. It looks like your code called a function at address 0x0 what should never happen. Hard to tell why it did.
Could be a NULL pointer for a callback function pointer, a virtual c++ method or such.
2021-01-12 05:25 AM
Looks like odd PC.
2021-01-12 06:05 AM
Or an EVEN one..
Looks like peripheral address in the H7. I might look for an instance structure on a stack, either overflowing a stack frame local/auto, or perhaps a function pointer.
Look in the .MAP as to what 0x2000B4A6 points too
Strange the LR/PC are the same also, I'd personally use a Hard Fault handler that unpacks the failure registers itself. Posted examples on multiple occasions.