Using System Trace (STM)

From Texas Instruments Wiki
Jump to: navigation, search

System Trace

Instrumenting STM SW Messages in your Application

  • The STM Library provides printf, message logging and data dump APIs for use to instrument your application. With OMAP4, C64 and C66 based devices the library must be used in blocking mode where the processor is used to move messages to the STM module. As your application executes the STM module formats and transports the data to either the Embedded Trace Buffer (ETB) or over the EMU pins to an XDS560v2 System Trace Emulator (for a much larger trace buffer). The data can then be displayed with CCS in the Trace Display window (instructions below). There are a few simple environment functions (malloc, free, ...) that must be provided at link time. For multi-core devices, the STM library can be built to run on any core.

For STM Library and example downloads that support the following devices see CtoolsLib.

  • OMAP4
  • C6A816x
  • AM389x
  • DM816x
  • TCI66xx/C66xx
  • AM335x (not yet supported by Ctoolslib).


Setting up System Trace (STM)

  • CCS setup/configuration for the device that has STM should have a CSSTM "node". If not, this needs to be added to the CCS target setup configuration specifying correct base addresses (device data sheet contains this information). Additionally, CCS support can also help you with this information, if there is no setup already available as part of CCS. 
  • The "CSSTM" node needs to be connected via CCS debug view before you start using system trace.

**** Start : Device Specific ****

  • For OMAP4 devices please make sure to initialize the STM clock via Scripts->STM_Utility->Setup_STM_Clocking_Modes (debug view selection - Cortex A9_0 context).

**** End : Device Specific ****


  • If you plan to use ETB as trace receiver, please follow the instructions in the section of How to collect STM information in the ETB.
  • If you plan to use XDS560V2 as trace receiver, please follow the instructions in the section of How to collect STM information by XDS560V2 receiver
  • Now when you run your application code the generated STM trace message via embedded STM Software library will be captured by the receiver and you can visualize the data via Trace Analyzer (Tools -> Trace Analyzer->Open Trace Connection in New View-> [emulator name]\CSSTM_0) in CCS.
  • Hardware STM events (For OMAP4 SMSET, Power/Clock profile, Statistics collectors; for C66 based devices CP Tracer) can also be triggered via UBM (or by CToolsLib), captured by the receiver and visualized by the Trace Analyzer. Both software and hardware system trace messages are captured simultaneously in the receiver and displayed in the Trace Analyzer in the sequence they are received by the receiver.

How to collect STM information in the ETB

**** Start : Device Specific ****

  • For OMAP4 connect to the "CSETB" node from the debug view
  • For C66x based devices connect to the TETB_STM node.
  • For OMAP4 devices, enable STM data sending to ETB via Scripts->STM_Utility->EnabeTraceFunnelforETB

**** End : Device Specific ****

  • Open Trace Control from CCS menu and focus current tab to the 'STM" tab.
  • Click on "Receiver" button; select "ETB" from the popup menu and click on "OK".
  • Now change the configuration parameters as appropriate in the Trace Control if necessary. The default parameters are optimal for most users
  • Press "OK" now and this will setup the trace receiver channel for the STM. On success, you are ready to collect STM data to ETB

How to collect STM information by XDS560v2 System Trace Emulator receiver

**** Start : Device Specific ****

  • For OMAP4 enable trace data export to EMU pin 0-N via Scripts->STM_Utility->Configure_EMU0_N_For_STM. Current supported value of N is either 1, 2, or 4. The recommended pin value is 4 as higher pin value provides higher bandwidth.

**** End: Device Specific ****

  • Open Trace Control from CCS menu and focus current tab to the 'STM" tab.
  • Click on "Receiver" button; select "560 V2 Trace" from the popup menu and click on "OK".

**** Start : Device Specific ****

Now change the configuration parameters as appropriate in the Trace Control. For OMAP4 users the Trace Bits setting should be N Bit. N is the number used in step 2. For all other devices select 4 bits. The default parameters for all other options are optimal for most users.

**** End: Device Specific ****

Press "OK" now and this will setup the trace receiver channel for STM collection. On success, you are ready to collect STM data with the XDS560v2 System Trace Emulator.

Related