Tracealyzer is a sophisticated tool for tracing and visualization of RTOS-based systems. Tracealyzer gives an unprecedented insight into the runtime behavior of STM32 firmware, which speeds up debugging, validation and performance optimization. Tracealyzer provides more than 30 graphical views showing different aspects of the real-time software behavior, making it easier to reveal errors and bottlenecks. The views are interconnected in clever ways and very intuitive to use.
This page explains how to get started with Tracealyzer on STM32 devices, assuming you use an RTOS that works with Percepio’s trace recorder library, such as FreeRTOS, SafeRTOS or Micrium µC/OS-III. Tracealyzer also supports other RTOSes like Keil RTX5 and ThreadX using other trace recording libraries. In those cases, please refer to the User Manual of the respective Tracealyzer version.
Tracealyzer relies on a software library that automatically records events from the RTOS kernel and also allows for logging your own events. No special debug/trace hardware is therefore required. The recorder library is highly optimized and the performance penalty is usually very small, in the range of a few percent.
Let’s take FreeRTOS as an example. To integrate the trace recorder library in your FreeRTOS build, follow this Quick Start Guide and make sure to set TRC_CFG_HARDWARE_PORT to TRC_HARDWARE_PORT_ARM_Cortex_M.
The process is very similar for SafeRTOS or Micrium µC/OS-III, but please refer to the User Manual of the respective Tracealyzer version.
The default mode of the recorder is snapshot tracing, using a RAM buffer to hold the trace. To transfer this data to the Tracealyzer application, you may use our plugin for STM32CubeIDE or the general plugin for other Eclipse-based IDEs. They work in the same way and provide a “Percepio” menu as shown on the right, allowing you to save traces and open them in Tracealyzer. You may also use our native ST-Link support for saving snapshots directly from Tracealyzer.
Tracealyzer also supports continuous trace streaming that allows for recording very long traces and with live visualization, as shown in the video.
To get started with streaming mode, see the below guides:
- SEGGER J-Link, via RTT – see the instructions in the Tracealyzer for FreeRTOS Quick Start guide.
- Network connection – see this section in the User Manual and the “/streamports/TCPIP” folder in the recorder library for an lwIP example.
- USB CDC, see this section in the User Manual and the “/streamports/USB_CDC” folder in the recorder library for a STM32 example.
- Using Arm ITM / SWO
- Streaming is also possible via a user-defined stream port.
ST-Link debuggers can also be used for streaming, using SWO and the ITM unit found in many STM32 devices. The ST-Link v2 can give sufficient throughput for limited tracing, e.g. small experiments or demos with limited event rate. The updated ST-Link v3 is a lot faster and can be sufficient in many cases, although the other methods listed above are a lot faster. Just make sure your ST-Link v3 has an updated version of the firmware, from may/june 2019 or later. You may need to optimize the SWO prescaler to get good throughput – around 10-20 is recommended for ST-Link v3.