Collect Trace Using Jython

To collect trace using remote launch through Jython console, perform the following steps. These steps demonstrate the procedure of launching configuration and collecting both continuous and automatic trace on the HCS08 MC9SO8QE128 target using the sample scripts, TestCollectContinuousHcs08.py and TestCollectAutomaticHcs08.py.

These scripts are available at <CW Installation Directory>\eclipse\plugins\com.freescale.sa.mcu.scripting_*\remote\scripting_sa_mcu.

  1. Create a new HCS08 project with the name hcs08.
  2. Replace the source code of main.c with the code shown below.
    Listing: HCS08 Source Code
    #include <hidef.h> /* for EnableInterrupts macro */
    
    
    #include "derivative.h" /* include peripheral declarations */
    
    
    volatile i = 0;
    
    
    void f() {
    
    
        if (i < 100) {
    
    
          i++;
    
    
          return;
    
    
        }
    
    
        i = 0;
    
    
    }
    
    
    void main(void) {
    
    
        EnableInterrupts;
    
    
    
       /* include your code here */
    
    
    
       for(;;) {
    
    
         f();
    
    
         __RESET_WATCHDOG();/* feeds the dog */
    
    
    
       } /* loop forever */
    
    
    
       /* please make sure that you never leave main */
    
    
    }
    
  3. Save and build your project.
  4. Open the Remote Launch and Jython Consoles views.
  5. Activate remote launch by clicking the Enable Remote Launch button.
  6. Execute the TestCollectContinuousHcs08.py script by running the following commands at the Jython command prompt:
    >>> from scripting_sa_mcu import TestCollectContinuousHcs08
    >>> TestCollectContinuousHcs08.runTraceDemo()
    Figure 1. Running Commands at Jython Command Prompt for Collecting Trace
    Running Commands at Jython Command Prompt for Collecting Trace

    The trace collection starts and the Software Analysis view appears with the trace results.

    Figure 2. Software Analysis View Containing Trace Results Collected Using Remote Launch
    Software Analysis View Containing Trace Results Collected Using Remote Launch
  7. Start a new Jython interpreter by selecting the New Interpreter option from the View menu of the Jython Consoles view.
  8. Execute the TestCollectAutomaticHcs08.py script by running the following commands at the Jython command prompt:
    >>> from scripting_sa_mcu import TestCollectAutomaticHcs08
    >>> TestCollectAutomaticHcs08.runTraceDemo()
  9. Open the Software Analysis view and check the collected results.
    Note: The sample scripts used for collecting continuous and automatic trace on the ColdFire V1 and Kinetis targets are also located at <CW Installation Directory>\eclipse\plugins\com.freescale.sa.mcu.scripting_*\remote\scripting_sa_mcu.

This is how you collect trace using the Jython console.