Expand description

defmt global logger over RTT.

NOTE when using this crate it’s not possible to use (link to) the rtt-target crate

To use this crate, link to it by importing it somewhere in your project.

// src/main.rs or src/bin/my-app.rs
use defmt_rtt as _;

Blocking/Non-blocking

probe-run puts RTT into blocking-mode, to avoid losing data.

As an effect this implementation may block forever if probe-run disconnects on runtime. This is because the RTT buffer will fill up and writing will eventually halt the program execution.

defmt::flush would also block forever in that case.

Critical section implementation

This crate uses critical-section to ensure only one thread is writing to the buffer at a time. You must import a crate that provides a critical-section implementation suitable for the current target. See the critical-section README for details.

For example, for single-core privileged-mode Cortex-M targets, you can add the following to your Cargo.toml.

[dependencies]
cortex-m = { version = "0.7.6", features = ["critical-section-single-core"]}