Purpose
ctrace combines a CMSIS trace-run configuration with raw CoreSight trace data. It decodes the trace into backend-independent events and can produce CSV or CTF output for further analysis, including Trace Compass.
Architecture
Architecture description

Supported today
- Raw SWO stream decoding through OpenCSD
- ITM software trace packets on stimulus ports 1 through 31
- DWT data and address trace, including configured value types and optional PC/address information
- Exception and interrupt trace, including entry, exit, and return
- Periodic PC sampling, including processor-sleep indications and a Trace Compass sleep timeline
- Architectural DWT event-counter and PMU trace-on-overflow output; PMU counters currently use provisional names
Event0 through Event7
- Armv8-M DWT comparator-match packets without additional data
- Local and Global Timestamp packets, hardware synchronization, overflow, decoder-error, and explicit data-loss events
- CSV, CTF 1.8, and Trace Compass XML output
- Target, event-type, and CoreSight Trace Bus ID filtering
- Stream-specific decoder state and CoreSight Trace Bus routing context
- Validation without generating output files
- Processing of multiple solution sets
- Reporting of
info, warning, and error annotations attached to consumed trace-run references
- Integration tests for regular SWO input, reset-like recovery, PC sampling, event counters, PMU packets, and DWT match packets
ITM stimulus port 0 is decoded for stream integrity but intentionally excluded from CSV and CTF payload output. Formatted Trace Buffer input is discovered but currently reported and skipped.
OpenCSD error handling
Invalid ITM packet sequences and packet headers are treated as recoverable stream errors:
- Events before the reported raw offset are retained.
- Events at or after the failing offset are discarded.
- The OpenCSD decoder is reset.
- Decoding resumes only after OpenCSD finds a real hardware ITM synchronization sequence.
- The lost byte range is emitted as an ordered error/data-loss event.
- Pending DWT correlation is cleared and timestamp quality is marked unreliable.
Recoverable trace corruption is reported as [error] and causes a non-zero exit status, but decoding continues after the next valid synchronization point.
A non-recoverable OpenCSD failure aborts the current raw input and removes incomplete output artifacts. Other solution sets can still be processed.
Implemented pull requests
Current development
Remaining work
DWT and PMU
Multi-CPU and multiple trace sources
Trace Buffer, ETB, and ETF
ETB and ETF are trace storage and transport components. They must not be conflated with ETM, which is an instruction-trace source that can be carried by such a formatted stream.
Instruction trace
CTF, dependencies, and release
References
Purpose
ctracecombines a CMSIS trace-run configuration with raw CoreSight trace data. It decodes the trace into backend-independent events and can produce CSV or CTF output for further analysis, including Trace Compass.Architecture
Architecture description
Supported today
Event0throughEvent7info,warning, anderrorannotations attached to consumed trace-run referencesITM stimulus port 0 is decoded for stream integrity but intentionally excluded from CSV and CTF payload output. Formatted Trace Buffer input is discovered but currently reported and skipped.
OpenCSD error handling
Invalid ITM packet sequences and packet headers are treated as recoverable stream errors:
Recoverable trace corruption is reported as
[error]and causes a non-zero exit status, but decoding continues after the next valid synchronization point.A non-recoverable OpenCSD failure aborts the current raw input and removes incomplete output artifacts. Other solution sets can still be processed.
Implemented pull requests
Current development
Remaining work
DWT and PMU
Multi-CPU and multiple trace sources
pnameTrace Buffer, ETB, and ETF
ETB and ETF are trace storage and transport components. They must not be conflated with ETM, which is an instruction-trace source that can be carried by such a formatted stream.
Instruction trace
CTF, dependencies, and release
cmsis_ctf_profile_versionwhenever a compatibility-relevant event layout changescommon/andinterfaces/headers with supported public APIsReferences