EasyManuals Logo

STMicroelectronics STM32 User Manual

STMicroelectronics STM32
118 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #59 background imageLoading...
Page #59 background image
AN4989 Rev 3 59/118
AN4989 Exception handling
117
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
®
instruction BKPT.
Caution: BKPT is not tolerated if no debugger is connected (refer to Chapter 9: Dual-Core
microcontroller debugging on page 92). it is advised to set it under #ifdef statement.
In-line insertion of assembly instruction in application C code depends on the IDE.
IAR™ EWARM and STM32CubeIDE
void NMI_Handler(void)
{
#ifdef DEBUG
asm ("BKPT 0");
#endif
}
Keil
®
void NMI_Handler(void)
{
#ifdef DEBUG
__asm
{
BKPT 0
}
#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: On Keil
®
MDK-Arm µVISION, the caller code is not directly accessible in the Call
Stack Window. Right clicking "Show Caller Code" as in Figure 39 leads to the
faulty line.

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the STMicroelectronics STM32 and is the answer not in the manual?

STMicroelectronics STM32 Specifications

General IconGeneral
BrandSTMicroelectronics
ModelSTM32
CategoryMicrocontrollers
LanguageEnglish

Related product manuals