Crates.io | panic-rtt-target |
lib.rs | panic-rtt-target |
version | |
source | src |
created_at | 2020-04-19 19:38:48.709638 |
updated_at | 2024-11-21 20:59:30.367948 |
description | Logs panic messages over RTT using rtt-target |
homepage | |
repository | https://github.com/probe-rs/rtt-target |
max_upload_size | |
id | 232011 |
Cargo.toml error: | TOML parse error at line 21, column 1 | 21 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
Logs panic messages over RTT. A companion crate for rtt-target.
RTT must have been initialized by using one of the rtt_init
macros. Otherwise you will get a linker error at compile time.
Panics are always logged to the print channel. Upon panicking the channel mode is also automatically set to BlockIfFull
, so that the full message will always be logged. If the code somehow manages to panic at runtime before RTT is initialized (quite unlikely), or if the print channel doesn't exist, nothing is logged.
The panic handler runs in a non-returning critical_section which implementation should be provided by the user.
Cargo.toml:
[dependencies]
rtt-target = "x.y.z"
panic-rtt-target = "x.y.z"
main.rs:
#![no_std]
use panic_rtt_target as _;
use rtt_target::rtt_init_default;
fn main() -> ! {
// you can use `rtt_init_print` or you can call `set_print_channel` after initialization.
rtt_init_default!();
panic!("Something has gone terribly wrong");
}
You can enable the defmt
feature so that panics are printed to the defmt channel. If you do this
and have configured both a print and a defmt channel, the panic message will be printed to both.
The defmt
feature doesn't automatically enable rtt-target/defmt
. This allows you to use a
different defmt backend if needed.