User manual

EMU3 emulator features UM0036
310/385 Doc ID 7705 Rev 11
Example 1—Trace ON inside a function
This example shows you how to program the Advanced Breakpoints window so that the
trace is recorded only during the running of a particular program function.
Imagine that you have a program called sample1.c, which calls the function my_lib at line
170 (as shown in Figure 246) and that you want to have the trace recorded while the
program is executing that function.
Figure 246. Calling function my_lib
Proceed as follows:
1. Open the Advanced Breakpoints window.
2. You must start application execution with the trace OFF, to do this remove the
checkmark next to the Start with Trace On option.
3. Program your Advanced Breakpoint as described in the table below.
4. Set Event 1 to first instruction of function (), and set Event 2 to last instruction of
function (). Trace recording takes place only within the function.
In the Trace window, the discontinuity event in the Trace Event column allows you to
distinguish each pass inside the function.
Example 2—Programmable trigger position in trace
In this example, we will program the recording of the trace to begin when a specific condition
is met, then record the trace for 128 cycles, then stop the program.
Proceed as follows:
Table 76. Advanced breakpoints summary
Step Description
START with TRACE OFF
LEVEL 1:
IF (opcode fetch at sample1.c:107)
THEN trace ON
ELSE IF (opcode fetch at sample3.c:111)
THEN trace OFF;
LEVEL 2-4: (empty)