#logging #cortex-m #no-std

no-std itm_logger

An implementation of the log facade that sends logging information over ITM stim port 0

3 releases

0.1.2 Sep 17, 2020
0.1.1 Apr 22, 2020
0.1.0 Apr 21, 2020

#587 in Debugging

Download history 22/week @ 2024-03-11 20/week @ 2024-03-18 34/week @ 2024-03-25 92/week @ 2024-04-01 19/week @ 2024-04-08 52/week @ 2024-04-15 23/week @ 2024-04-22 14/week @ 2024-04-29 17/week @ 2024-05-06 15/week @ 2024-05-13 16/week @ 2024-05-20 23/week @ 2024-05-27 14/week @ 2024-06-03 19/week @ 2024-06-10 23/week @ 2024-06-17 16/week @ 2024-06-24

74 downloads per month
Used in 5 crates (3 directly)

MIT/Apache

10KB
154 lines

itm_logger

An implementation of the log facade that sends logging information over ITM stim port 0

Crate Documentation

License

This template is licensed under either of

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