F0093 stk-3¶
Rule: The stack sits below .data and .bss and is not empty.
| Code | F0093 (stable, never reused) |
| Id | stk-3 |
| Category | stk |
| 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 | deny |
bedrock error: Stack not below .data / .bss in the ELF (_stack_start != start of .data), or a zero-size stack |
| ui | off | |
| egui | off | |
| units-strict | off | |
| units-paranoid | off |
Why¶
In the linked ELF, _stack_start not equal to the start of .data (flip-link's whole point is to place the stack immediately below it), or a stack region that links to zero bytes.
This is stk-1's outcome check: flip-link being configured doesn't guarantee it actually placed the stack correctly for this particular memory layout — a zero-size stack region or a stray symbol between stack and .data defeats the guard just as completely as not using flip-link at all.
Example¶
Embedded_bedrock ROB-12, and a flip-link 0.1.12 bug where an empty .sram8 section at the very end of RAM was counted as used space, leaving no room for the stack at all.
How to fix¶
If the addresses don't line up, the memory.x region layout has an extra symbol or a non-empty tail between stack and .data (mem-2); fix the layout, not the linker flag.
How it is checked¶
elf easy: read _stack_start and the start address of .data directly from the linked ELF's symbol table and compare; check the stack region's computed size is non-zero.
Source¶
Ported from embedded_bedrock's firmware check catalogue, STK-3 (book/checks.md, detail in book/checks/stk.md). Found on: embedded_bedrock ROB-12; flip-link 0.1.12 empty .sram8.
Configure¶
Allow one finding in the code with // spirit-level: allow(stk-3) <reason> (waivers); the code works there too, as in [lints.F0093].