272
8.1
Introduction
In general, there are two standard debug modes available for CPUs:
1.
Halt mode
2.
Monitor mode
Halt mode is the default debug mode used by J-Link. In this mode the CPU is halted
and stops program execution when a breakpoint is hit or the debugger issues a halt
request. This means that no parts of the application continue running while the CPU
is halted (in debug mode) and peripheral interrupts can only become pending but not
taken as this would require execution of the debug interrupt handlers. In circum-
stances halt mode may cause problems during debugging specific systems:
1.
Certain parts of the application need to keep running in order to make sure that com-
munication with external components does not break down. This is the case for Blue-
tooth applications where the Bluetooth link needs to be kept up while the CPU is in
debug mode, otherwise the communication would fail and a resume or single stepping
of the user application would not be possible
2.
Some peripherals are also stopped when the CPU enters debug mode. For exam-
ple; Pulse-width modulation (PWM) units for motor control applications may be
halted while in an undefined / or even dangerous state, resulting in unwanted
side-effects on the external hardware connected to these units.
This is where monitor mode debugging becomes effective. In monitor debug mode
the CPU is not halted but takes a specific debug exception and jumps into a defined
exception handler that executes (usually in a loop) a debug monitor software that
performs communication with J-Link (in order to read/write CPU registers and so on).
The main effect is the same as for halting mode: the user application is interrupted
at a specific point but in contrast to halting mode, the fact that the CPU executes a
handler also allows it to perform some specific operations on debug entry / exit or
even periodically during debug mode with almost no delay. This enables the handling
of such complex debug cases as those explained above.
J-Link / J-Trace (UM08001)
CHAPTER 8
© 2004-2017 SEGGER Microcontroller GmbH & Co. KG
Monitor Mode Debugging
Need help?
Do you have a question about the J-Link and is the answer not in the manual?
Questions and answers