SPM: Add FPU support for gnu arm embedded toolchain
1. Enable FP support in SPE by CONFIG_TFM_SPE_FP (0:software, 1:hybird,
2:hardware) for IPC model.
It doesn't support LIBRARY model.
2. Enable lazy stacking from SPE by CONFIG_TFM_LAZY_STACKING_SPE (OFF,
ON).
3. Separate qcbor, t_cose for SPE and NSPE.
Note:
NSPE is not allowed to use FPU at current stage when FPU is enabled
for SPE.
Change-Id: I856fdcccbbc403c5ec3689d95df4d082f106ff47
Signed-off-by: Feder Liang <Feder.Liang@arm.com>
diff --git a/toolchain_GNUARM.cmake b/toolchain_GNUARM.cmake
index 760a098..2ed640b 100644
--- a/toolchain_GNUARM.cmake
+++ b/toolchain_GNUARM.cmake
@@ -1,5 +1,5 @@
#-------------------------------------------------------------------------------
-# Copyright (c) 2020, Arm Limited. All rights reserved.
+# Copyright (c) 2020-2021, Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -49,7 +49,6 @@
-nostdlib
-std=c99
$<$<BOOL:${TFM_DEBUG_SYMBOLS}>:-g>
- $<$<NOT:$<BOOL:${TFM_SYSTEM_FP}>>:-msoft-float>
)
endmacro()
@@ -76,6 +75,13 @@
string(APPEND CMAKE_SYSTEM_PROCESSOR "+nodsp")
endif()
endif()
+ if(GCC_VERSION VERSION_GREATER_EQUAL "8.0.0")
+ if (DEFINED CONFIG_TFM_SPE_FP)
+ if(CONFIG_TFM_SPE_FP STREQUAL "0")
+ string(APPEND CMAKE_SYSTEM_PROCESSOR "+nofp")
+ endif()
+ endif()
+ endif()
endif()
# CMAKE_SYSTEM_ARCH variable is not a built-in CMAKE variable. It is used to
@@ -95,6 +101,14 @@
endif()
endif()
endif()
+
+ if(GCC_VERSION VERSION_GREATER_EQUAL "8.0.0")
+ if (DEFINED CONFIG_TFM_SPE_FP)
+ if(CONFIG_TFM_SPE_FP STRGREATER 0)
+ string(APPEND CMAKE_SYSTEM_ARCH "+fp")
+ endif()
+ endif()
+ endif()
endmacro()
macro(tfm_toolchain_reload_compiler)
@@ -125,6 +139,19 @@
set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS_INIT})
set(CMAKE_ASM_FLAGS ${CMAKE_ASM_FLAGS_INIT})
+
+ set(BL2_COMPILER_CP_FLAG -mfloat-abi=soft)
+
+ if (CONFIG_TFM_SPE_FP STREQUAL "2")
+ set(COMPILER_CP_FLAG -mfloat-abi=hard -mfpu=${CONFIG_TFM_FP_ARCH})
+ set(LINKER_CP_OPTION -mfloat-abi=hard -mfpu=${CONFIG_TFM_FP_ARCH})
+ elseif (CONFIG_TFM_SPE_FP STREQUAL "1")
+ set(COMPILER_CP_FLAG -mfloat-abi=softfp -mfpu=${CONFIG_TFM_FP_ARCH})
+ set(LINKER_CP_OPTION -mfloat-abi=softfp -mfpu=${CONFIG_TFM_FP_ARCH})
+ else()
+ set(COMPILER_CP_FLAG -mfloat-abi=soft)
+ set(LINKER_CP_OPTION -mfloat-abi=soft)
+ endif()
endmacro()
# Configure environment for the compiler setup run by cmake at the first