Add optimize flag in GNU Arm Embedded Toolchain common setting in building system to decrease binary size
Open, Needs TriagePublic


According to the feedback from partners, the binary generated with GUMARM option is too large to fit in a vendor platform.
To fix the oversize issue, add the optimize flag -ffunction-sections and -fdata-sections into compiling flags and add flag -Wl,--gc-sections into linker flags. The binary size can be decreased to fit in the platform after the optimization.

It is a common challenge to control the binary size on resource limited IoT products.
Therefore, it can be necessary to add the optimize flags -function-sections, -fdata-sections and --gc-sections, into GNUARM settings in TF-M building system as a common and default configuration.

[1] -ffunction-sections
[2] -fdata-sections``
[3] --gc-sections