[−][src]Crate itm_logger
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])
Macros
debug | Re-export of |
error | Re-export of |
info | Re-export of |
log | The standard logging macro. |
stub | A macro that accepts logging syntax but does no logging. It |
trace | Re-export of |
warn | Re-export of |
Enums
Level | An enum representing the available verbosity levels of the logger. |
Functions
disable_logger | Globally disable all logging |
enable_logger | Globally enable logging, level filtering is still performed |
init_with_level | Initialise the logger and set the log level to the provided |
logger_init | Wrapper around |
update_tpiu_baudrate | Updates the tpiu prescaler to output the desired baud rate trace_clk_freq: The frequency of TRACECLKIN in HZ, this is HCLK on most STM32 devices but is implementation specific. Check the ref manual for TRACECLKIN baud: The baud rate to set on SWO Returns an error if baud > trace_clk_freq or if trace_clk_freq % baud != 0 |