Master Tracealyzer with PX5 RTOS
Unlock the Full Potential of Embedded System Tracing
Seamless Integration
Efficient Configuration
Comprehensive Analysis
Step 1
Download and Install Tracealyzer
Step 2
Integrate TraceRecorder
Step 3
Configure Tracing
Step 4
Build and Run
Step 5
Capture Your First Trace
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.
Step 2: Add TraceRecorder
Integrate TraceRecorder into Your Project
Integration of 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
- 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. - 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.
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_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 4: Build and Run
Build and Run your Application
Build and run your application as normal.
Step 5: Capture your first trace
Guide to Capturing a Trace
- Start by downloading and installing the “TraceExporter for VS Code” Extension from here together with all the listed dependencies
- Define an “Output file” for the extension
- Click “Save Trace”. Note: The extension will overwrite any existing file without asking!
