Build: Fix arm/mps3/corstone310_fvp build with cmake 3.16.3
ARMClang.cmake in cmake 3.16 only checks CMAKE_SYSTEM_PROCESSOR variable.
In this case if only ARCH is defined in the build, cmake will throw
an error. But, GCC doesn't support the cortex-m85 processor yet. So we
define the cpu type, and check it in the toolchain_GNUARM.cmake file.
Signed-off-by: Dávid Házi <david.hazi@arm.com>
Change-Id: I12e9f9c0085a0fe1c5bd9900df9e4e923ec0629b
diff --git a/toolchain_GNUARM.cmake b/toolchain_GNUARM.cmake
index ee31875..e47668e 100644
--- a/toolchain_GNUARM.cmake
+++ b/toolchain_GNUARM.cmake
@@ -75,18 +75,24 @@
macro(tfm_toolchain_set_processor_arch)
if (DEFINED TFM_SYSTEM_PROCESSOR)
- set(CMAKE_SYSTEM_PROCESSOR ${TFM_SYSTEM_PROCESSOR})
+ if(TFM_SYSTEM_PROCESSOR MATCHES "cortex-m85")
+ # GNUARM does not support the -mcpu=cortex-m85 flag yet
+ # TODO: Remove this exception when the cortex-m85 support comes out.
+ message(WARNING "Cortex-m85 is not supported by GCC. Falling back to -march usage.")
+ else()
+ set(CMAKE_SYSTEM_PROCESSOR ${TFM_SYSTEM_PROCESSOR})
- if (DEFINED TFM_SYSTEM_DSP)
- if (NOT TFM_SYSTEM_DSP)
- string(APPEND CMAKE_SYSTEM_PROCESSOR "+nodsp")
+ if (DEFINED TFM_SYSTEM_DSP)
+ if (NOT TFM_SYSTEM_DSP)
+ string(APPEND CMAKE_SYSTEM_PROCESSOR "+nodsp")
+ endif()
endif()
- endif()
- if(GCC_VERSION VERSION_GREATER_EQUAL "8.0.0")
- if (DEFINED CONFIG_TFM_FP)
- if(CONFIG_TFM_FP STREQUAL "0" AND
- NOT TFM_SYSTEM_ARCHITECTURE STREQUAL "armv6-m")
- string(APPEND CMAKE_SYSTEM_PROCESSOR "+nofp")
+ if(GCC_VERSION VERSION_GREATER_EQUAL "8.0.0")
+ if (DEFINED CONFIG_TFM_FP)
+ if(CONFIG_TFM_FP STREQUAL "0" AND
+ NOT TFM_SYSTEM_ARCHITECTURE STREQUAL "armv6-m")
+ string(APPEND CMAKE_SYSTEM_PROCESSOR "+nofp")
+ endif()
endif()
endif()
endif()
@@ -140,7 +146,7 @@
unset(CMAKE_C_FLAGS_INIT)
unset(CMAKE_ASM_FLAGS_INIT)
- if (DEFINED TFM_SYSTEM_PROCESSOR)
+ if (CMAKE_SYSTEM_PROCESSOR)
set(CMAKE_C_FLAGS_INIT "-mcpu=${CMAKE_SYSTEM_PROCESSOR}")
set(CMAKE_ASM_FLAGS_INIT "-mcpu=${CMAKE_SYSTEM_PROCESSOR}")
set(CMAKE_C_LINK_FLAGS "-mcpu=${CMAKE_SYSTEM_PROCESSOR}")