3 releases
0.1.2 | Sep 17, 2020 |
---|---|
0.1.1 | Apr 22, 2020 |
0.1.0 | Apr 21, 2020 |
#641 in Debugging
38 downloads per month
Used in 5 crates
(3 directly)
10KB
154 lines
itm_logger
An implementation of the log facade that sends logging information over ITM stim port 0
License
This template is licensed under either of
-
Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
-
MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
lib.rs
:
An implementation of the log facade that sends logging information over ITM stim port 0
Calls to logging macros optimize down to nothing if logging
feature is not enabled.
Usage
use itm_logger::{
logger_init,
update_tpiu_baudrate,
log,
info,
error,
Level,
};
logger_init();
// if you change the CPU clock during boot up
let sysclk: Hertz = clocks.sysclk().into();
update_tpiu_baudrate(sysclk.0, ITM_BAUD_RATE).expect("Failed to reset TPIU baudrate");
perform-enabled-checks
feature
Not enabled by default
Enabling this feature causes the logger to attempt to check if ITM is enabled before writing to it.
This should work on all cortex-m except M0. See is_debugger_attached documentation for more information.
Checks performed are:
- Debug is enabled (DCB::DHCSR::DEBUGEN)
- ITM is enabled (ITM::TCR::ITMENA)
- Stim port we're using is enabled (ITM::TER[PORT])
Dependencies
~200KB