I experienced some interesting things today. I wanted to do some kind of unit test outside of the Arduino IDE environment. Wrote a little arduino mock and put my implementations into header and cpp files. Did some #ifnef procedure to include Arduino if I compile in Arduino IDE and the other in g++.
In quant.cpp:
#include "quant.h"
#ifdef MOCK_ARDUINO
#include "arduinomock.h"
#else
#include "Arduino.h"
#endif
In .ino file:
#include "quant.h"'
After some makefile fixing so g++ worked it was time to compile in Arduino IDE (verify):
Sketch uses 2306 bytes (8%) of program storage space. Maximum is 28672 bytes.
Global variables use 163 bytes (6%) of dynamic memory, leaving 2397 bytes for local variables. Maximum is 2560 bytes.
I went back to my old solution with all in one .ino file and Compiled:
Sketch uses 7324 bytes (25%) of program storage space. Maximum is 28672 bytes.
Global variables use 414 bytes (16%) of dynamic memory, leaving 2146 bytes for local variables. Maximum is 2560 bytes.
As you can see the memory consumption from the Sketch has dropped significantly.
Is this just a measurement in Arduino IDE JUST for the Sketch, Arduino IDE ignores cpp and header files memory consumption?
OR
Is this a result of needing to remove magic things done by Arduino IDE? For instance I needed to define some stuff static when I used linker and other to make it compile under g++.