3 releases (breaking)

0.3.0 Mar 2, 2024
0.2.0 Mar 26, 2023
0.1.0 Feb 19, 2023

#535 in Embedded development

Download history 40/week @ 2024-01-06 6/week @ 2024-01-13 7/week @ 2024-01-27 2/week @ 2024-02-03 3/week @ 2024-02-10 7/week @ 2024-02-17 130/week @ 2024-02-24 262/week @ 2024-03-02 86/week @ 2024-03-09 10/week @ 2024-03-16 12/week @ 2024-03-23 28/week @ 2024-03-30 20/week @ 2024-04-06 14/week @ 2024-04-13 22/week @ 2024-04-20

88 downloads per month

MIT license

4KB

rtt-log

This Rust crate provides a log facade implementation for the Segger RTT protocol supported by the J-Link, ST-Link and other debug probes. It currently supports ARM Cortex-M and RISC-V targets via the rtt-target crate.

Usage

// Init the logger with maximum level (Trace).
rtt_log::init();

// Alternatively, init the logger with specific level.
rtt_log::init_with_level(log::LevelFilter::Debug);

// Log something.
log::debug!("Application started");

Note:

RTT uses a global symbol _SEGGER_RTT that can only appear once in a compiled binary. Therefore, if you want to use functions from rtt-target directly, import them from rtt-log instead of adding rtt-target as a separate dependency. Otherwise, a linker error about duplicate symbols will occur.

use rtt_log::rtt_target::rprintln;

rprintln!("Hello, world!");

Use a tool like probe-rs on the host to print the messages.

License

Published under the MIT license.

Author: Oliver Rockstedt info@sourcebox.de

Dependencies

~160KB