Fault Injection & Debugging
Capturing SEGGER RTT and ITM/SWO logs in headless CI
Read SEGGER RTT and ARM ITM/SWO telemetry directly from twin SRAM and core trace registers in CI.
Low-pin-count boards often lack a spare UART for debug logging, so firmware writes logs into a SEGGER RTT control block in SRAM or Cortex-M ITM->PORT[0].
CircuitTwin reads UART consoles alongside RTT/ITM streams so your Rust defmt or C SEGGER_RTT_printf() assertions gate pull requests with zero pin overhead.
Logging channels compared
| Channel | MCU overhead | Best use |
|---|---|---|
UART console | Low (baud limited) | Standard printf, Zephyr shell, NSH |
SEGGER RTT | Microsecond SRAM ring write | Rust defmt, high-rate ISR logging |
ITM / SWO Port 0 | Single register write to 0xE0000000 | Minimal-footprint Cortex-M3/M4/M7/M33 debug logs |
Local CLI workflow
Shell - run ELF and capture console / RTT logs
ct run --json --board nrf52840-dk build/defmt_app.elfSuite & fault configuration
tests/rtt-logging.suite.yaml
version: 1
board: nrf52840-dk
firmware: build/rtt_app.elf
tests:
- name: rtt-boot-marker-check
timeout_ms: 2000
expect:
console_contains: "RTT_BOOT_OK"
exit_code: 0CI pipeline integration
.github/workflows/rtt-ci.yml
name: RTT Logging CI
on: [push, pull_request]
jobs:
rtt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: circuittwin/action@v1
with:
suite: tests/rtt-logging.suite.yamlTroubleshooting checklist
| Symptom | Fix |
|---|---|
| ITM writes silently drop characters | Enable CoreDebug->DEMCR |= TRCENA, ITM->LAR = 0xC5ACCE55 and ITM->TER |= 1. |
| RTT buffer overflows on burst logs | Increase BUFFER_SIZE_UP in SEGGER_RTT_Conf.h from 1024 to 4096 bytes. |
Frequently asked questions
| Question | Answer |
|---|---|
| Does Cortex-M0 or M0+ support ITM/SWO? | No. ITM/SWO exists only on Cortex-M3, M4, M7 and M33. Use UART or SEGGER RTT on Cortex-M0/M0+ boards like NUCLEO-F091RC or RP2040. |