Hi Noam,
please try to do Optimization separately for your project and libraries.
You can look here, http://cache.nxp.com/files/microcontrollers/doc/user_guide/KDSUG.pdf page 44
Specify the optimizations that you want the compiler to apply to the generated object code:
• None (-O0) - Disable optimizations. This setting is equivalent to specifying the -
O0 command-line option. The compiler generates unoptimized, linear assembly-
language code.
• Optimize (-O1) - The compiler performs all target-independent (that is, non-
parallelized) optimizations, such as function inlining. This setting is equivalent to
specifying the -O1 command-line option. The compiler omits all target-specific
optimizations and generates linear assembly-language code.
• Optimize more (-O2) - The compiler performs all optimizations (both
targetindependent and target-specific). This setting is equivalent to specifying
the -O2 command-line option. The compiler outputs optimized, non-linear,
parallelized assembly-language code.
• Optimize most (-O3) - The compiler performs all the level 2 optimizations, then
the low-level optimizer performs global-algorithm register allocation. This setting
is equivalent to specifying the that is usually faster than the code generated from
level 2 optimizations.
• Optimize size (-Os) - The compiler optimizes object code at the specified
Optimization Level such that the resulting binary file has a smaller executable
code size, as opposed to a faster execution speed. This setting is equivalent to
specifying the -Os command-line option.
• Optimize for debugging (-Og) - The compiler optimizes object code at the
specified Optimization Level such that the resulting binary file has a faster
execution speed, as opposed to a smaller executable code size.

After doing that you can print size of the project


In my case - I did Optimization for the KSDK demo without optimization None (-O0),
before optimization there was result

and after setting optimization for all libraries (building as well) and project with option Optimize size (-Os)
there was this result

Be careful and consistently test the functionality of your code