AnsweredAssumed Answered

Unwanted breakpoint after hardfault

Question asked by turbofishy on Sep 10, 2012
Greetings,

I'm trying to test a hard fault handler, but are having some problems with executing it.
I generate the hard fault the following way:

MOVS r0, #1 
LDM r0,{r1-r2} 
BX     LR

The problem is that the code break at the first instruction in the hard fault handler and cannot resume with me continuing executing with an attached debugger. I'm using CrossWorks and have disabled every breakpoint (as far as I can see), and also tried with two different debuggers (Segger J-link and TI ICDI) to see if the debugger itself sets some form of unwanted breakpoint at hardfaults.

Is there anything I have missed? I know that the FPB have the capability of setting hardware breakpoints, but the documentation is scarce, and the code does not modify it in any way. Right now I have to have an independent watchdog which resets the cpu after the hard fault handler breaks at the first instruction, but that kind of misses the point of having the handler in the first case.

The behavior is not completely static though, I have been able to execute the handler a few times by resetting and reflashing a couple of times with different compiler flags, and having the debugger connected and disconnected, but can't find a pattern of what works.

Thanks in advance,
/Tomas

Outcomes