Tracealyzer Snapshots with GDB or Eclipse
To get started with Tracealyzer, once you have integrated TraceRecorder as described in the Getting Started guides for your RTOS, the next step is how to transfer the trace data from your target device.
This page provides a guide for how to use snapshot tracing with Eclipse and/or GDB. In the end you also find links about trace streaming.
Watch this video to see a demonstration (including the FreeRTOS setup) or read the guides below, applicable also for Zephyr, ThreadX and other Tracealyzer integrations using TraceRecorder.
Make sure TraceRecorder has been configured to use the RingBuffer streamport module. This keeps the most recent trace data in a circular RAM buffer. You can use different methods to save snapshots from this buffer and view them in Tracealyzer.
Using the GDB dump command:
When the device is halted, run the following GDB command to save the trace data in the working directory of your debugger.
dump binary value trace.bin *RecorderDataPtr
To run the command from your IDE, check for a “Debugger Console” or similar. The Eclipse Debugger Console can be used to run the command, and other IDEs often provide a similar feature.
Open the file in Tracealyzer using File -> Open.
Using the Tracealyzer GDB integration:
Instead of typing in the GDB dump command each time, you can configure Tracealyzer to connect to a GDB server and run this command by clicking on the “Take Snapshot” button.
In Tracealyzer, click the “Take Snapshot” button to open that window.
- Under “Snapshot Engine”, select “GDB”.
- Now click on the “Settings” button in the “Take Snapshot” window to open the GDB settings.
- Path to GDB: Enter the path to your arm-none-eabi-gdb. This is found in your toolchain folder.
- Path to image: Specify the path to the .elf file generated by your build.
- Command to initialize: should be “target remote localhost:<port>”, where <port> is the TCP port number of your GDB server. If the GDB server is started by your IDE, you can often find the port number in the debug settings or by starting a debug session and checking the Console log.
- The other settings can remain unchanged. Save the Tracealyzer settings.
You can now use the “Take Snapshot” button in Tracealyzer, assuming a debug session is active in the GDB server.
Note that snapshots can only be read when the system is halted. If the system is running, it will be halted when reading the snapshot.
Using the Percepio TraceExporter plugin
Percepio also provides a plugin for Eclipse-based IDEs. This gives similar capabilities as the GDB integration in Tracealyzer. The plugin is available in the Eclipse marketplace at https://marketplace.eclipse.org/content/percepio-trace-exporter-stm32cubeide.
Using the TraceExporter plugin:
- Open the Preferences in the “Percepio” menu.
- Make sure “Tracealyzer path” is pointing to the Tracealyzer executable, not only to the Tracealyzer folder.
- It is recommended to set a fixed “Trace Filename”. Note that this will be overwritten each time.
- Set “RTOS Type” to match your RTOS. If your RTOS is not listed but you are using Percepio TraceRecorder as tracing library, select “Other” and make sure Buffer Address is “RecorderDataPtr” and Buffer Size is “sizeof(*RecorderDataPtr)”.
- Apply and Close.
When you have a debug session active, you may now select Percepio -> Save Snapshot Trace. This starts up a new Tracealyzer instance that is connected to the TraceExporter plugin. Repeated snapshots will update that instance of Tracealyzer.
These methods for saving snapshots works for all Tracealyzer integrations using TraceRecorder, for example with FreeRTOS, Zephyr and ThreadX. Watch the video for a demonstration using FreeRTOS.
Trace Streaming
Tracealyzer also supports continuous trace streaming for recording long traces, and with live visualization. Trace streaming is supported in many ways and can be customized to use any host-target interface you might have available. To get started, see the below guides:
- SEGGER J-Link
- IAR Embedded Workbench
- Keil µVision
- TCP or UDP network connection
- USB CDC serial connection
- Streaming is also possible via a user-defined stream port.
For information about trace streaming via Segger J-Link, please refer to the general getting-started guide for the RTOS you are using.
For information about TCP, UDP, USB CDC, or custom trace streaming solutions, please refer to the Tracealyzer User Manual. This is found in the Tracealyzer application under the Help menu -> Creating and Loading Traces -> Using TraceRecorder v4.6 or later -> Stream ports.