Master Tracealyzer with PX5 RTOS
Getting Started with Tracealyzer on PX5 RTOS
Integrate TraceRecorder, capture your first PX5 RTOS trace, and analyze it in Tracealyzer.
Step 1
Integrate TraceRecorder
Step 2
Configure Tracing
Step 3
Capture Your First Trace
Capture your first trace and see how your PX5 RTOS application executes.
Prerequisites
Before you begin
- Install Tracealyzer. If you haven’t done so, see detailed instructions here
- Existing PX5 RTOS application
- PX5 RTOS application builds and runs
- Target/debug connection available
Step 1: Add TraceRecorder
Integrate TraceRecorder into Your Project
Add TraceRecorder
- Clone the PX5-RTOS_TraceRecorder library from GitHub
- Include all C source files from the following folders into your PX5 RTOS project:
PX5-RTOS_TraceRecorderSource
PX5-RTOS_TraceRecorderSource/streamports/RingBuffer - 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 - In PX5-RTOS_TraceRecorderSource/config/trcConfig.h set
TRC_CFG_HARDWARE_PORTto 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
- For Cortex-M3/M4/M7 devices, use
Configure TraceRecorder
- 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. - In PX5-RTOS_TraceRecorderSource/config/trcKernelPortConfig.h set the
TRC_CFG_CPU_CLOCK_HZto the frequency used by the timer for time stamping in the hardware port. - In px5_user_config.h, add
#include "trcRecorder.h" - Define
PX5_THREAD_ENTER_EXIT_NOTIFY_ENABLEin your assembler’s preprocessor settings.
Start TraceRecorder
- In main after
platform_setupis called (or any time after the timestamp source is setup) and beforepx5_pthread_startis called, add a call toxTraceEnablewithTRC_STARTas the argument.
For complete TraceRecorder Integration details and advanced configuration, see the detailed TraceRecorder for PX5 RTOS reference guide.
Step 2: 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_SIZEdecides the size of the trace buffer that is stored in RAM.
TRC_CFG_STREAM_PORT_RINGBUFFER_MODEcan be set toTRC_CFG_STREAM_PORT_RINGBUFFER_MODE_OVERWRITE_WHEN_FULLfor continuously recordingTRC_CFG_STREAM_PORT_RINGBUFFER_MODE_STOP_WHEN_FULLfor stopping when the buffer is full
Step 3: Trace Capture
Capture Your First Trace
The capture procedure depends on your development environment. Select the method you use below.
Snapshot
Opening the Trace
A successful trace should show recorded task execution, interrupts and other system events in the timeline.
If the trace is empty or doesn’t open correctly, see Troubleshooting.
Using Your Trace
-
Task scheduling — See when tasks execute, block and resume.
-
CPU usage — Identify tasks consuming significant CPU time.
-
Timing — Find long execution times and unexpected delays.
-
Interrupts — Understand how interrupts affect task execution.
-
User events — Correlate trace data with application-specific behavior and custom events/logs. All synchronized into one execution timeline.
To learn more about using Tracealyzer, see Tracealyzer Features and Capabilities.
Troubleshoot Your PX5 RTOS Trace
Check the Setup Before Capturing Again
Build Fails After Adding TraceRecorder
Hardware-Port or Version Error
Trace File Is Empty
Snapshot Stops Too Soon
Enhance Your Tracing Skills
Unlock deeper insights by exploring advanced trace analysis techniques and optimize your PX5 RTOS applications.
Solutions
Tracealyzer
Detect
DevAlert
Try
Buy
Resources
Blog
White Papers
Application Notes
Videos
Company
Management
Press
Contact
Security Policy
Events
Stay in Touch
Copyright © 2026 Percepio AB. All rights reserved. | Privacy Policy | Licensing | Terms and Conditions | Cookie Settings
