Hi Tim and thank you for your kind answer.
Just checked adding an array not used and seen the sketch size does not increase. So as you said the linker is not including that in the final binary.
This means that the memory usage issue is not influenced by those variables/arrays.
Looking at this from the code clean-up point of view instead, i would still like to be able to get rid of unused things in the source.
I initially tried to add
promicro8.build.extra_flags=-Wunused
to the boards,txt file but i've seen that:
1) it seems it is not used when building (even after reloading the toolchain or re-opening the IDE)
2) it is not actually needed because i've seen -Wall is used when I enabled the verbose output from VisualMicro
3) unused variables and functions are listed by the compiler, but ONLY if they are marked as static
IMHO the point now is that having no statics but lots of variables and functions defined that probably are not used, I cannot list them in an automated way to do my cleanup.
CppCheck is a static analysis tool and actually considers those cases in a slightly different way, listing also the non-static unused vars/funcs.
As you mentioned, I've found a plugin to use CppCheck from the VS IDE and will try it in the next days.
I think that a nice addition to Visual Micro features could be a tool to aid with such kind of code clean-up and squeezing.
Just 2 examples:
a) CppCheck listed as "unused" a function that I wrote but then forgot to use in a couple of code lines after copy/pasting from others that were using a different one. This could have been a bug to search during run time... Being not a static... the compiler did not warn about this
b) I'm using six libraries and many functions from them are contributing to the final binary size. It could be very helpful to have some sort of code map showing the size in bytes for each function/routine/code section that has been included by the linker in the final binary to understand where I actually need to shorten things a bit...
Please let me know your opinion on this.
Bye,
Mario