Two Memory Budgets That Must Both Close

Ada re-derives this chapter’s own numbers step by step, at full precision

foundations
math-foundations
calculation-audit
edge-fog
Ada ADA · CALCULATION AUDIT

Two Memory Budgets That Must Both Close

The chapter runs a microcontroller budget of 256 KB flash and 64 KB SRAM, packing 60,000 INT8 weights and other segments into 238 KB of flash, 18 KB to spare, and 38 KB of SRAM. A wrong sum here is a device that silently fails to boot. This audit adds every line itself, because flash and SRAM are two memory budgets that must both close independently.

Companion to the chapter TinyML on Microcontrollers — every number here comes from that chapter.

Ada: This chapter runs a 256 KB-flash, 64 KB-SRAM board budget and a separate gesture-classifier SRAM budget, then insists both keep headroom. Because a wrong sum here is a device that silently fails to boot, let me add every line myself.

  • Weight footprint. An INT8 weight is one byte, so 60,000 weights = 60,000 bytes, which the chapter rounds to 60 KB (or 60,000 / 1024 = 58.59 KB if a KB is 1024 bytes). The same rule gives the later 80,000 weights = 80 KB.
  • Flash gate. 60 + 92 + 74 + 12 = 238 KB used; headroom 256 - 238 = 18 KB.
  • SRAM gate. 18 + 8 + 12 = 38 KB used; headroom 64 - 38 = 26 KB.
  • Gesture example. Its SRAM adds 58 + 16 + 52 = 126 KB, which fits a 256 KB device with 256 - 126 = 130 KB left before logging, radio buffers, and safety headroom are counted.

Both budgets close, but flash and SRAM are independent release gates. Quantizing or pruning shrinks the 238 KB flash side while leaving the 38 KB tensor-arena side untouched, and doubling the feature buffer changes SRAM even though the model file never moves — so any buffer or input-shape change forces a fresh fit check, not a re-use of this one.

Every number above is taken from the chapter’s own material and re-derived step by step.