Matthias Weingart wrote:
...
Of course, but beside of that it is a big optimisation of flash and ram
requirements when you do not use all functions in your code (usually normal
in development). With -ffunction-sections it drops unused flash-code out of
the linker file (which makes at least firmware programming faster); but the
(global) variables used by this functions are still linked and use RAM.
-fdata-sections would save RAM in this case (well a seldom case, but it
happend).
The alternative - working with #ifdef #endif clauses - is time consuming.
Why do this manually, when the compiler can do it automatically?
uhm, if you implement functions that you dont use, isnt a library what
you want?
you can create a library and the linker will only take the functions
that are used. see msp430-libc for hints how to build a library.
chris