Keil Logo

Enable 4-Pin Trace (ETM)

To enable CoreSight ETM tracing on Toshiba TMPM330 devices:

  • Connect J-Trace for Cortex to the board's Cortex Debug+ETM connector and to the host computer.
  • Enable the Trace Port Interface as described in the manual 32-bit RISC Microprocessor - TMPM330 Family chapter Port A (PA0-PA7).
  • Configure µVision to capture ETM trace data.

Enable the Trace Port Interface

  1. Create a text file, for example conf_TMPM330.ini, and enter the following code:
    /*-------------------------------------------------------------------
    ** Define the function to enable the trace port
    **-----------------------------------------------------------------*/
    FUNC void EnableTPIU(void) {
    
      _WDWORD(0x40000008, 0x0000007F);     // Configure port A pins as trace output using PAFR1.
      _WDWORD(0x40000004, 0x0000007D);     // Enable output on port A using PACR.
    }
    
    /*-------------------------------------------------------------------
    ** Invoke the function at debugger startup
    **-----------------------------------------------------------------*/
    EnableTPIU();
    

    On TMPM330 devices, port A is used for debugging and tracing. RESET configures PA0 and PA1 as debug pins, and PA2 through PA7 as general-purpose port pins.

    ETM TRACEDATA[0..3] are output on the pins PA3 through PA6. The trace clock is configured on pin PA2. The Port Function Register, PAFR1, selects the port function, whereas the Port Control Register, PACR, enables port A pins as output or input pins.  These pins have to be reprogrammed after each RESET.

    Use the _WDWORD command to configure the PAFR1 and PACR registers.

  2. Open the dialog Options for Target — Debug and insert conf_TMPM330.ini into the field Initialization File.

    Configure the device for tracing

Configure µVision to capture ETM trace data

  1. Enable Use, select Cortex-M/R J-LINK/J-Trace, and click Settings to open the Target Driver Setup dialog.

    Select J-Link/J-Trace as the debugger adapter

  2. Click the Trace tab.

    Options for ETM trace

  3. Set Enable and ETM Trace Enable.
  4. Set Trace Port to Sync Trace Port with 4-bit Data.
  5. The Core Clock must correspond to the device configuration.

Start the debugging session and verify the captured trace data with a µVision window.

Note

  • Use the examples delivered with the Keil board MCBTMPM330 as a reference.
  • ETM tracing works in Serial Wire Debug as well as in JTAG Debug mode.
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.