How much code can be “stuffed” into an Arduino?

In a quest to see how much code can be “stuffed” into an Arduino the Autonomous robot project has grown to several thousand lines of code.

The compiled code is currently about 16kB when all of the debug functions are included. This is only about half of what an Arduino with an ATMEGA328 can handle. To give some meaning to this, here is the call graph I generated with Doxygen, a marvellous code documentation tool:

Autonomous robot Main loop - Doxygen call graph.

Autonomous robot Main loop – Doxygen call graph.

 

 

This actually only gives a very tiny view of Doxygen’s full capability. But the real Arduino memory size limitation is not usually the code size, but the variables used, and typically the strings. Posts on using Doxygen with Arduino code and tips and utilities to help Arduino memory management are “coming soon”.