[][src]Crate cortex_m_log

Logging facilities for Cortex-M processors

Destinations

The crate provides following destinations for writes:

  • Dummy - noop destination that performs no writes. Useful for release mode
  • Itm - Uses Cortex-M Itm to send output. Note that it is available only on ARMv7-M and newer
  • Semihosting - Uses Cortex-M Semihosting to send output.

All destinations implements fmt::Write to provide simple and generic interface

Printers

Each destination is provided with corresponding Printer. In addition to providing generic interface it also allows to configure Interrupt mode for all prints. See.

Macros

The crate provide primitieve macros that are enabled only in debug release. Controlled by debug_assertions attribute

use cortex_m_log::{print, println, d_print, d_println};
use cortex_m_log::printer::Dummy;

fn main() {
    let mut log = Dummy;
    println!(log, "Some print with newline!");
    //Debug version of print that resolves into nothing in release mode
    //Note that you must import print macro for it to work
    d_print!(log, "Print stuff: {}", "stuff");
    //Note that you must import println macro for it to work
    d_println!(log, "Print stuff: {} and also newline", "stuff");
}

Modules

destination

Contains possible destination for writes

log

Integration with log

modes

Crate configuration modes

printer

Contains possible printers for Cortex-M

Macros

d_print

Deubg print macro that uses Printers to write formatted output

d_println

Deubg print macro that uses Printers to write formatted output with newline

print

Print macro that uses Printers to write formatted output

println

Print macro that uses Printers to write formatted output with newline