Check the physical path
You need all of these:- A SEGGER J-Trace probe detected by
hardware_status - The SEGGER J-Link Software and Documentation Pack
- The fine-pitch CoreSight-20 cable
- A target with ETM trace pins routed to the connector
- A valid SEGGER device name
- An ELF that matches the running firmware
hardware_status and inspect the jtrace provider. It reports the J-Link library path, whether a J-Trace was detected, and the probe name.
Use the built-in tools first
The built-in tools handle the probe lease, stop managed GDB and RTT connections during handoff, store the result, and notify the Trace or Coverage tab.
Choose bounded or streamed ETM
A bounded instruction capture reads the newest window after the run. One DLL read is capped at 65,536 instruction items. A streamed capture repeatedly:- Runs the target for a short slice.
- Halts it.
- Drains the probe.
- Appends symbolized instructions to the session.
summary.streaming.continuous. If it is false, read the gap and lost-instruction counts before you trust reconstructed calls.
Run a custom pyjtrace script
Use the SDK only when the built-in tools cannot express the capture or analysis. Good reasons include:- Reading instruction counts directly in Python
- Combining ETM with RTT, SWO/ITM, high-speed memory sampling, or power trace
- Using J-Link target control, breakpoints, watchpoints, or memory access in the same script
.embedder/hardware/ and run it with hardware_script_run.
.embedder/hardware/capture_etm.py
~/.embedder/share/pyjtrace and adds it to the hardware script’s import path. Do not patch sys.path when the import fails; report the failed automatic installation.
Control the target from the SDK
Use theJLink context manager so the probe always closes:
.embedder/hardware/read_target.py
JLink can be open in a process. A leaked handle blocks later flash, GDB, and RTT operations until the process exits.
The open link exposes:
- RTT and SWO/ITM
- High-speed sampling without firmware instrumentation
- Probe power trace
- CoreSight DP, AP, ETM, ETB, and CP15 access
- Instruction statistics and trace reads
Interpret the instruction stream
ETM records order, not duration. Frame width represents instructions executed, not elapsed time. A supplied CPU frequency creates an estimated time axis. The probe returns its raw instruction buffer newest first. The SDK’s extended reads and capture helpers reverse it to chronological order. Do not reverse the capture again. If the target executes more than the retained window:instructions_executedstill describes the whole run.instruction_countdescribes the retained window.window_truncatedis true.- A frame marked
open_at_startoropen_at_endcrosses a window boundary.
Manage large captures
The SDK can collect longer streams in slices, but storage becomes the limit.instructions.json is roughly 170 bytes per row in the measured implementation. A million rows is about 166 MB and the Trace tab reads the file as one payload.
The SDK warns above about 250,000 rows. For larger analysis, inspect the in-memory result in Python or use a rolling stream window. A rolling window drops the oldest instructions and marks the session truncated.
Fix J-Trace problems
A plain J-Link was detected
A plain J-Link was detected
Use it for GDB or RTT. Replace it with J-Trace for ETM coverage and instruction capture.
Trace starts but contains no instructions
Trace starts but contains no instructions
Check the CoreSight-20 cable, target trace routing,
TRACECLK, device name, and target power.Symbols are wrong
Symbols are wrong
Use the ELF that produced the firmware on the target. Start streamed ETM with the ELF already attached.
The firmware behaves differently while streaming
The firmware behaves differently while streaming
The stream halts between slices. Repeat timing-sensitive tests with a bounded capture or another observation method.
Later probe operations are busy
Later probe operations are busy
Stop the background script or trace session. In custom code, use the
JLink context manager and do not leave a second link open.Coverage and trace
Compare RTT events, bounded ETM, streamed ETM, and coverage.
Hardware scripts
Run custom SDK code with leases and background tasks.

