Master Tracealyzer with PX5 RTOS

Unlock the Full Potential of Embedded System Tracing

Discover how to seamlessly integrate Tracealyzer with PX5 RTOS and enhance your debugging capabilities. This guide will walk you through every step needed to capture and analyze trace data effectively.

Seamless Integration

Learn how to integrate Tracealyzer with PX5 RTOS effortlessly.

Efficient Configuration

Configure your system for optimal trace capture with minimal effort.

Comprehensive Analysis

Gain insights into your system’s performance with detailed trace analysis.

Step 1

Download and Install Tracealyzer

After this step you will have obtained a license, downloaded and installed Tracealyzer on your computer.

Step 2

Integrate TraceRecorder

By the end of this guide, you will have successfully integrated TraceRecorder into your project, enabling detailed trace analysis.

Step 3

Configure Tracing

With this guide you’ll learn about the most common trace configurations to ensure accurate and efficient trace data capture.

Step 4

Build and Run

With this guide you’ll ensure smooth compilation of your project as well as executing it to verify the integration and configuration.

Step 5

Capture Your First Trace

The most exciting step of them all, it’s time to harvest! Prepare to gain deep understanding of your systems inner dwellings.

Step 1: Install Tracealyzer

Download and Install Tracealyzer

Download and Installation

Begin by requesting an evaluation license for Tracealyzer. You will receive a license key via email.

All installers can be found at Tracealyzer Updates – Percepio

Windows: A download link is provided in the welcome email. Run the installer and start Tracealyzer. Then activate your installation with your license key.

Linux: See Installing Tracealyzer on Linux Hosts for instructions and download links.

C

Step 2: Add TraceRecorder

Integrate TraceRecorder into Your Project

Integration of TraceRecorder

  1. Clone the PX5-RTOS_TraceRecorder library from GitHub
  2. Include all C source files from the following folders into your PX5 RTOS project:

    PX5-RTOS_TraceRecorderSource
    PX5-RTOS_TraceRecorderSource/streamports/RingBuffer

  3. Add the following directories to your compiler’s include path:

    PX5-RTOS_TraceRecorderSource/config
    PX5-RTOS_TraceRecorderSource/include
    PX5-RTOS_TraceRecorderSource/streamports/RingBuffer/config
    PX5-RTOS_TraceRecorderSource/streamports/RingBuffer/include

  4. In PX5-RTOS_TraceRecorderSource/config/trcConfig.h set TRC_CFG_HARDWARE_PORT to the architecture used:
    • For Cortex-M3/M4/M7 devices, use TRC_HARDWARE_PORT_ARM_Cortex_M
    • For other devices, all available hardware ports can be found at the bottom of RTOS_TraceRecorderSource/include/trcDefines.h
  5. In PX5-RTOS_TraceRecorderSource/config/trcConfig.h the line #error "Trace Recorder: Please include your processor's header file here and remove this line." might need to be replaced. If compilation works by only removing the line everything is fine, else it needs to be replaced with an include of the processor header file.
  6. In PX5-RTOS_TraceRecorderSource/config/trcKernelPortConfig.h set the TRC_CFG_CPU_CLOCK_HZ to the frequency used by the timer for time stamping in the hardware port.
  7. In px5_user_config.h, add #include "trcRecorder.h"
  8. Define PX5_THREAD_ENTER_EXIT_NOTIFY_ENABLE in your assembler’s preprocessor settings.
  9. In main after platform_setup is called (or any time after the timestamp source is setup) and before px5_pthread_start is called, add a call to xTraceEnable with TRC_START as the argument.

Step 3: Configure Tracing

Configure Tracing

Initial setup

There are some configurations possible regarding the ringbuffer used for capturing the trace data. They are to be found in PX5-RTOS_TraceRecorderSource/streamports/RingBuffer/config/trcStreamPortConfig.h. Therein you’re able to set the trace buffer size and select the ringbuffer mode. This minimal configuration will allow you to capture essential trace data without overwhelming your system resources.

  • TRC_CFG_STREAM_PORT_BUFFER_SIZE decides the size of the trace buffer that is stored in RAM.
  • TRC_CFG_STREAM_PORT_RINGBUFFER_MODE can be set to
    • TRC_CFG_STREAM_PORT_RINGBUFFER_MODE_OVERWRITE_WHEN_FULL for continuously recording
    • TRC_CFG_STREAM_PORT_RINGBUFFER_MODE_STOP_WHEN_FULL for stopping when the buffer is full
C

Step 4: Build and Run

Build and Run your Application

Ensure that the TraceRecorder files are correctly configured within your project environment. This involves setting the appropriate paths and ensuring compatibility with your compiler and target platform.

Build and run your application as normal.

C

Step 5: Capture your first trace

Guide to Capturing a Trace

Embarking on your first trace capture is an exciting step in understanding your application’s behavior. Remember, capturing a trace is a crucial step in diagnosing and optimizing your application’s performance.
There are a couple of different ways to read a snapshot from your devices memory. For ease of getting started we are here only referring you to the VS Code plugin method. All the alternative means can be found here ADD LINK!!!!!!

  1. Start by downloading and installing the “TraceExporter for VS Code” Extension from here together with all the listed dependencies
  2. Define an “Output file” for the extension
  3. Click “Save Trace”. Note: The extension will overwrite any existing file without asking!

Opening the Trace

After successfully capturing your trace, the next step is to open it in Tracealyzer. Upon opening, you’ll be greeted with a comprehensive visual representation of your application’s execution. Expect to see a detailed timeline of events, showcasing task executions, interrupts, and system calls.
The interface will provide you with insights into task interactions and timing, allowing you to pinpoint areas for optimization. This visual data is instrumental in understanding the flow and performance of your application, offering a clear path to enhancing efficiency and resolving potential issues.

Using Your Trace

Enhance Your Tracing Skills

Unlock deeper insights by exploring advanced trace analysis techniques and optimize your PX5 RTOS applications.
Percepio: Sensing Software
Solutions
Tracealyzer
Detect
DevAlert
Try
Buy
Resources
Blog
White Papers
Application Notes
Videos
Company
Management
Press
Contact
Security Policy
Events
Stay in Touch
Subscribe
Copyright © 2026 Percepio AB. All rights reserved.  |  Privacy Policy  |  Licensing  |  Terms and Conditions  |  Cookie Settings