defmt
More info
- Creator
- Ferrous Systems (Knurling)
- Released
- 2020
- License
- MIT / Apache 2.0
- Source
- github.com/knurling-rs/defmt
Logging for embedded Rust in which the format strings never leave your laptop — the device sends only an index and raw data.
The name stands for deferred formatting. A plain printf on a microcontroller costs flash for every string and cycles for turning numbers into text. defmt moves the strings into an ELF section that is never loaded onto the device and replaces each with an integer. On the target, only that index and the arguments in binary form go over the wire; the host looks the string up in the ELF file and does the formatting there.
The result is logs that take a fraction of the space and barely disturb timing-critical code. Transport is usually RTT via probe-rs. The catch is that the log is unreadable without exactly the right ELF file — ship the wrong binary and you get numbers instead of messages. Developed by Ferrous Systems under the Knurling project and used heavily by Embassy.