aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Hu <david.hu@arm.com>2020-01-10 17:16:26 +0800
committerDavid Hu <david.hu@arm.com>2020-01-13 09:47:54 +0800
commit7ffe5b49c5694dea47a545f62442fd6076d26c53 (patch)
treedd3ba7be1cd9fe2d2adfba40f36a4e62188deea8
parent47ecbf04561876f4ae94705c086519654be07422 (diff)
downloadtrusted-firmware-m-7ffe5b49c5694dea47a545f62442fd6076d26c53.tar.gz
Build: Fix arch type of Cortex-M0plus in GNUARM
The arch type of Cortex-M0plus should be "armv6s-m" instead of "armv6-m" in GNU Arm embedded toolchain. Otherwise, compiling will fail because "armv6-m" type doesn't support SVC. Fix the arch type values in GNUARM cmake files. Add an arch type string "ARMv6S-M" for Cortex-M0plus in GNUARM. Because Armclang doesn't have a dedicated flag as "armv6s-m", two strings "ARMv6-M" and "ARMv6S-M" exist and stand for Cortex-M0plus arch type in Armclang and GNUARM respectively. Change-Id: I59e9b9837012fb8dbbae59beacfd6cb293548747 Signed-off-by: David Hu <david.hu@arm.com>
-rw-r--r--BuildMbedCrypto.cmake5
-rw-r--r--cmake/Common/CompilerGNUARM63.cmake14
-rw-r--r--cmake/Common/CompilerGNUARM73.cmake14
-rw-r--r--cmake/Common/CompilerGNUARM83.cmake14
-rw-r--r--secure_fw/core/arch/CMakeLists.inc5
5 files changed, 27 insertions, 25 deletions
diff --git a/BuildMbedCrypto.cmake b/BuildMbedCrypto.cmake
index 3f573c9dd..fb51c9851 100644
--- a/BuildMbedCrypto.cmake
+++ b/BuildMbedCrypto.cmake
@@ -1,5 +1,5 @@
#-------------------------------------------------------------------------------
-# Copyright (c) 2017-2019, Arm Limited. All rights reserved.
+# Copyright (c) 2017-2020, Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -61,7 +61,8 @@ string(APPEND MBEDCRYPTO_C_FLAGS ${CMAKE_C_FLAGS})
# Workaround Mbed TLS issue https://github.com/ARMmbed/mbedtls/issues/1077
if ((${ARM_CPU_ARCHITECTURE} STREQUAL "ARMv8-M.BASE") OR
- (${ARM_CPU_ARCHITECTURE} STREQUAL "ARMv6-M"))
+ (${ARM_CPU_ARCHITECTURE} STREQUAL "ARMv6-M") OR
+ (${ARM_CPU_ARCHITECTURE} STREQUAL "ARMv6S-M"))
string(APPEND MBEDCRYPTO_C_FLAGS " -DMULADDC_CANNOT_USE_R7")
endif()
diff --git a/cmake/Common/CompilerGNUARM63.cmake b/cmake/Common/CompilerGNUARM63.cmake
index 2d3d05193..affeabb58 100644
--- a/cmake/Common/CompilerGNUARM63.cmake
+++ b/cmake/Common/CompilerGNUARM63.cmake
@@ -1,5 +1,5 @@
#-------------------------------------------------------------------------------
-# Copyright (c) 2017-2019, Arm Limited. All rights reserved.
+# Copyright (c) 2017-2020, Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -30,11 +30,11 @@ elseif(${ARM_CPU_ARCHITECTURE} STREQUAL "ARMv7-M")
string_append_unique_item(STRING CMAKE_CXX_FLAGS_CPU KEY "-march=" VAL "-march=armv7-m")
string_append_unique_item(STRING CMAKE_ASM_FLAGS_CPU KEY "-march=" VAL "-march=armv7-m")
string_append_unique_item(STRING CMAKE_LINK_FLAGS_CPU KEY "-march=" VAL "-march=armv7-m")
-elseif(${ARM_CPU_ARCHITECTURE} STREQUAL "ARMv6-M")
- string_append_unique_item(STRING CMAKE_C_FLAGS_CPU KEY "-march=" VAL "-march=armv6-m")
- string_append_unique_item(STRING CMAKE_CXX_FLAGS_CPU KEY "-march=" VAL "-march=armv6-m")
- string_append_unique_item(STRING CMAKE_ASM_FLAGS_CPU KEY "-march=" VAL "-march=armv6-m")
- string_append_unique_item(STRING CMAKE_LINK_FLAGS_CPU KEY "-march=" VAL "-march=armv6-m")
+elseif(${ARM_CPU_ARCHITECTURE} STREQUAL "ARMv6S-M")
+ string_append_unique_item(STRING CMAKE_C_FLAGS_CPU KEY "-march=" VAL "-march=armv6s-m")
+ string_append_unique_item(STRING CMAKE_CXX_FLAGS_CPU KEY "-march=" VAL "-march=armv6s-m")
+ string_append_unique_item(STRING CMAKE_ASM_FLAGS_CPU KEY "-march=" VAL "-march=armv6s-m")
+ string_append_unique_item(STRING CMAKE_LINK_FLAGS_CPU KEY "-march=" VAL "-march=armv6s-m")
else()
message(FATAL_ERROR "Unknown or unsupported ARM cpu architecture setting.")
endif()
@@ -69,7 +69,7 @@ if(NOT DEFINED ARM_CPU_ARCHITECTURE)
string_append_unique_item(STRING CMAKE_CXX_FLAGS_CPU KEY "-mcpu=" VAL "-mcpu=cortex-m0plus")
string_append_unique_item(STRING CMAKE_ASM_FLAGS_CPU KEY "-mcpu=" VAL "-mcpu=Cortex-M0plus")
string_append_unique_item(STRING CMAKE_LINK_FLAGS_CPU KEY "-mcpu=" VAL "-mcpu=Cortex-M0plus")
- set(ARM_CPU_ARCHITECTURE "ARMv6-M")
+ set(ARM_CPU_ARCHITECTURE "ARMv6S-M")
else()
message(FATAL_ERROR "Unknown ARM cpu setting.")
endif()
diff --git a/cmake/Common/CompilerGNUARM73.cmake b/cmake/Common/CompilerGNUARM73.cmake
index 861e32928..37b94ae33 100644
--- a/cmake/Common/CompilerGNUARM73.cmake
+++ b/cmake/Common/CompilerGNUARM73.cmake
@@ -1,5 +1,5 @@
#-------------------------------------------------------------------------------
-# Copyright (c) 2018-2019, Arm Limited. All rights reserved.
+# Copyright (c) 2018-2020, Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -30,11 +30,11 @@ elseif(${ARM_CPU_ARCHITECTURE} STREQUAL "ARMv7-M")
string_append_unique_item(STRING CMAKE_CXX_FLAGS_CPU KEY "-march=" VAL "-march=armv7-m")
string_append_unique_item(STRING CMAKE_ASM_FLAGS_CPU KEY "-march=" VAL "-march=armv7-m")
string_append_unique_item(STRING CMAKE_LINK_FLAGS_CPU KEY "-march=" VAL "-march=armv7-m")
-elseif(${ARM_CPU_ARCHITECTURE} STREQUAL "ARMv6-M")
- string_append_unique_item(STRING CMAKE_C_FLAGS_CPU KEY "-march=" VAL "-march=armv6-m")
- string_append_unique_item(STRING CMAKE_CXX_FLAGS_CPU KEY "-march=" VAL "-march=armv6-m")
- string_append_unique_item(STRING CMAKE_ASM_FLAGS_CPU KEY "-march=" VAL "-march=armv6-m")
- string_append_unique_item(STRING CMAKE_LINK_FLAGS_CPU KEY "-march=" VAL "-march=armv6-m")
+elseif(${ARM_CPU_ARCHITECTURE} STREQUAL "ARMv6S-M")
+ string_append_unique_item(STRING CMAKE_C_FLAGS_CPU KEY "-march=" VAL "-march=armv6s-m")
+ string_append_unique_item(STRING CMAKE_CXX_FLAGS_CPU KEY "-march=" VAL "-march=armv6s-m")
+ string_append_unique_item(STRING CMAKE_ASM_FLAGS_CPU KEY "-march=" VAL "-march=armv6s-m")
+ string_append_unique_item(STRING CMAKE_LINK_FLAGS_CPU KEY "-march=" VAL "-march=armv6s-m")
else()
message(FATAL_ERROR "Unknown or unsupported ARM cpu architecture setting.")
endif()
@@ -69,7 +69,7 @@ if(NOT DEFINED ARM_CPU_ARCHITECTURE)
string_append_unique_item(STRING CMAKE_CXX_FLAGS_CPU KEY "-mcpu=" VAL "-mcpu=cortex-m0plus")
string_append_unique_item(STRING CMAKE_ASM_FLAGS_CPU KEY "-mcpu=" VAL "-mcpu=Cortex-M0plus")
string_append_unique_item(STRING CMAKE_LINK_FLAGS_CPU KEY "-mcpu=" VAL "-mcpu=Cortex-M0plus")
- set(ARM_CPU_ARCHITECTURE "ARMv6-M")
+ set(ARM_CPU_ARCHITECTURE "ARMv6S-M")
else()
message(FATAL_ERROR "Unknown ARM cpu setting.")
endif()
diff --git a/cmake/Common/CompilerGNUARM83.cmake b/cmake/Common/CompilerGNUARM83.cmake
index 2b973e525..57007a4f4 100644
--- a/cmake/Common/CompilerGNUARM83.cmake
+++ b/cmake/Common/CompilerGNUARM83.cmake
@@ -1,5 +1,5 @@
#-------------------------------------------------------------------------------
-# Copyright (c) 2019, Arm Limited. All rights reserved.
+# Copyright (c) 2019-2020, Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -30,11 +30,11 @@ elseif(${ARM_CPU_ARCHITECTURE} STREQUAL "ARMv7-M")
string_append_unique_item(STRING CMAKE_CXX_FLAGS_CPU KEY "-march=" VAL "-march=armv7-m")
string_append_unique_item(STRING CMAKE_ASM_FLAGS_CPU KEY "-march=" VAL "-march=armv7-m")
string_append_unique_item(STRING CMAKE_LINK_FLAGS_CPU KEY "-march=" VAL "-march=armv7-m")
-elseif(${ARM_CPU_ARCHITECTURE} STREQUAL "ARMv6-M")
- string_append_unique_item(STRING CMAKE_C_FLAGS_CPU KEY "-march=" VAL "-march=armv6-m")
- string_append_unique_item(STRING CMAKE_CXX_FLAGS_CPU KEY "-march=" VAL "-march=armv6-m")
- string_append_unique_item(STRING CMAKE_ASM_FLAGS_CPU KEY "-march=" VAL "-march=armv6-m")
- string_append_unique_item(STRING CMAKE_LINK_FLAGS_CPU KEY "-march=" VAL "-march=armv6-m")
+elseif(${ARM_CPU_ARCHITECTURE} STREQUAL "ARMv6S-M")
+ string_append_unique_item(STRING CMAKE_C_FLAGS_CPU KEY "-march=" VAL "-march=armv6s-m")
+ string_append_unique_item(STRING CMAKE_CXX_FLAGS_CPU KEY "-march=" VAL "-march=armv6s-m")
+ string_append_unique_item(STRING CMAKE_ASM_FLAGS_CPU KEY "-march=" VAL "-march=armv6s-m")
+ string_append_unique_item(STRING CMAKE_LINK_FLAGS_CPU KEY "-march=" VAL "-march=armv6s-m")
else()
message(FATAL_ERROR "Unknown or unsupported ARM cpu architecture setting.")
endif()
@@ -69,7 +69,7 @@ if(NOT DEFINED ARM_CPU_ARCHITECTURE)
string_append_unique_item(STRING CMAKE_CXX_FLAGS_CPU KEY "-mcpu=" VAL "-mcpu=cortex-m0plus")
string_append_unique_item(STRING CMAKE_ASM_FLAGS_CPU KEY "-mcpu=" VAL "-mcpu=Cortex-m0plus")
string_append_unique_item(STRING CMAKE_LINK_FLAGS_CPU KEY "-mcpu=" VAL "-mcpu=Cortex-m0plus")
- set(ARM_CPU_ARCHITECTURE "ARMv6-M")
+ set(ARM_CPU_ARCHITECTURE "ARMv6S-M")
else()
message(FATAL_ERROR "Unknown ARM cpu setting.")
endif()
diff --git a/secure_fw/core/arch/CMakeLists.inc b/secure_fw/core/arch/CMakeLists.inc
index d7c540b00..98a8bb147 100644
--- a/secure_fw/core/arch/CMakeLists.inc
+++ b/secure_fw/core/arch/CMakeLists.inc
@@ -1,5 +1,5 @@
#-------------------------------------------------------------------------------
-# Copyright (c) 2019, Arm Limited. All rights reserved.
+# Copyright (c) 2019-2020, Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -35,7 +35,8 @@ elseif (${ARM_CPU_ARCHITECTURE} STREQUAL "ARMv8-M.MAIN")
elseif (${ARM_CPU_ARCHITECTURE} STREQUAL "ARMv8-M.BASE")
set(TFM_ARCH_C_SRC "${TFM_ARCH_DIR}/tfm_arch_v8m_base.c")
elseif (${ARM_CPU_ARCHITECTURE} STREQUAL "ARMv7-M" OR
- ${ARM_CPU_ARCHITECTURE} STREQUAL "ARMv6-M")
+ ${ARM_CPU_ARCHITECTURE} STREQUAL "ARMv6-M" OR
+ ${ARM_CPU_ARCHITECTURE} STREQUAL "ARMv6S-M")
if (NOT DEFINED TFM_MULTI_CORE_TOPOLOGY OR NOT TFM_MULTI_CORE_TOPOLOGY)
message(FATAL_ERROR "Armv6-M/Armv7-M can only support multi-core TF-M.")
endif()