We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Any hints, tips or tricks to debug a Cortex-M3: Hard Fault Exception?
It's an STM32, and I'm using the standard Keil STM32F10x.s: Startup file - which contains Dummy Exception Handlers (infinite loops) to "catch" the exception.
So, ahving arrived in the Hard Fault Exception Handler, what should I do next...?
"how to look at the processor registers to figure out the memory address the processor came from when it hit the exception."
Yes, that's the kind of thing I was after, although the uVision debugger does actually show the "call tree" - so I was wondering about further info that might help determine the precise cause...
"a very good article - also having been referenced from this forum"
I had searched on "Hard Fault" and not come up with anything...
:-(
The Cortex-M pushes 8 registers on the stack on Hard Fault exception. Here is a code to read the memory address that caused it:
MRS R0,PSP ; Read PSP LDR R1,[R0,#24] ; Read Saved PC from Stack
Thanks - and I found this to read them all:
www.st.com/.../modules.php