jsiei97/FunTechCortexMX_test — Issue #2: Who caused the error?
Author: jsiei97
Created: 2012-01-03 21:32:24+00:00
State: open

Improve the handling of errors so we can find out what caused the error.

Niklas Johansson gave us this hint:

From
http://www.keil.com/forum/14555/

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

See also:
* https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/DispForm.aspx?ID=11388
* www.keil.com/appnotes/files/apnt209.pdf