#logging #cortex-m #send #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 5/week @ 2023-11-27 1/week @ 2023-12-11 6/week @ 2023-12-18 10/week @ 2023-12-25 6/week @ 2024-01-01 17/week @ 2024-01-08 2/week @ 2024-01-15 8/week @ 2024-02-05 6/week @ 2024-02-12 29/week @ 2024-02-19 47/week @ 2024-02-26 32/week @ 2024-03-04 9/week @ 2024-03-11

117 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

~195KB