Skip to content

F0069 mem-12

Rule: A firmware with defmt links with -Tdefmt.x.

Code F0069 (stable, never reused)
Id mem-12
Category mem
Source spirit_level
Fix by hand

Level per tier

Tier Level Reason
small off
small-workspace off
medium off
big off
ai off
embedded deny bedrock error: defmt in the dependencies without -Tdefmt.x (no .defmt section)
ui off
egui off
units-strict off
units-paranoid off

Why

defmt/defmt-rtt in the dependency tree without -Tdefmt.x passed to the linker, so no .defmt section is produced.

Without .defmt, the interned format strings defmt needs to decode RTT output at the host side don't exist in the image; probe-rs (or any defmt decoder) either refuses to attach meaningfully or shows nothing recognisable, and the failure looks like "logging isn't working" rather than "the linker argument is missing".

Example

Documented in book/issues.md as a recurring first-boot surprise on a freshly hand-edited .cargo/config.toml.

How to fix

Add -C link-arg=-Tdefmt.x to the target's rustflags in .cargo/config.toml; the generator always includes it when defmt is selected.

How it is checked

cfg easy (defmt present in Cargo.toml implies -Tdefmt.x must be in rustflags) plus elf easy (confirm .defmt actually exists in the linked output).

Source

Ported from embedded_bedrock's firmware check catalogue, MEM-12 (book/checks.md, detail in book/checks/mem.md). Found on: book/issues.md.

Configure

[lints.mem-12]
level = "deny"
reason = "why this project wants it at this level"

Allow one finding in the code with // spirit-level: allow(mem-12) <reason> (waivers); the code works there too, as in [lints.F0069].