Build: Change default build option to MinSizeRel

* By default CMake's Release option builds with -O3,
  which isn't efficient for Cortex-M devices,
  where we wanted the lowest ROM/RAM usage.
* If TFM_SYSTEM_PROCESSOR is defined, then build and link
  with this cpu instead of arch with both
  armclang and gcc

Signed-off-by: Dávid Házi <david.hazi@arm.com>
Change-Id: I7550ab435fcf6bb595dcc153665009e47163214b
diff --git a/toolchain_GNUARM.cmake b/toolchain_GNUARM.cmake
index 320ede1..f9c620a 100644
--- a/toolchain_GNUARM.cmake
+++ b/toolchain_GNUARM.cmake
@@ -171,6 +171,11 @@
 
     # For GNU Arm Embedded Toolchain doesn't emit __ARM_ARCH_8_1M_MAIN__, adding this macro manually.
     add_compile_definitions($<$<STREQUAL:${TFM_SYSTEM_ARCHITECTURE},armv8.1-m.main>:__ARM_ARCH_8_1M_MAIN__>)
+
+    # CMAKE_BUILD_TYPE=MinSizeRel default parameter is -Os.
+    # In ARMCLANG we redefined this variable to use -Oz level, but GCC still using -Os!
+    # GCC 11 not supports -Oz level, version 12 will.
+    # When this option will be available in GNUARM, set -Oz flag for both toolchains.
 endmacro()
 
 # Configure environment for the compiler setup run by cmake at the first