[−][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 infrequent logging that needs to happen quickly. Not usable for logging in interrupt, fault, or panic handlers. More complicated to set up than the blocking interface.
Each 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, with a 600MHz ARM clock. We configured a UART peripheral following the example above. Using a general purpose timer (GPT), we measured the time required to write various log messages. We verified GPT timings with a logic analyzer, which observed a pulse on a GPIO.
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.
The table notes execution time in microseconds (us). Execution time is the time elapsed between the start and end
of a log::info!()
execution.
Logging Invocation | Execution Time, Blocking (us) | Execution Time, DMA (us) |
---|---|---|
log::info!("Hello world! 3 + 2 = {}", 3 + 2); | 3120 | 3.16 |
log::info!("Hello world! 3 + 2 = 5"); | 3120 | 2.84 |
log::info!(""); | 1220 | 2.36 |
log::info!(/* 100 character string */); | 9880 | 4.12 |
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 ( |