AN4989
In order to trap the exception, a hardware or a software breakpoint can be set in the IDE or
directly programmed in the source code using Arm
Caution:
BKPT is not tolerated if no debugger is connected (refer to
microcontroller debugging on page
In-line insertion of assembly instruction in application C code depends on the IDE.
•
IAR™ EWARM and STM32CubeIDE
void NMI_Handler(void)
{
#ifdef DEBUG
#endif
}
•
Keil
void NMI_Handler(void)
{
#ifdef DEBUG
#endif
}
For each IDE, it is also possible to use the abstraction function defined in the CMSIS library
and provided in STM32Cube software pack.
void NMI_Handler(void)
{
#ifdef DEBUG
__BKPT(0);
#endif
}
In all cases, the Halt Debug-Mode is entered; it allows to investigate the issue by inspecting
Call Stack and Registers content.
Tip:
asm ("BKPT 0");
®
__asm
{
BKPT 0
}
®
On Keil
MDK-Arm µVISION, the caller code is not directly accessible in the Call
Stack Window. Right clicking "Show Caller Code" as in
faulty line.
®
instruction BKPT.
92). it is advised to set it under #ifdef statement.
AN4989 Rev 3
Exception handling
Chapter 9: Dual-Core
Figure 39
leads to the
59/118
117
Need help?
Do you have a question about the STM32 and is the answer not in the manual?