# seggermicro/rtt architecture

> Architecture diagram of the GitHub repository seggermicro/rtt, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/seggermicro/rtt
- Repository: https://github.com/seggermicro/rtt

## Overview

SEGGER RTT is an embedded-target library for high-performance bidirectional monitoring and interactive I/O between firmware and a host/debug probe. Firmware applications write output or formatted text into RTT up-channel ring buffers and read host input from down channels; the host/debug probe exchanges data through the shared control block. Optional toolchain syscall shims retarget standard output, and example applications demonstrate echo, menus, formatted output, and throughput measurement. The core source excerpts are partial, so links beyond the documented API and shown calls are omitted where uncertain.

Main entry points: [`RTT/SEGGER_RTT.c`](https://github.com/seggermicro/rtt/blob/main/RTT/SEGGER_RTT.c) (RTT Transfer Engine), [`RTT/SEGGER_RTT.h`](https://github.com/seggermicro/rtt/blob/main/RTT/SEGGER_RTT.h) (RTT API), [`RTT/SEGGER_RTT_printf.c`](https://github.com/seggermicro/rtt/blob/main/RTT/SEGGER_RTT_printf.c) (RTT Formatter), [`Config/SEGGER_RTT_Conf.h`](https://github.com/seggermicro/rtt/blob/main/Config/SEGGER_RTT_Conf.h) (RTT Configuration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_core["RTT Core"]
  node_api["RTT API<br/>[SEGGER_RTT.h]"]
  node_engine["RTT Transfer Engine<br/>[SEGGER_RTT.c]"]
  node_control[("RTT Control Block<br/>[SEGGER_RTT.c]")]
  node_config["RTT Configuration<br/>[SEGGER_RTT_Conf.h]"]
  node_defaults["Default Configuration"]
  node_asm["ARM Optimizations"]
end

subgraph group_printf["Formatted Output"]
  node_printfmod["RTT Formatter"]
end

subgraph group_retarget["Toolchain Retargeting"]
  node_sysgcc["GCC Syscalls"]
  node_sysiar["IAR Syscalls"]
  node_syskeil["Keil Syscalls"]
  node_sysses["SES Syscalls"]
end

subgraph group_examples["Example Apps"]
  node_echo["Input Echo"]
  node_menu["Interactive Menu<br/>[Main_RTT_MenuApp.c]"]
  node_printtest["Printf Test"]
  node_speed["Speed Test"]
end

node_firmware(("Embedded Application"))
node_probe(("Host Debug Probe"))

node_firmware -->|"calls"| node_api
node_api -->|"dispatches"| node_engine
node_engine -->|"reads/writes"| node_control
node_probe -->|"exchanges data"| node_control
node_config -->|"configures"| node_engine
node_defaults -->|"defaults"| node_engine
node_asm -.->|"optional implementation"| node_engine
node_firmware -->|"formats output"| node_printfmod
node_printfmod -->|"writes via RTT"| node_engine
node_sysgcc -->|"retargets writes"| node_engine
node_sysiar -->|"retargets writes"| node_engine
node_syskeil -->|"retargets writes"| node_engine
node_sysses -->|"retargets output"| node_engine
node_echo -->|"uses RTT"| node_api
node_menu -->|"uses RTT"| node_api
node_printtest -->|"tests formatting"| node_printfmod
node_speed -->|"measures transfer"| node_api

click node_api "https://github.com/seggermicro/rtt/blob/main/RTT/SEGGER_RTT.h"
click node_engine "https://github.com/seggermicro/rtt/blob/main/RTT/SEGGER_RTT.c"
click node_control "https://github.com/seggermicro/rtt/blob/main/RTT/SEGGER_RTT.c"
click node_config "https://github.com/seggermicro/rtt/blob/main/Config/SEGGER_RTT_Conf.h"
click node_defaults "https://github.com/seggermicro/rtt/blob/main/RTT/SEGGER_RTT_ConfDefaults.h"
click node_asm "https://github.com/seggermicro/rtt/blob/main/RTT/SEGGER_RTT_ASM_ARMv7M.S"
click node_printfmod "https://github.com/seggermicro/rtt/blob/main/RTT/SEGGER_RTT_printf.c"
click node_sysgcc "https://github.com/seggermicro/rtt/blob/main/Syscalls/SEGGER_RTT_Syscalls_GCC.c"
click node_sysiar "https://github.com/seggermicro/rtt/blob/main/Syscalls/SEGGER_RTT_Syscalls_IAR.c"
click node_syskeil "https://github.com/seggermicro/rtt/blob/main/Syscalls/SEGGER_RTT_Syscalls_KEIL.c"
click node_sysses "https://github.com/seggermicro/rtt/blob/main/Syscalls/SEGGER_RTT_Syscalls_SES.c"
click node_echo "https://github.com/seggermicro/rtt/blob/main/Examples/Main_RTT_InputEchoApp.c"
click node_menu "https://github.com/seggermicro/rtt/blob/main/Examples/Main_RTT_MenuApp.c"
click node_printtest "https://github.com/seggermicro/rtt/blob/main/Examples/Main_RTT_PrintfTest.c"
click node_speed "https://github.com/seggermicro/rtt/blob/main/Examples/Main_RTT_SpeedTestApp.c"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_api,node_engine,node_control,node_config,node_defaults,node_asm toneBlue
class node_printfmod toneAmber
class node_sysgcc,node_sysiar,node_syskeil,node_sysses toneMint
class node_echo,node_menu,node_printtest,node_speed toneRose
class node_firmware,node_probe toneIndigo
```

## Components

### RTT Core

- [RTT API](https://github.com/seggermicro/rtt/blob/main/RTT/SEGGER_RTT.h): `RTT/SEGGER_RTT.h`
- [RTT Transfer Engine](https://github.com/seggermicro/rtt/blob/main/RTT/SEGGER_RTT.c): `RTT/SEGGER_RTT.c`
- [RTT Control Block](https://github.com/seggermicro/rtt/blob/main/RTT/SEGGER_RTT.c): `RTT/SEGGER_RTT.c`
- [RTT Configuration](https://github.com/seggermicro/rtt/blob/main/Config/SEGGER_RTT_Conf.h): `Config/SEGGER_RTT_Conf.h`
- [Default Configuration](https://github.com/seggermicro/rtt/blob/main/RTT/SEGGER_RTT_ConfDefaults.h): `RTT/SEGGER_RTT_ConfDefaults.h`
- [ARM Optimizations](https://github.com/seggermicro/rtt/blob/main/RTT/SEGGER_RTT_ASM_ARMv7M.S): `RTT/SEGGER_RTT_ASM_ARMv7M.S`

### Formatted Output

- [RTT Formatter](https://github.com/seggermicro/rtt/blob/main/RTT/SEGGER_RTT_printf.c): `RTT/SEGGER_RTT_printf.c`

### Toolchain Retargeting

- [GCC Syscalls](https://github.com/seggermicro/rtt/blob/main/Syscalls/SEGGER_RTT_Syscalls_GCC.c): `Syscalls/SEGGER_RTT_Syscalls_GCC.c`
- [IAR Syscalls](https://github.com/seggermicro/rtt/blob/main/Syscalls/SEGGER_RTT_Syscalls_IAR.c): `Syscalls/SEGGER_RTT_Syscalls_IAR.c`
- [Keil Syscalls](https://github.com/seggermicro/rtt/blob/main/Syscalls/SEGGER_RTT_Syscalls_KEIL.c): `Syscalls/SEGGER_RTT_Syscalls_KEIL.c`
- [SES Syscalls](https://github.com/seggermicro/rtt/blob/main/Syscalls/SEGGER_RTT_Syscalls_SES.c): `Syscalls/SEGGER_RTT_Syscalls_SES.c`

### Example Apps

- [Input Echo](https://github.com/seggermicro/rtt/blob/main/Examples/Main_RTT_InputEchoApp.c): `Examples/Main_RTT_InputEchoApp.c`
- [Interactive Menu](https://github.com/seggermicro/rtt/blob/main/Examples/Main_RTT_MenuApp.c): `Examples/Main_RTT_MenuApp.c`
- [Printf Test](https://github.com/seggermicro/rtt/blob/main/Examples/Main_RTT_PrintfTest.c): `Examples/Main_RTT_PrintfTest.c`
- [Speed Test](https://github.com/seggermicro/rtt/blob/main/Examples/Main_RTT_SpeedTestApp.c): `Examples/Main_RTT_SpeedTestApp.c`

### Other components

- **Embedded Application**
- **Host Debug Probe**

## Connections

- Embedded Application → RTT API: calls
- RTT API → RTT Transfer Engine: dispatches
- RTT Transfer Engine → RTT Control Block: reads/writes
- Host Debug Probe → RTT Control Block: exchanges data
- RTT Configuration → RTT Transfer Engine: configures
- Default Configuration → RTT Transfer Engine: defaults
- ARM Optimizations → RTT Transfer Engine: optional implementation
- Embedded Application → RTT Formatter: formats output
- RTT Formatter → RTT Transfer Engine: writes via RTT
- GCC Syscalls → RTT Transfer Engine: retargets writes
- IAR Syscalls → RTT Transfer Engine: retargets writes
- Keil Syscalls → RTT Transfer Engine: retargets writes
- SES Syscalls → RTT Transfer Engine: retargets output
- Input Echo → RTT API: uses RTT
- Interactive Menu → RTT API: uses RTT
- Printf Test → RTT Formatter: tests formatting
- Speed Test → RTT API: measures transfer
