Trace output

Most trace sources generate packetized data that might be further formatted by the trace infrastructure. This means that the captured trace data is not in a human-readable format. The trace data must go through extraction, decompression, decode, and processing stages to become human-readable. Native or self-hosted trace software or a trace-capable debugger implement these steps.

The following diagram shows the trace processing stages.

 

There are exceptions to the trace data not being in human-readable format. For example, the ITM can generate output in UART encoding over Serial Wire Output (SWO). This means that if you look at the trace data in an ASCII hexadecimal editor, you can read some of the trace data.

What happens to the trace data when it is generated depends on your debugging environment and the capabilities of your target.

Most external debug environments pull the trace data into the debugger for analysis. In this situation, the trace data is stored on the target, or exported from the target, using either on-chip capture or off-chip capture. Let’s look at these methods in detail for an external debugger environment.

On-chip capture

The trace data is on chip and is exported to the external debugger:

  • On-chip trace data is usually stored in a small hardware buffer, or is routed to a higher capacity area of the system memory by the Trace Memory Controller (TMC). The applicable TMC configurations are Embedded Trace Buffer (ETB), Embedded Trace FIFO (ETF), or Embedded Trace Router (ETR).
  • At particular points during debugging, the external debugger performs operations to extract the on-chip trace data for analysis purposes.

The following diagram shows on-chip capture:

 

Note: When using on-chip capture, the trace data that is captured is heavily compressed. This heavy compression means that the trace decompression relies on the user having access to the exact image code that was executed by the processor. Any discrepancy between the image code that is used for decompression and the code that was run on the processor leads to decompression corruption.

Off-chip capture

The trace data is output from the target to a debug probe or directly to the external debugger:

  • Trace data is output by the Trace Port Interface Unit (TPIU), Embedded Trace Streamer (ETS), or Serial Wire Output (SWO) that is on the target to an external debugger. The TPIU and ETS output trace data to a debug probe and the debug probe then passes the trace data onto the external debugger. The SWO passes the trace data directly to an external debugger.
  • When an STM or an ITM generates the trace data, if the debugger and debug probe support real-time trace processing, the captured trace data is analyzed and displayed while it is captured. Real-time trace processing is often called streaming trace.
  • Here is an alternative to streaming trace: At particular points during debugging, the external debugger can perform operations to dump trace data that is stored in the debug probe for later trace analysis.

The following diagram shows off-chip capture:

Previous Next