defmt
Freea highly efficient logging framework that targets resource-constrained devices, like microcontrollers.
About defmt
defmt (short for 'deferred formatting') is a highly efficient logging framework designed for resource-constrained devices such as microcontrollers. It minimizes the time spent in log statements by deferring the formatting of log messages to the host side, resulting in smaller binary sizes and lower CPU overhead. The framework includes on-target libraries for sending logs over RTT, ITM, or semihosting, a host-side decoder and CLI utility (defmt-print) for viewing logs, proc macros for easy integration, and a test framework for running tests on target. defmt is part of the Knurling project by Ferrous Systems and is available as open-source under Apache 2.0 or MIT license.
Key Features
Pros & Cons
- Highly efficient: deferred formatting reduces CPU and memory overhead on the device
- Small binary footprint compared to traditional logging frameworks
- Flexible transport options (RTT, ITM, semihosting) for different debugging setups
- Part of the well-established Knurling project by Ferrous Systems
- Open source with permissive licensing (Apache 2.0 or MIT)
- Integrates seamlessly with the Rust embedded ecosystem
- Limited to Rust programming language
- Requires host-side decoder to view human-readable logs (additional setup)
- Deferred formatting concept may have a learning curve for new users
- Primarily focused on embedded systems; not suitable for general-purpose logging