cancel
Showing results for 
Search instead for 
Did you mean: 

Debugging hardfault

Hello, I need suggestion in debugging hardfault. I got stack as below, I am kind of unsure how to debug it.

0693W000007AuZ0QAK.png 

CFSR value is 0x00020000 means its INVSTATE.

3 REPLIES 3
KnarfB
Principal III

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.

Looks like odd PC.

0693W000007AvqMQAS.png

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.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..