3 releases
Uses new Rust 2024
| 0.1.2 | Jan 9, 2026 |
|---|---|
| 0.1.1 | Jan 6, 2026 |
| 0.1.0 | Dec 23, 2025 |
#562 in Command-line interface
5KB
62 lines
defmt-stdout
Forwards defmt frames to the standard output to make it usable on Linux desktops.
Requirements
.cargo/config.toml
[build]
target = "x86_64-unknown-linux-gnu" # or -musl
[target.x86_64-unknown-linux-gnu]
rustflags = [
"-C", "relocation-model=static",
"-C", "link-arg=-T/usr/lib/x86_64-linux-gnu/ldscripts/elf_x86_64.x",
"-C", "link-arg=-Tdefmt.x"
]
linker = "gcc"
runner = "./runner.sh"
[target.x86_64-unknown-linux-musl]
rustflags = [
"-C", "relocation-model=static",
"-C", "link-arg=-T/usr/lib/x86_64-linux-gnu/ldscripts/elf_x86_64.x",
"-C", "link-arg=-Tdefmt.x"
]
runner = "./runner.sh"
[env]
DEFMT_LOG = "trace"
runner.sh
#!/bin/sh
$@ | defmt-print -e $1
chmod +x runner.sh
This way cargo run will be automatically piped into defmt-print
main.rs
use defmt_stdout as _;
References
See the discussion here and here and the defmt-serial project
Dependencies
~0.4–0.9MB
~19K SLoC