Skip to content

F0048 flt-1

Rule: The HardFault handler records the crash and resets instead of spinning.

Code F0048 (stable, never reused)
Id flt-1
Category flt
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: HardFault handler that spins (loop {}) in a shipped build: record (crash capture) and reset
ui off
egui off
units-strict off
units-paranoid off

Why

A HardFault handler whose body is (or reduces to) loop {}, in a build meant to ship.

A spinning fault handler turns every fault into a silent, permanent hang: no reset, no record, nothing visible on the outside except a device that stopped responding. The whole point of a fault is that it's information about a bug; spinning throws that information away and gives the user a brick instead of a reboot.

Example

Cortex-m-rt's template default is exactly this loop {}; embedded_bedrock ROB-2/ROB-11, usb_io_fw PLAT-7, and the Notion firmware checklist all call out replacing it before shipping.

How to fix

Record what's known about the fault (bedrock_crash, raw — flt-2) and reset; never leave the default spin in a shipped build.

How it is checked

src easy: the HardFault handler body must not be an empty or infinite loop with no exit.

Source

Ported from embedded_bedrock's firmware check catalogue, FLT-1 (book/checks.md, detail in book/checks/flt.md). Found on: embedded_bedrock ROB-2/ROB-11; usb_io_fw PLAT-7; notion.

Configure

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

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