Skip to content

F0090 siz-6

Rule: No large .data initializer.

Code F0090 (stable, never reused)
Id siz-6
Category siz
Source spirit_level
Fix by hand
Needs the firmware's linked ELF (--elf); skipped without a firmware binary

Level per tier

Tier Level Reason
small off
small-workspace off
medium off
big off
ai off
embedded warn bedrock suggestion, reported without failing the run: Large .data initializer (a static with a non-zero const value): zero-init and set it up in place
ui off
egui off
units-strict off
units-paranoid off

Parameters

Name Type Default Meaning
data-init integer 1024 bytes of a .data initializer from which it is reported

Why

A static with a sizeable non-zero const initializer, which the linker places in .data — meaning its full initial contents are stored in flash and copied into RAM at startup, doubling its footprint instead of being zero-initialised and built up in place.

.data's initial image costs flash exactly as much as .bss would cost nothing; for anything large (a lookup table, an encoder's working buffer) that's flash spent on a value the code is about to overwrite or compute anyway.

Example

Typec_dongle FW-42: a 20 KiB encoder buffer with a non-zero initializer, found during a size pass.

How to fix

Zero-initialise the static (.bss) and fill it at startup in code instead of baking a large constant into the binary.

How it is checked

elf easy: a .data symbol over a size threshold whose initial bytes aren't all zero (which would have gone in .bss instead).

Source

Ported from embedded_bedrock's firmware check catalogue, SIZ-6 (book/checks.md, detail in book/checks/siz.md). Found on: typec_dongle FW-42 (20 KiB encoder).

Configure

[lints.siz-6]
level = "deny"
data-init = 1024
reason = "why this project wants it at this level"

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