Linking and optimization in the GNU toolchain
Writing small code is one thing, another step is linking the code into one program. The linking step is when is decided which code will be part of the program and what will be left out. In order to create a small executable program you need to know the limitations of your tool chain.
Let's have a look at a part of the .map file that is generated as a result of builting the LCD test program:
.text 0x400004b4 0x388 i2c.o
This shows that the file i2c.o is linked with all the functions that are in the file, even the i2cRead and i2cGetChar functions that are not used in the program are still linked as part of the process.