The
Instruction Inside Range from Address A to Address B is Executed
trigger type is used to trigger on a program instruction execution inside the range, Address A - Address B, where Address A is the address at which trigger A is set and Address B is the address at which trigger B is set.
Note: For the MC9S08PT60 target specifically, the Instruction Inside Range from Address A to Address B is Executed trigger will hit when any instruction inside the range between trigger address A and trigger address B matches with the data on the bus or program address inside the range.
To collect trace using the
Instruction Inside Range from Address A to Address B is Executed
trigger type:
- In the CodeWarrior Projects view, select 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 2
#include <hidef.h> /* for EnableInterrupts macro */
#include "derivative.h" /* include peripheral declarations */
#define MAX_IT 2
#define SIMPLE 1
typedef int(*FUNC_TYPE)(int);
void entry();
void InterruptTest();
void ContextSwitch(FUNC_TYPE, int);
int PerformanceWork (int);
void Performance1(void);
int Recursive(int);
void Launch(FUNC_TYPE f, int arg)
{
f(arg);
}
void InterruptTest()
{}
void entry()
{
volatile int iteration =0;
InterruptTest();
for (iteration =0; iteration < MAX_IT; /*iteration^=1*/ iteration++)
{ Launch(PerformanceWork, iteration);}
}
int PerformanceWork (int iteration)
{
int ret = 0;
if ( iteration & 1) {
Performance1();
ret = 1;
}
else {
Recursive(3);
ret = 2;
}
return ret;
}
void Performance1(void)
{
}
int Recursive(int n)
{
/* Recursively calculates 0 + 1 + 2 + ... + n */
if (n <= 0) /* breakpoint here */
{
return 0;
}
else
{
return (n + Recursive(n-1));
}
}
void main(void) {
EnableInterrupts; /* enable interrupts */
/* include your code here */
Performance1();
Recursive(2);
Performance1();
for(;;) {
entry();
__RESET_WATCHDOG(); /* feeds the dog */
} /* 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.
- Click Apply and close the Debug Configurations dialog box.
- Set trigger A at ret = 1; and trigger B at ret = 2; in the PerformanceWork() function.
Figure 1. Setting Trigger A and Trigger B in Source Code - Instruction Inside Range 
- Open the Debug Configurations dialog box, and select your project in the tree structure.
- Click the Trace and Profile tab.
- Select the Collect Program Trace option in the Trace Mode Options group.
- Select the Continuously option.
- Select the Collect Trace From Trigger option in the Trace Start/Stop Conditions group.
- Clear the Keep Last Buffer Before Trigger checkbox.
- Ensure that the Instruction Execute option is selected in the Trigger Selection group.
- Select the Instruction Inside Range from Address A to Address B is Executed option from the Trigger Type drop-down list.
- Click Apply to save the settings.
- Click Debug to debug the application.
- Collect the trace data following the steps explained in the topic Collecting Data.
- 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 that are generated by the application in which
trace starts from
Recursive(3) (in
PerformanceWork()), which is the first
address that the application finds between trigger A (
ret = 1;) and trigger B (
ret = 2;) address range after hitting trigger A.
Figure 2. Trace Data - Instruction Inside Range 
Note: In the Instruction Inside Range from Address A to Address B is Executed trigger type, a time delay of one to four instructions, depending on the processor type, might occur when tracing starts.
This is how you can collect trace using the
Instruction Inside Range from Address A to Address B is Executed
trigger type.