You can add OPT = -Os
to your Makefile anywhere above the include $(SYSTEM_FILES_DIR)/Makefile
line to compile with optimization targeted to reduce code size. Sometimes that may break things, but looks like your patch builds and runs fine and you get ~15kb free.
Previously (with -O2
):
Memory region Used Size Region Size %age Used
FLASH: 130520 B 128 KB 99.58%
with -Os
:
Memory region Used Size Region Size %age Used
FLASH: 118776 B 128 KB 90.62%