why is the binary bigger when using makefile?

I just compiled a sketch on the commandline using the makefile located in arduino/hardware/cores/arduino. The binary that it uploaded was 9960 bytes.

I then compiled the exact same sketch in the arduino ide, and it is 9264 bytes.

Why is this? Shouldn't they be the same?

I'd like to move away from the arduino IDE, but I can't afford for the sketches to be larger.


Set the 'build.verbose' TRUE in the arduino preferences file, and see what settings it uses for optimization. Then compare with your build process.

Thanks for the tip. Most of the optimizations didn't make a difference, but one did. It actually compiled smaller (8550 bytes).

The one that helped was adding "-Wl,--gc-sections" to the elf link process. I'll post up a makefile after I've tested it a bit more.