The following tracing capabilities are supported in CrossStudio

Tracing is controlled by the CrossStudio debugger i.e. tracing starts when a programs runs or restarts from a breakpoint and stops when the program stops on a breakpoint. With ETM tracing it is also possible to start/stop tracing and to include/exclude functions using trace breakpoints.

Trace output from the last run is displayed in the Execution Trace window and instruction counts are accumulated in the Execution Profile window for each each run of a debug session.

Simulator Tracing

The simulator maintains a list of the last N instructions that were executed or not executed if the condition failed. The size of the list is specified using the simulator project property Num Trace Entries.

ETM Tracing

The target trace project property ETM TraceID should be non-zero to enable the ETM when the target interface is connected.

For ARM7/ARM9 the ETB is assumed to follow the debug TAP on the JTAG scan chain. For Cortex-M/Cortex-A the ETB will be identified by the CoreSight ROM table. ETB tracing is selected by setting the target trace project property Trace Interface Type to be ETB when the target interface is connected.

The external trace port is assumed to be a four-bit half-rate clocked port and is selected by setting the target trace project property Trace Interface Type to be TracePort when the target interface is connected.

You can start and stop tracing with breakpoints by setting hardware breakpoints and specifying the breakpoint action to be Trace Start and Trace Stop.

You can choose to include/exclude functions by setting hardware breakpoints on the functions and specifying the breakpoint action to be Trace Include or Trace Exclude. Note that you cannot mix include and exclude ranges.

ITM/DWT Tracing

The target trace project property ITM TraceID should be non-zero to enable the ITM when the target interface is connected.

The target trace project properties ITM Stimulus Ports Enable and ITM Stimulus Ports Privilege are used to specify which ITM channels can be accessed. The library <itm.h> can be used to write to the ITM channels. The following ITM channels are treated specially by CrossStudio:

You can enable local and/or global timestamping on the ITM packets using the ITM Timestamping and ITM Global Timestamping Frequency target trace project properties.

You can specify DWT program counter sampling and exception tracing using the DWT PC Sampling and DWT Trace Exceptions target trace project properties.

Like ETM tracing the ITM/DWT tracing can be directed to an ETB or a TracePort but it can also be directed to a single wire output (SWO) pin using the Trace Interface Type target trace project property. When the SWO pin is used the Trace Clock Speed target trace project property should be set to speed of the TRACECLKIN signal which is typically the processor clock speed.

Data Tracing

You can trace specific data items by setting a data breakpoint and specifying the action to be Trace Data.

Configuring Hardware for Tracing

The script contained in the target trace project property Trace Initialize Script will be executed when debug start or debug attach are selected. This script has the macro $(TraceInterfaceType) expanded with the value of the Trace Interface Type target trace project property. This script, for example, can be used to set up the pins for the external trace port. The Board/CPU support package should provide an implementation of this in the target script.

Supported Trace Capture Devices

The Segger J-Trace ARM and J-Trace Cortex-M supports trace capture from 4-bit half-rate clocked external Trace Ports.

The Segger J-Link - JTAG/SWD supports SWO trace capture.

The STLink/V2 supports SWO trace capture.

Some FTDI-2232 based devices have the second UART channel connected to the SWO. Since this is a target interface independent capability CrossStudio supports this for all target interfaces.