cmake: Set optimization level to balance code size and debug experience
The code size of `aws-iot-example` is too large to fit into the
non-secure ROM when built with the GNU toolchain, when using the default
optimization level which is `-O0`. To solve this issue, use `-Og` for
the GNU toolchain and `-O1` for ARMClang which are their respective
recommended optimization levels for reducing code size while keeping a
decent debug experience.
Also remove the setting of `CMAKE_BUILD_TYPE`, because our toolchain
script `toolchains/Modules/Platform/Generic-cortex-m-common.cmake`
clears all compiler flags that are build type specific, meaning that
which profile we set does not matter.
Signed-off-by:
Lingkai Dong <lingkai.dong@arm.com>
Loading
Please register or sign in to comment