SEGGER RTT Integration
Overview
Use this skill to integrate SEGGER RTT as a low-intrusion debug channel. Prove the RTT control block, buffer configuration, J-Link connection, and blocking policy before relying on RTT logs in timing-sensitive firmware.
When To Use
Use this skill when:
- The user wants SEGGER RTT logs or terminal input on an MCU.
- RTT Viewer/J-Link cannot find the control block, logs are missing, output blocks, or input commands fail.
- The task involves RTT buffers, up/down channels, blocking modes, J-Link, SystemView, or debug builds.
Do not use this skill when the debug probe cannot connect. Use architecture or flashing debug skills first.
First Questions
Ask for:
- MCU/core, debug probe, J-Link software version, and IDE/toolchain.
- RTT source files/config and whether
SEGGER_RTT_Init() is called.
- Output mode: blocking, no-block-skip, or no-block-trim.
- Buffer sizes and channels used.
- Whether caches, MPU, low power, or secure/non-secure memory are involved.
Integration Checklist
Include RTT sources once.
Avoid duplicate control blocks from multiple copies of RTT source.
Place control block in accessible RAM.
J-Link must be able to locate and read the RTT control block.
Configure buffer policy.
Blocking output can disturb real-time behavior; choose mode intentionally.
Verify host tooling.
RTT Viewer, J-Link console, IDE plugin, or SystemView must attach to the correct target.
Handle cache and low power.
Cacheable memory and deep sleep can hide or disrupt RTT buffers.
Common Failures
- Control block optimized out or duplicated.
- RTT logs block because host is disconnected and blocking mode is used.
- Buffers too small for burst logs.
- J-Link scans wrong RAM region.
- Cache prevents host from seeing updated data on some cores.
Verification
Before claiming RTT works:
- State probe, RTT source/config, buffer sizes, and blocking mode.
- Confirm host tool sees the control block.
- Confirm one output channel and one input channel if input is needed.
- Confirm behavior with host disconnected if product timing matters.
Example
User:
SEGGER RTT Viewer 连上了但没有日志。
Agent:
- Asks for RTT config, init path, J-Link target, and map/control block placement.
- Checks duplicate RTT sources and buffer mode.
- Verifies a minimal early boot RTT print.
1---2name: segger-rtt-integration3description: Use when integrating, configuring, or debugging SEGGER RTT logs, J-Link real-time terminal I/O, RTT control blocks, buffers, blocking modes, or embedded debug output4---56# SEGGER RTT Integration78## Overview910Use this skill to integrate SEGGER RTT as a low-intrusion debug channel. Prove the RTT control block, buffer configuration, J-Link connection, and blocking policy before relying on RTT logs in timing-sensitive firmware.1112## When To Use1314Use this skill when:1516- The user wants SEGGER RTT logs or terminal input on an MCU.17- RTT Viewer/J-Link cannot find the control block, logs are missing, output blocks, or input commands fail.18- The task involves RTT buffers, up/down channels, blocking modes, J-Link, SystemView, or debug builds.1920Do not use this skill when the debug probe cannot connect. Use architecture or flashing debug skills first.2122## First Questions2324Ask for:2526- MCU/core, debug probe, J-Link software version, and IDE/toolchain.27- RTT source files/config and whether `SEGGER_RTT_Init()` is called.28- Output mode: blocking, no-block-skip, or no-block-trim.29- Buffer sizes and channels used.30- Whether caches, MPU, low power, or secure/non-secure memory are involved.3132## Integration Checklist33341. Include RTT sources once.35 Avoid duplicate control blocks from multiple copies of RTT source.36371. Place control block in accessible RAM.38 J-Link must be able to locate and read the RTT control block.39401. Configure buffer policy.41 Blocking output can disturb real-time behavior; choose mode intentionally.42431. Verify host tooling.44 RTT Viewer, J-Link console, IDE plugin, or SystemView must attach to the correct target.45461. Handle cache and low power.47 Cacheable memory and deep sleep can hide or disrupt RTT buffers.4849## Common Failures5051- Control block optimized out or duplicated.52- RTT logs block because host is disconnected and blocking mode is used.53- Buffers too small for burst logs.54- J-Link scans wrong RAM region.55- Cache prevents host from seeing updated data on some cores.5657## Verification5859Before claiming RTT works:6061- State probe, RTT source/config, buffer sizes, and blocking mode.62- Confirm host tool sees the control block.63- Confirm one output channel and one input channel if input is needed.64- Confirm behavior with host disconnected if product timing matters.6566## Example6768User:6970```text71SEGGER RTT Viewer 连上了但没有日志。72```7374Agent:75761. Asks for RTT config, init path, J-Link target, and map/control block placement.771. Checks duplicate RTT sources and buffer mode.781. Verifies a minimal early boot RTT print.