~/talk

C++ Exceptions for Smaller Firmware

Talkat CppCon 2024 · on Tuesday, 2024-09-17· at 10:30· Adams A, 6700 North Gaylord Rockies Boulevard· [rust]
links:none on file
slides:none on file

Steps to enable C++ exceptions on ARM, flip -fno-exceptions to -fexceptions and provide a low‑level allocator, then override __cxa_allocate_exception and the terminate hook. RTTI need not bloat everything; only thrown types stay in the binary. Replacing vendors’ allocators with a preallocated pool avoids heap growth. Measured results claim a jump from ~150 kB to ~13 kB after tweaks and an empirical crossover ≈550 checked calls where exceptions beat result-style checks. Built an Exception Insight tool to analyze binaries and simulate which throws reach main.

AI-written summary · about

  1. 0:00Introduction
  2. 1:11Embedded C++ constraints
  3. 3:39Misconceptions about exceptions
  4. 5:02Output pin errors
  5. 8:12I2C fallible interfaces
  6. 10:21std::expected for errors
  7. 12:26Student feedback on APIs
  8. 14:32Why students prefer exceptions
  9. 15:35Exceptions on ARM MCUs
  10. 16:59Binary size explosion
  11. 17:41Override terminate handler
  12. 19:27No dynamic allocation for exceptions
  13. 20:30Runtime type information and exceptions
  14. 23:00Size comparison exceptions vs results
  15. 26:28Cost analysis error handling
  16. 29:58How exceptions work
  17. 37:19Exception unwinding
  18. 44:01Language data area ABI
  19. 55:13Space cost analysis
  20. 1:00:31Cost vs return types
  21. 1:03:44Distributed vs centralized errors
  22. 1:08:44Exceptions for smaller binaries
  23. 1:10:52Exceptions as code compression
  24. 1:12:37Limitations and reliability
  25. 1:14:04Exception Insights tool
  26. 1:17:33Q&A
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.