F0064 irq-8¶
Rule: The default interrupt handler records which IRQ fired.
| Code | F0064 (stable, never reused) |
| Id | irq-8 |
| Category | irq |
| Source | spirit_level |
| Fix | by hand |
Level per tier¶
| Tier | Level | Reason |
|---|---|---|
| small | off | |
| small-workspace | off | |
| medium | off | |
| big | off | |
| ai | off | |
| embedded | warn |
bedrock warning: Unused interrupt vectors not caught: DefaultHandler must record the IRQ number (raw: a static, the crash record or a counter; not logging it, FLT-2) |
| ui | off | |
| egui | off | |
| units-strict | off | |
| units-paranoid | off |
Why¶
A DefaultHandler that doesn't record which IRQ number actually fired, or that tries to log from inside itself.
An interrupt landing on a vector nothing expects (a misconfigured peripheral, a stray enable left on, hardware the board doesn't have asserting a line) is exactly the kind of thing worth knowing about after the fact; a DefaultHandler that doesn't capture the IRQ number throws that information away, and one that logs risks nesting into whatever caused the stray interrupt in the first place (flt-2).
Example¶
Typec_dongle FW-48: a DefaultHandler that tried to log ran into the same nested-panic risk flt-2 exists for.
How to fix¶
Record the IRQ number raw (a cnt! counter indexed by vector, or a crash-record field); never format or log from inside it.
How it is checked¶
src easy: the DefaultHandler body must record the active IRQ number (e.g. into a counter or a crash record) and must not call anything that can panic, allocate, or log.
Source¶
Ported from embedded_bedrock's firmware check catalogue, IRQ-8 (book/checks.md, detail in book/checks/irq.md). Found on: notion; typec_dongle FW-48.
Configure¶
Allow one finding in the code with // spirit-level: allow(irq-8) <reason> (waivers); the code works there too, as in [lints.F0064].