Digging Into Trace Data

A hands-on approach for embedded C/C++ tools.


In previous blogs we covered an introduction to System Trace Macrocell (STM) concepts and terminology, and the STM Programmers’ model with an example of how to generate efficient trace data. Once the STM is generating a trace stream, we may wish to view it within our Debugger.

DS-5 implements an “Events View,” which serves this purpose.

Configuring your target

First, it is necessary to make sure that the platform configuration for your target is configured (via DTSL options) to collect trace from the STM, otherwise the view will not be configurable. From the Debug Configurations user interface, we can find the DTSL Options “Edit…” button underneath the target selection list.

Each platform may look slightly different. First, select a valid trace sink via the “Trace Buffer” tab – most platforms default to “None” and may have many options such as “DSTREAM” or “ETB.”

There is usually a dialog tab marked “STM” or a checkbox which enables trace from a particular STM, per the following screenshot:

fig1 juno-enable-stm-trace

Configure the Events view

Once connected we can configure our Events view. By default, it looks fairly empty. This view must be configured for each Master and Channel combination we want to see in the view. We see an informational item on what the view will decode (which Masters and Channels) and the source (in this case, DSTREAM: STM).

The view is organized in pages, and the VCR-like controls will walk us back and forth within the decoded trace:

fig2 Events

To configure the view, find the Settings menu (next to the view minimize/maximize buttons) and select the “Events Settings…” item.

fig3 EventsSettings

We will then be presented with a dialog. First, select the trace source to be shown in the view. In the example we show collecting trace on the DSTREAM unit (via TPIU) and that we want to see the trace output from device “STM.” This makes up the “DSTREAM: STM” trace configuration.

For each Master, a Channel can be defined, and the expected decode of that channel further changed from “Text” to “Binary.” We see that we are enabling Master 64 and Channel 0 as Text and channel 1-65535 as Binary. The example code provided only uses Channel 0 and Channel 1, but here we see that we can have a different setting for each master and each channel.

The mapping of Master number to a source device is implementation-specific. For the Juno ARM Development Platform, it is listed in the SoC Technical Reference Manual (specifically for r0, r1, and r2).

fig4 EventsSettingsDialog

Note the Import and Export buttons, which can be used to load in a pre-configured set of configurations, or save them out for later re-use, as different system environments and applications will have different settings.

Viewing trace output

Once we’ve collected trace, we will see the STM output in the Events view. Notice the Master and Channel are reported, the Timestamp increments.

We see, from our example code, our “Cambridge” string (the first character ‘C’ is Marked) and our Prime number and count following:

fig5 EventsDisplayed

  • Jiyesh Kk

    Hello Matt,

    Wanted to check if DSTREAM-ST / DSTREAM unit can be used for r decoding trace data, wait for a specific STM trace event and programming USER IO pins independent of a host computer.

    Our end objective is not to stream the trace data to host computer, decode the same and then trigger a user IO [this would increase the latency] and our test objective would be defeated.