Page MenuHomePhabricator

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

Description

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.

Reference:
[1] [[ https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#index-ffunction-sections | -ffunction-sections ]]
[2] [[ https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#index-fdata-sections | -fdata-sections ]]``
[3] [[ https://sourceware.org/binutils/docs/ld/Options.html#Options | --gc-sections ]]

Event Timeline