I am running out of code and data memory space on ATMega328P.
Code size is big as I used several libraries, but, I only use a few functions of those library.
Apparently, the default IDE is only doing a partial job in dead code removal (remove unreferenced code and data).
Some experiments shows:
A normal program that uses several Arduino libraries is 22 kilo bytes in code size.
Rename setup to o_setup. Rename loop to o_loop
Code size is 8 kilo bytes while the program is 'empty' effectively.
Start a new program.
Code size is 0.5 kilo bytes
Apparently, the IDE (linker called by IDE) is doing a 'partial' dead code removal job, as reducing code from 22kB to 8kB (case 1 and 2), instead of 0.5kB (case 3).
How can I enable maximum dead code removal function (reclaim code space occupied by unused library functions)?