5 thoughts on “Reducing code size on Arduino Ethernet boards”

This has helpfull. It reduced about 3Ks on my compile. Any idea if killing DHCP would reduce the compilation output. I was hoping to maintain DNS to be able to connect to a dymanic ip – based website, but use a static address on the arduino since it’s less problematic.

With the ethernet library and my library, I was 100 bytes over the limit. Without DNS I have 3K free.

You can save a lot if you are currently using it (e.g., using the one argument Ethernet.begin), but very little if you aren’t already using it, as the linker is doing a good job of stripping the dead code.

As a quick test, I wrapped the one-arg begin and all of DHCP.cpp / DHCP.h with a define in an existing project:
– Using two arg begin (no DHCP but no mods): 15916 bytes
– Using two arg begin, with DHCP compiled out: 15892 bytes
– Using one arg begin (using DHCP lib): 18088 bytes