File too large

Files must be under 50 MB.

FILE_TOO_LARGE

Symptoms

  • The upload is refused immediately with the file size shown next to the 50 MB limit.
  • The flashed image is a few hundred kilobytes, but the ELF is tens of megabytes.

Likely causes

  • DWARF debug sections dwarf the code itself — they describe every type, macro and inline frame, and are never written to flash.
  • -g3 was used, which adds full macro definitions on top of normal debug info.
  • C++ with heavy templates, or a vendor HAL and RTOS all compiled with debug info, multiply the type descriptions.

How to fix it

  1. Drop from -g3 to -g

    Macro debug info is what -g3 adds and it is usually the single largest contributor. Plain -g keeps line numbers, types and locals — everything MCUHex needs.

  2. See which sections are actually big

    Before changing more flags, confirm where the size lives. .debug_info and .debug_macro are the usual suspects.

    arm-none-eabi-size -A -x firmware.elf | sort -k2 -h | tail -10
  3. Compress the debug sections

    GNU ld can zlib-compress DWARF in place. The ELF stays valid and parseable while getting several times smaller.

    arm-none-eabi-gcc ... -Wl,--compress-debug-sections=zlib