The newlib has a nano version which is optimized for small embedded processor. To activate newlib-nano, add the option
-specs=nano.specs
to the linker. The newlib-nano printf does not print floating number format.Another linker option
--gc-sections
removes unused sections. To facilitate gc-section, compile each function and data item into its own section by passing `-ffunction-sections
' and -fdata-sections
. The optimizer can be specified to generate smaller code with the
-Os
option.Keil ARM compiler consistently produces much smaller code, often 50% smaller. Especially the math library is not only much smaller but also much high performance.