10 releases (5 breaking)

new 0.6.0 Nov 21, 2024
0.5.0 Jan 4, 2024
0.4.0 Mar 3, 2023
0.3.1 Apr 27, 2021
0.1.1 Apr 19, 2020

#24 in Embedded development

Download history 4146/week @ 2024-08-04 4236/week @ 2024-08-11 4364/week @ 2024-08-18 4014/week @ 2024-08-25 4472/week @ 2024-09-01 3804/week @ 2024-09-08 3837/week @ 2024-09-15 4583/week @ 2024-09-22 3660/week @ 2024-09-29 3505/week @ 2024-10-06 4122/week @ 2024-10-13 4303/week @ 2024-10-20 3924/week @ 2024-10-27 3849/week @ 2024-11-03 2503/week @ 2024-11-10 3473/week @ 2024-11-17

13,976 downloads per month
Used in 81 crates (63 directly)

MIT license

47KB
704 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 implementation for defmt that can be used in conjunction with arbitrary channel setups. The defmt integration requires setting features = ["defmt"], and the used channel needs to be manually configured with set_defmt_channel.

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

~1MB
~23K SLoC