#arm #cortex-m #stm32 #log

cortex-m-log

Logging facilities for Cortex-M processors

7 releases

0.3.3 Sep 8, 2018
0.3.2 Sep 7, 2018
0.3.0 Jul 5, 2018
0.2.0 May 17, 2018
0.1.1 May 15, 2018

#89 in Embedded development

Download history 8/week @ 2018-06-16 5/week @ 2018-06-23 26/week @ 2018-06-30 16/week @ 2018-07-07 3/week @ 2018-07-14 17/week @ 2018-07-21 13/week @ 2018-07-28 16/week @ 2018-08-04 23/week @ 2018-08-11 2/week @ 2018-08-18 7/week @ 2018-08-25 1/week @ 2018-09-01 30/week @ 2018-09-08

55 downloads per month
Used in 1 crate

Apache-2.0

17KB
274 lines

cortex-m-log

Build Status Crates.io Documentation dependency status

Logging facilities for Cortex-M processors

Available features

  • log-integration - Enables log integration
  • semihosting - Enables facilities for cortex-m-semihosting.
  • itm - Enables ITM destination for logging (not available on Cortex-M0 microcontrollers)

lib.rs:

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

#[macro_use(print, println, d_print, d_println)]
extern crate cortex_m_log;
extern crate log;

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");
}

Dependencies

~145KB