What is the behavior for a "BKPT" instruction in a HardFault handler

For a Cortex-M7 processor, what is the behavior of the processor if there is no debugger attached and the HardFault handler looks like:

void HardFault_Handler(void)
{
    __asm("BKPT #0");
}

and a BusFault handler looks like:

void BusFault_Handler(void)
{
   __asm("BKPT #0");
}

and a BusFault occurs?

From the ARM®v7-M Architecture Reference Manual, it states in section C1.5 

"A HardFault exception. If both halting debug and the monitor are disabled, a breakpoint debug event escalates to a HardFault and the processor ignores the other debug events."

So it appears to me the BusFault handler will cause a HardFault because of the "BKPT" instruction.  Then in section C1.5, it states

"If a breakpoint occurs in an NMI or HardFault exception handler when halting debug is disabled, the system locks up with an unrecoverable error. For more information see Unrecoverable exception cases on
page B1-611. The breakpoint can be due to a BKPT instruction or generated by the FPB"

So it appears to me the HardFault handler will cause a system lockup.  

The question is that sometime we see a system lockup (infrequently) and most times we see a system reset?   This is with an NXP i.MX-RT106A processor.

Parents
  • Without a debugger connect and without enabling debug monitor exception, a BKPT instruction in HardFault handler do cause LOCKUP.

    The processor export a number of status signals including one for LOCKUP, which can be used to trigger automatic reset of the system (normally with some programmable control so that by default it won't get reset automatically to make debugging easier).

    regards,

    Joseph

Reply
  • Without a debugger connect and without enabling debug monitor exception, a BKPT instruction in HardFault handler do cause LOCKUP.

    The processor export a number of status signals including one for LOCKUP, which can be used to trigger automatic reset of the system (normally with some programmable control so that by default it won't get reset automatically to make debugging easier).

    regards,

    Joseph

Children
More questions in this forum