Electronic – Clearing lockup after double fault

cortex-m3gdbstm32

I'm debugging an STM32 with gdb. For some reason my program crashes, and gdb gives the following.

Note: automatically using hardware breakpoints for read-only
addresses.

stm32f2xxx.cpu — clearing lockup after double fault

Program received signal SIGINT, Interrupt. 0xf8ad0300 in ?? ()

I do not understand what this is saying. What is a lockup? What is a double fault? What is a .cpu file?

Best Answer

.cpu is not a file, it's a JTAG TAP name AFAIK (an interface to the debug hardware in your chip that the debugger connects to).

A double fault lockup basically happens when a fault is thrown from within a priority -1 (Hard Fault) handler. The Cortex-M CPU does not let that happen and stops executing instructions (roughy speaking). See ARMv7-M Architecture Reference Manual section B1.5.15 (Unrecoverable exception cases) for the whole story. Note that all faults are escalated to a Hard Fault by default (i.e. right after reset); in this situation any fault will trigger a lockup if the CPU cannot execute the Hard Fault handler for any reason.

A common reason for a double fault lockup would be a problem with your startup code. See Why does my Cortex-M3 Lock Up with a Hard Fault three cycles after reset? for an example of a common misconfiguration (incorrect vector table) that will cause a lockup. The sequence of events leading to the actual lockup is unobvious so it makes for a fascinating reading.

(Note that the Cortex-M core is very complex and any explanation short of the Reference Manual itself is necessarily oversimplified. Feel free to add specific points to your question that you want more details on.)