Skip to main content

IAR Embedded Workbench for Arm 9.70.x

Getting started with ETM trace

In this section:
  1. Before you start C-SPY, you must set up the trace port for your device. For some devices this is done automatically when the trace logic is enabled. However, for some devices, typically Atmel and ST devices based on Arm 7 or Arm 9, you need to set up the trace port explicitly. You do this by means of a C-SPY macro file. You can find examples of such files (ETM_init*.mac) in the example projects. To use a macro file, choose Project>Options>Debugger>Setup>Use macro files. Specify your macro file—a browse button is available.

    Note that the pins used on the hardware for the trace signals cannot be used by your application.

  2. If your device uses ETR, specify the ETR trace buffer memory layout on the Project>Options>Debugger>Extra options tab. The available parameters are:

    • ‑‑macro_param etrram

      The start of the RAM area for trace storage, for example, 0x040A0000. If not specified, ETB trace will be used instead of ETR trace.

    • ‑‑macro_param etrsize

      The size of the RAM area for trace storage, for example, 0x60000.

    • ‑‑macro_param etrport

      The access port used to access the ETR RAM, for example, 1. If not specified and if ETR is enabled, the port that is used to access the core will be used.

  3. Start C-SPY and choose ETM Trace Settings from the C-SPY driver menu. In the ETM Trace Settings dialog box that appears, check if you need to change any of the default settings.

  4. Open the Trace window—available from the driver-specific menu—and clickactivateButton.png the Activate button to enable collecting trace data.

  5. Click the Edit Settings button to open the ETM Trace Settings dialog box. Make sure that the ETM registers and pins were properly initialized and that the debug probe receives the Trace Clock (TCLK). The dialog box displays the trace clock frequency which is received by the debug probe. Click Cancel to close the dialog box.

  6. Start the execution. When the execution stops, for instance because a breakpoint is triggered, trace data is displayed in the Trace window. For more information, see Trace window.