panic-rtt-target
Logs panic messages over RTT. A companion crate for rtt-target.
Documentation
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 on channel 0. 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 channel 0 doesn't exist, nothing is logged.
The panic handler runs in a non-returning critical_section which implementation should be provided by the user.
Usage
Cargo.toml:
[]
= { = "0.7.6", = ["critical-section-single-core"]}
= { = "x.y.z" }
main.rs:
use panic_rtt_target as _;
use rtt_init_default;
!
Implementation details
The provided interrupt handler checks if RTT channel 0 is configured, writes the info
and enters an infinite loop. If RTT channel 0 is not configured, the panic handler enters the failed to get channel infinite loop. The final state can be observed by breaking/halting the target.
!