Why this small code doesn't fit in flash? (STM32)

Hmm two thoughts:

  1. Are you linking against nanolibc by passing --specs=nano.specs as linker flags in your extra_script.py? Otherwise you’re getting a really big C library.
  2. Do you overwrite functions like __cxa_pure_virtual so that their default code might not want to generate huge code and things like backtrace unwinding?