Looking for a sample Hard Fault Handler that can determine the location of the fault
I have a project that is using custom hardware with a STM32G0B1CBT6 processor. The code is developed using STM32CubeIDE and STM32CubeMX. However, there are times when I am unable to run a debug session and I'm seeing (very) occasional Hard Faults.
I have a diagnostic serial port and have successfully modified my Hard Fault Handler to dump additional information out that port.
So what I'm after is some code that can read registers and/or the stack to provide additional information that I can use (along with the map file, etc) to determine where my Hard Fault is happening.
Can anyone point me in the right direction? All my searches have shown me code that references registers I can't seem to find in the docs.
Thanks.
