User manual
STM8 C tutorial UM0036
360/385 Doc ID 7705 Rev 11
12.7.3 Set an advanced breakpoint
The Advanced Breakpoints window gives access to a powerful function based on a
programmable multi-level logic Sequencer. Advanced breakpoints allow you to set simple or
multi-level breakpoint conditions, in addition to controlling trace recording and trigger output.
In this lesson, you will learn how to set a two level advanced breakpoint. If this program did
not have the bug described in the previous procedure then write access to the
nbOfTransitions variable would only be possible from inside the trapISR function.
However, because of the bug, write access to the nbOfTransitions variable is possible
from outside of the trapISR function. In this procedure we use the advanced breakpoint
feature to detect write access to the nbOfTransitions variable by an instruction located
outside of the trapISR function.
The advanced breakpoint you will set has two levels. When the application executes code
outside of trapISR and write access to nbOfTransitions, “Level 1” of the advanced
breakpoint stops the application. When executing code inside trapISR, the write accesses
are not tracked. This is defined by “Level 2” of the advanced breakpoint.
The advanced breakpoint program must be activated when the program counter is outside
of the trapISR function. We do this by setting a breakpoint outside of the trapISR
function and running the program up to this breakpoint.
1. Set an instruction breakpoint in the waiting_loop function (line 107).
2. Select Debug>Continue from the main menu.
3. When the program stops, remove the instruction breakpoint.
4. Set bookmarks on the first and last instruction of trapISR (line 69 and line 97
respectively) by placing the cursor on the instruction line and selecting Edit>Toggle
Bookmark from the main menu.
Figure 292. Location of bookmarks
5. Select Debug Instrument>Advanced Breakpoints... to open the Advanced
Breakpoints window.