Web Banner

Project - Compiler String Issue

I am new to the Arduino development environment and so I was playing. I was trying to create an abstraction function for my debug statements, this is normally my first task when using a new development platform. I like to have a single location to process all my debug commands. This allows me to redirect the information to a LED screen, a file or wherever I want.

By creating the abstraction layer, I can also easily comment out the code to cause the compiler to remove all of the debug from the binary.

When I did this, I found a problem...

The Arduino compiler still included all of the debug string into the binary, even when they were not being used.

If the changed the variables from 'String' to 'char[]' the compiler DID remove all of the debug from the binary.

I just wanted to point this out as space can be limited in these microcontrollers and if you are not careful, you might be losing valuable space.