#debugging #rtt #embedded-debugging

no-std rtt-target

Target side implementation of the RTT (Real-Time Transfer) I/O protocol

12 releases

0.6.2 Oct 13, 2025
0.6.1 Dec 2, 2024
0.6.0 Nov 21, 2024
0.5.0 Jan 4, 2024
0.2.0 May 7, 2020

#302 in Embedded development

Download history 7872/week @ 2026-01-21 11053/week @ 2026-01-28 16513/week @ 2026-02-04 7496/week @ 2026-02-11 8103/week @ 2026-02-18 10662/week @ 2026-02-25 10408/week @ 2026-03-04 8973/week @ 2026-03-11 8346/week @ 2026-03-18 9161/week @ 2026-03-25 8249/week @ 2026-04-01 8310/week @ 2026-04-08 10835/week @ 2026-04-15 10034/week @ 2026-04-22 7893/week @ 2026-04-29 11069/week @ 2026-05-06

41,185 downloads per month
Used in 99 crates (80 directly)

MIT license

53KB
783 lines

rtt-target

crates.io documentation

Target side implementation of the RTT (Real-Time Transfer) I/O protocol. RTT implements input and output via a debug probe using in-memory ring buffers and polling. This enables debug logging from the microcontroller with minimal delays and no blocking, making it usable even in real-time applications where e.g. semihosting delays cannot be tolerated.

Documentation

Platform support

A platform-specific critical-section implementation is needed to use this library.

Output directly to a channel object with write! or the binary write method does not require locking and therefore does not need any platform-specific critical section.

Usage

With a platform-specific critical section in use, printing is as simple as:

use rtt_target::{rtt_init_print, rprintln};

fn main() {
    rtt_init_print!();
    loop {
        rprintln!("Hello, world!");
    }
}

rtt-target also supports initializing multiple RTT channels, and even has a logger implementations for log and defmt that can be used in conjunction with arbitrary channel setups.

The defmt integration requires setting features = ["defmt"]. Furthermore, you have to either invoke rtt_init_defmt! or set up your channel(s) manually and invoke set_defmt_channel before using defmt.

The log integration requires setting features = ["log"]. Furthermore, you have to either invoke rtt_init_log! or set up your channel(s) manually and invoke init_logger/init_logger_with_level before using log.

Note: For your platform, particularly if you're using a multi-core MCU, external logger implementations might be better suited than the one provided by this crate via the log/defmt feature.

For more information, please check out the documentation.

Development

The examples-cortex-m and panic-test crates come with build files for the venerable STM32F103C8xx by default, but can be easily adapted for any chip as they contain only minimal platform-specific runtime code to get fn main to run.

Dependencies

~1.5MB
~23K SLoC