blob: 57969f67db2310777b6539ee6e1c8731f2e2303a [file] [log] [blame]
Feder Liang55194382021-11-22 16:45:33 +08001#-------------------------------------------------------------------------------
2# Copyright (c) 2022, Arm Limited. All rights reserved.
3#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6#-------------------------------------------------------------------------------
7
Gabor Toth4d414112021-11-10 17:44:50 +01008########################## FPU and MVE #########################################
9
10tfm_invalid_config(NOT CMAKE_C_COMPILER_ID STREQUAL "GNU" AND (CONFIG_TFM_ENABLE_FP OR CONFIG_TFM_ENABLE_MVE OR CONFIG_TFM_ENABLE_MVE_FP))
11tfm_invalid_config((NOT CONFIG_TFM_FP_ARCH) AND (CONFIG_TFM_ENABLE_FP OR CONFIG_TFM_ENABLE_MVE_FP))
12tfm_invalid_config((NOT TFM_PSA_API) AND (CONFIG_TFM_ENABLE_FP OR CONFIG_TFM_ENABLE_MVE OR CONFIG_TFM_ENABLE_MVE_FP))
13tfm_invalid_config((NOT CONFIG_TFM_ENABLE_FP AND NOT CONFIG_TFM_ENABLE_MVE AND NOT CONFIG_TFM_ENABLE_MVE_FP) AND CONFIG_TFM_LAZY_STACKING)
14tfm_invalid_config((CONFIG_TFM_ENABLE_FP OR CONFIG_TFM_ENABLE_MVE OR CONFIG_TFM_ENABLE_MVE_FP) AND NOT CONFIG_TFM_ENABLE_CP10CP11)
15
Feder Liang55194382021-11-22 16:45:33 +080016###################### Check compiler for FP vulnerability #####################
17
18# Check compiler with mitigation for the VLLDM instruction security vulnerability or not.
19# For more information, please check https://developer.arm.com/support/arm-security-updates/vlldm-instruction-security-vulnerability.
Gabor Toth4d414112021-11-10 17:44:50 +010020if (CONFIG_TFM_FLOAT_ABI STREQUAL "hard")
Feder Liang55194382021-11-22 16:45:33 +080021 # Create test C file.
22 file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/cvetest.c "int x;")
23 # Compile with mitigation -mfix-cmse-cve-2021-35465.
24 execute_process (
25 COMMAND ${CMAKE_C_COMPILER} -mfix-cmse-cve-2021-35465 -S ${CMAKE_CURRENT_BINARY_DIR}/cvetest.c -o ${CMAKE_CURRENT_BINARY_DIR}/cvetest.s
26 RESULT_VARIABLE ret
27 ERROR_VARIABLE err
28 )
29 file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/cvetest.c)
30 # Check result
31 if(NOT ret EQUAL 0)
32 message(FATAL_ERROR "To enable FPU usage in SPE and NSPE both, please use the compiler with '-mfix-cmse-cve-2021-35465' support")
33 else()
34 file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/cvetest.s)
35 endif()
36endif()