tfm: Fix zephyr-sdk toolchain variant integration

The psa-arch-tests project changed how third-party toolchains are
integrated. This broke the Zephyr sdk.

This patch aligns with the new mechanism.

https://github.com/ARM-software/psa-arch-tests/pull/276

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
This commit is contained in:
Sebastian Bøe
2021-08-31 13:30:31 +02:00
committed by Kumar Gala
parent fc3f4a627e
commit e3b3afa7a5
2 changed files with 23 additions and 0 deletions

View File

@@ -189,6 +189,8 @@ if (CONFIG_BUILD_WITH_TFM)
COMMAND ${CMAKE_COMMAND}
-G${CMAKE_GENERATOR}
-DTFM_TOOLCHAIN_FILE=${ZEPHYR_TRUSTED_FIRMWARE_M_MODULE_DIR}/${TFM_TOOLCHAIN_FILE}
-DPSA_TOOLCHAIN_FILE=${CMAKE_CURRENT_LIST_DIR}/psa/GNUARM.cmake
-DTOOLCHAIN=INHERIT
-DTFM_PLATFORM=${TFM_BOARD}
-DCROSS_COMPILE=${TFM_TOOLCHAIN_PATH}/${TFM_TOOLCHAIN_PREFIX}
-DCMAKE_BUILD_TYPE=${TFM_CMAKE_BUILD_TYPE}

View File

@@ -0,0 +1,21 @@
# Copyright (c) 2021 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: Apache-2.0
#
# This file is the INHERIT equivalent to
# https://github.com/ARM-software/psa-arch-tests/blob/master/api-tests/tools/cmake/compiler/GNUARM.cmake
#
# The INHERIT concept was introduced in
# https://github.com/ARM-software/psa-arch-tests/pull/276
if(${CPU_ARCH} STREQUAL armv7m)
set(TARGET_SWITCH "-march=armv7-m")
elseif(${CPU_ARCH} STREQUAL armv8m_ml)
set(TARGET_SWITCH "-march=armv8-m.main -mcmse")
elseif(${CPU_ARCH} STREQUAL armv8m_bl)
set(TARGET_SWITCH "-march=armv8-m.base -mcmse")
endif()
set(CMAKE_C_FLAGS "${TARGET_SWITCH} -g -Wall -Werror -Wextra -fdata-sections -ffunction-sections -mno-unaligned-access")
set(CMAKE_ASM_FLAGS "${TARGET_SWITCH} -mthumb")
set(CMAKE_EXE_LINKER_FLAGS "-Xlinker --fatal-warnings -Xlinker --gc-sections -z max-page-size=0x400 -lgcc -lc -lnosys")