To set a trigger in the
Disassembly
view:
- In the CodeWarrior Projects view, expand the Sources folder of your project.
- Double-click the source file, for example, main.c to display its contents in the editor area. Replace the source code in the main.c file with the source code shown below.
Listing: Source code 3
#include <hidef.h> /* for EnableInterrupts macro */
#include "derivative.h" /* include peripheral declarations */
volatile int a, b, i;
void f(){}
void f1()
{
b=1;
b=2;
b=3;
}
void f2()
{
a=1;
a=2;
a=3;
}
void main(void)
{
EnableInterrupts;
/* include your code here */
for(i=1;i<10;i++)
{
f();
}
f2();
for(;;)
{
__RESET_WATCHDOG(); /* feeds the dog */
f1();
f2();
} /* loop forever */
}
- Save and build the project.
- Open the Debug Configurations dialog box, and select your project in the tree structure.
- Click the Trace and Profile tab, and check the Enable Trace and Profile checkbox.
- Select the Collect Program Trace option in the Trace Mode Options group.
- Select the Automatically option.
- Select the Collect Trace From Trigger in the Trace Start/Stop Conditions group.
- Check the Break on FIFO Full checkbox.
- Select the Instruction at Address A is Executed option from the Trigger Type drop-down list.
- Click Apply to save the settings.
- Click Debug to debug the application.
- In the Disassembly view, right-click the marker bar corresponding to the address line of the function, f2() before _RESET_WATCHDOG().
Figure 1. Disassembly View 
- Select Trace Triggers > Toggle Trace Trigger A from the context menu.
The trigger icon, A appears in green color on the marker bar, in the editor area and the
Disassembly
view.
- Click Resume to continue collecting trace.
Note: Because you selected the Break on FIFO Full check box in the Trace and Profile tab, the application will stop automatically after the trigger hit. You do not need to stop it manually by clicking Suspend.
- Open the Trace Data viewer following the steps explained in the topic Viewing Data to view the collected data.
The figure below shows the data files and the timeline graph that is generated by the application in which the data has been collected after setting trigger A. You can see
Figure 3 to view the data files that are generated before setting tracepoints. The
Trace Data
viewer in the figure below shows that trace starts collecting from where you set the trigger, and when the trace buffer gets full, the application stops collecting trace. That is, application starts collecting trace from
f2() as highlighted in the figure, and continues till buffer trace gets full.
Figure 2. Trace Data After Setting From Trigger in Automatically Mode 