making inherit compiler to inherit parent toolchain and compiler options, which can be used for host/cross compile purpose
diff --git a/api-tests/CMakeLists.txt b/api-tests/CMakeLists.txt
index af7dfb1..31b7ef7 100644
--- a/api-tests/CMakeLists.txt
+++ b/api-tests/CMakeLists.txt
@@ -107,12 +107,15 @@
GNUARM
ARMCLANG
HOST_GCC
- GCC_LINUX
+ GCC_LINUX
+ INHERIT
)
# list of supported CROSS_COMPILE toolchains
list(APPEND CROSS_COMPILE_TOOLCHAIN_SUPPORT
GNUARM
+ ARMCLANG
+ INHERIT
)
# list of suported CPU arch
@@ -573,14 +576,6 @@
TEST_COMMAND ""
)
-# Check if a specific cross compiler was passed in
-find_program(CMAKE_C_COMPILER ${CROSS_COMPILE}-gcc)
-
-# Otherwise, let CMake look for a C compiler
-if(CMAKE_C_COMPILER STREQUAL "CMAKE_C_COMPILER-NOTFOUND")
- project(TargetConfigGen LANGUAGES C)
-endif()
-
# Add custom target to clean generated files of the external project
add_custom_target(
${PSA_TARGET_GENERATE_DATABASE_POST}
@@ -590,13 +585,13 @@
# Check for supported toolchain/s
if(${TOOLCHAIN} IN_LIST PSA_TOOLCHAIN_SUPPORT)
if (DEFINED CROSS_COMPILE)
- if(${CROSS_COMPILE} AND NOT (${TOOLCHAIN} IN_LIST CROSS_COMPILE_TOOLCHAIN_SUPPORT))
- message(FATAL_ERROR "[PSA] : Error: CROSS_COMPILE not supported for this toolchain, supported toolchain are : ${CROSS_COMPILE_TOOLCHAIN_SUPPORT}")
- endif()
+ if(NOT (${TOOLCHAIN} IN_LIST CROSS_COMPILE_TOOLCHAIN_SUPPORT))
+ message(FATAL_ERROR "[PSA] : Error: CROSS_COMPILE not supported for this toolchain, supported toolchain are : ${CROSS_COMPILE_TOOLCHAIN_SUPPORT}")
+ endif()
endif()
- include(${PSA_ROOT_DIR}/tools/cmake/compiler/${TOOLCHAIN}.cmake)
+ include(${PSA_ROOT_DIR}/tools/cmake/compiler/${TOOLCHAIN}.cmake)
else()
- message(FATAL_ERROR "[PSA] : Error: Unsupported value for -DTOOLCHAIN=${TOOLCHAIN}, supported toolchain are : ${PSA_TOOLCHAIN_SUPPORT}")
+ message(FATAL_ERROR "[PSA] : Error: Unsupported value for -DTOOLCHAIN=${TOOLCHAIN}, supported toolchain are : ${PSA_TOOLCHAIN_SUPPORT}")
endif()
# Global macro to identify the PSA test suite cmake build
diff --git a/api-tests/dev_apis/crypto/suite.cmake b/api-tests/dev_apis/crypto/suite.cmake
index 40c1a0d..f7b13de 100644
--- a/api-tests/dev_apis/crypto/suite.cmake
+++ b/api-tests/dev_apis/crypto/suite.cmake
@@ -33,6 +33,8 @@
add_definitions(${CC_OPTIONS})
add_definitions(${AS_OPTIONS})
+add_definitions(-DHOST_GCC_MISSING_CRYPTO_1_0=1)
+
# append common crypto file to list of source collected
list(APPEND SUITE_CC_SOURCE ${PSA_SUITE_DIR}/common/test_crypto_common.c)
add_library(${PSA_TARGET_TEST_COMBINE_LIB} STATIC ${SUITE_CC_SOURCE} ${SUITE_AS_SOURCE})
diff --git a/api-tests/platform/targets/common/nspe/initial_attestation/pal_attestation_crypto.c b/api-tests/platform/targets/common/nspe/initial_attestation/pal_attestation_crypto.c
index 7b233a2..4a25a20 100644
--- a/api-tests/platform/targets/common/nspe/initial_attestation/pal_attestation_crypto.c
+++ b/api-tests/platform/targets/common/nspe/initial_attestation/pal_attestation_crypto.c
@@ -215,7 +215,7 @@
static uint32_t pal_import_attest_key(psa_algorithm_t key_alg)
{
psa_status_t status = PAL_ATTEST_ERROR;
- psa_key_usage_t usage = PSA_KEY_USAGE_VERIFY;
+ psa_key_usage_t usage = PSA_KEY_USAGE_VERIFY_HASH;
psa_ecc_family_t ecc_family;
psa_key_type_t attest_key_type;
size_t public_key_size;
diff --git a/api-tests/tools/cmake/compiler/INHERIT.cmake b/api-tests/tools/cmake/compiler/INHERIT.cmake
new file mode 100644
index 0000000..b2570c8
--- /dev/null
+++ b/api-tests/tools/cmake/compiler/INHERIT.cmake
@@ -0,0 +1,19 @@
+#/** @file
+# * Copyright (c) 2021, Arm Limited or its affiliates. All rights reserved.
+# * SPDX-License-Identifier : Apache-2.0
+# *
+# * Licensed under the Apache License, Version 2.0 (the "License");
+# * you may not use this file except in compliance with the License.
+# * You may obtain a copy of the License at
+# *
+# * http://www.apache.org/licenses/LICENSE-2.0
+# *
+# * Unless required by applicable law or agreed to in writing, software
+# * distributed under the License is distributed on an "AS IS" BASIS,
+# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# * See the License for the specific language governing permissions and
+# * limitations under the License.
+#**/
+
+# Add any external definitions from the parent build
+add_definitions(${ARCH_TEST_EXTERNAL_DEFS})
diff --git a/api-tests/tools/scripts/target_cfg/CMakeLists.txt b/api-tests/tools/scripts/target_cfg/CMakeLists.txt
index f6ebd3e..259eb9c 100644
--- a/api-tests/tools/scripts/target_cfg/CMakeLists.txt
+++ b/api-tests/tools/scripts/target_cfg/CMakeLists.txt
@@ -25,6 +25,12 @@
include("common/CMakeSettings")
include("common/Utils")
+# Causes toolchain to be re-evaluated
+unset(ENV{CC})
+
+# Let the CMake look for C compiler
+project(TargetConfigGen LANGUAGES C)
+
# Check whether required arguments are passed to CMake
_check_arguments("OUT_DIR"
"TARGET"