4 releases (breaking)

0.4.0 Sep 27, 2024
0.3.0 Mar 2, 2024
0.2.0 Mar 26, 2023
0.1.0 Feb 19, 2023

#239 in Embedded development

Download history 367/week @ 2024-07-18 846/week @ 2024-07-25 1040/week @ 2024-08-01 1189/week @ 2024-08-08 1203/week @ 2024-08-15 1160/week @ 2024-08-22 644/week @ 2024-08-29 1185/week @ 2024-09-05 1181/week @ 2024-09-12 1299/week @ 2024-09-19 1108/week @ 2024-09-26 1089/week @ 2024-10-03 1567/week @ 2024-10-10 1835/week @ 2024-10-17 995/week @ 2024-10-24 1449/week @ 2024-10-31

6,099 downloads per month
Used in embedded-test

MIT license

6KB
52 lines

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

~1MB
~21K SLoC