(C++) How do I reduce binary size?

Big thank you to @antisvin for his advice the the other thread:

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.

This reduced my binary size by almost 10%.

1 Like