Capture transports
Choose how profiling data leaves the board. hpx supports four transports; the choice affects reliability, throughput and which cables you need, and it is fixed for the whole run.
Prerequisites
Section titled “Prerequisites”A board attached over its debug USB port for rtt, swo and uart; a
second cable from the board’s target USB connector for usb_cdc. The
default needs nothing beyond the probe you already validated.
Which transport
Section titled “Which transport”target.transport |
Hardware | Loses data | Throughput | Pick it when |
|---|---|---|---|---|
rtt (default) |
J-Link only, the flashing cable | no | high | Almost always. |
usb_cdc |
target USB cable plus the J-Link | no (CRC and flow control) | medium | RTT is not available on your host, or the capture is very large. |
uart |
the J-Link OB virtual COM port | best effort | low (115200 8N1) | USB CDC is not available either. |
swo |
J-Link only | yes, silently | low | Diagnostics only: checking the firmware is alive. Never for a measurement. |
The four values are the Transport vocabulary in
src/helia_profiler/vocab.py. hpx does not retry with another transport
after a failure, because the transport changes both the generated firmware
and the capture reliability.
With the default power.firmware: dedicated, power capture flashes a
separate transport-free binary, so the transport affects PMU capture only
and does not bias current or energy results. Only power.firmware: shared
puts the transport inside the power measurement; see
Power measurement.
1. Select it
Section titled “1. Select it”hpx profile model.tflite --transport rtt # defaulthpx profile model.tflite --transport usb_cdchpx profile model.tflite --transport uarthpx profile model.tflite --transport swotarget: transport: rtt2. RTT
Section titled “2. RTT”SEGGER Real-Time Transfer uses buffers in target RAM that the host reads over SWD. No target peripheral is involved in the transfer, which keeps the PMU data clean.
- Hardware: the J-Link over the same USB cable used for flashing. The RTT
target sources are bundled;
target.segger_rtt_pathorSEGGER_RTT_PATHtest another checkout. - hpx opens the RTT session through
pylinkafter J-Link Commander resets the target, and uses a toolchain-aware up-buffer (32 KB for GCC and armclang, 12 KB for ATfE by default;--rtt-buffer-size-upoverrides it when a measured capture needs different sizing). Lines are scanned for the hpx protocol sentinels. - RTT carries the PSRAM model handshake: the firmware emits
HPX_PSRAM_READY, the host writes the model into PSRAM over J-Link, and the firmware proceeds onHPX_GO. PSRAM model placement on the interpreter engines therefore requiresrtt.
3. USB CDC
Section titled “3. USB CDC”The target enumerates as a USB CDC ACM serial device (TinyUSB) and the host reads the same protocol stream from that port.
- Hardware: a cable from the EVB’s target USB connector (not the J-Link connector) to the host, with the J-Link still attached for flashing and reset. Both stay plugged in for the run.
- hpx matches the firmware’s
HPX-<jlink_serial>USB serial-number marker when available; otherwise it falls back to the USB serial ports pyserial reports (COMxon Windows,/dev/ttyACM*or/dev/ttyUSB*on Linux,/dev/cu.usbmodem*on macOS), excluding SEGGER ports and otherHPX-*devices, and asks for an explicit--usb-portwhen candidates are ambiguous.hpx ports list --allshows every port the host enumerates. Reads go throughpyserial, line-buffered. - The firmware pauses USB polling (Timer 3) around each PMU window so USB interrupts stay out of the counters; on some boards residual activity remains, so RTT is quieter when PMU consistency matters.
4. UART
Section titled “4. UART”The J-Link OB virtual COM port at 115200 8N1. Low throughput, best-effort delivery, no extra cable. It is the fallback when a board does not expose a usable target USB path.
5. SWO
Section titled “5. SWO”Serial Wire Output
streams ITM stimulus port 0 over the SWO pin, captured through pylink.
Most Ambiq EVBs route SWO through the J-Link header.
Expected output
Section titled “Expected output”run_metadata.json records the transport, the RTT buffer size or the USB
port used. A clean run reports every requested iteration and layer; a
short count on swo or uart is the transport, not the model.
Troubleshooting
Section titled “Troubleshooting”What next
Section titled “What next”Memory placement for where the model and its arena live, and the PSRAM handshake that needs RTT; PMU counters for what the transport is carrying.