Skip to main content
Chandan Bhatia1
Associate III
January 12, 2021
Question

Debugging hardfault

  • January 12, 2021
  • 1 reply
  • 2117 views

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.

This topic has been closed for replies.

1 reply

KnarfB
Super User
January 12, 2021

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.

Chandan Bhatia1
Associate III
January 12, 2021

Looks like odd PC.

0693W000007AvqMQAS.png

Tesla DeLorean
Guru
January 12, 2021

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 VenmoUp vote any posts that you find helpful, it shows what's working..