[−][src]Crate imxrt_uart_log
Logging over an i.MX RT serial interface
The crate provides a log
implementation that
transfers data over UART. It's an extension to the imxrt-hal
crate. The crate provides two logging implementations:
- a simple, blocking interface. Useful for simple logging, and for safely logging in interrupt, fault, and panic handlers.
- a DMA-based, non-blocking interface. Useful for logging that needs to happen quickly, but does not need to be responsive. More complicated to set up than the blocking interface.
The module-level documentation provides examples and recommended use-cases. To see some comparisons between the two, see Performance.
i.MX RT Compatibility
This crate supports all of the same i.MX RT variants as the imxrt-hal
crate.
To see the supported i.MX RT variants, check the HAL's feature support list.
Note: As of this writing, the HAL only supports one i.MX RT variant, the "imxrt1062"
.
For convenience, the "imxrt1062"
feature is enabled by default. This may change in the
future.
Performance
We measured logging execution on a Teensy 4. We configured a UART peripheral following the examples in each module. We measured the CPU clock cycles required to execute each logging statement.
By default, a logging call resembling
log::info!("Hello world! 3 + 2 = {}", 3 + 2);
Produces a message resembling
[INFO log_uart]: Hello world! 3 + 2 = 5
where INFO
describes the log level, log_uart
describes the module, and the remainder
of the message is the serialized content.
CPU clock cycles measure the elapse of cycle counts before and after a log::info!()
macro.
Logging Invocation | CPU Clock Cycles, Blocking | CPU Clock Cycles, DMA |
---|---|---|
log::info!("Hello world! 3 + 2 = {}", 3 + 2); | 2341330 | 1871 |
log::info!("Hello world! 3 + 2 = 5"); | 2341273 | 1683 |
log::info!(""); | 1197246 | 1428 |
log::info!(/* 100 character string */); | 6397302 | 2463 |
Use this crate's examples to reproduce these measurements.
Modules
blocking | A logging implementation that blocks when writing data |
dma | Asynchronous logging using DMA |
Structs
LoggingConfig | Logging configuration |
SetLoggerError | An error that indicates the logger is already set |
Type Definitions
Filter | Filter log messages by module name ( |