C++ Exceptions Reduce Firmware Code Size
summary
Claim: using C++ exceptions can produce smaller and faster firmware than pervasive result types. Rebuilds the ARM GNU Toolchain for Cortex M4, implements a bare‑metal exception runtime (overrides terminate, supplies cxa_allocate_exception, tweaks RTTI), and measures binaries: initial throw adds ~150 KB, removing iostream/terminate cuts it to ~13 KB (≈91% reduction). Finds libunwind ≈8 KB and a crossover near ~580 checked calls where exceptions beat std::expected, and reports faster throw/unwind than stock libunwind.
AI-written summary · about
chapters (6)
- 0:00Introduction
- 13:41Avoiding exceptions in embedded
- 21:10Migrating to exceptions
- 35:57How exceptions work
- 57:01Exception metadata and size
- 1:19:59Performance and optimizations
related talks
52mC++ for Embedded Development
01mC++ On Sea 2024 Preview: How to keep your binaries small?
01h 00mDealing with Embedded Limitations
54mCost of Abstractions in Embedded Systems
01h 09m“Modern C++ in Embedded Systems - The Saga Continues”
05mModern C++ in Embedded OS Dev
31mReally Small Rust
01h 18mWriting better embedded Software
