blob: 5720128dfdebc30f2015fb3844657cdd3c903e4a [file] [log] [blame]
Anton Komlev4d4cc682023-09-05 16:33:53 +01001#-------------------------------------------------------------------------------
2# Copyright (c) 2023, Arm Limited. All rights reserved.
3#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6#-------------------------------------------------------------------------------
7cmake_minimum_required(VERSION 3.15)
8
David Hub4c9f9f2023-10-14 15:38:03 +08009# CMake 3.21 and above requests projects to specify cpu/arch compile and link flags explicitly in
10# Armclang. Link: https://cmake.org/cmake/help/latest/policy/CMP0123.html
11# It is aligned with current Armclang toolchain implementation.
12# Explictly set this policy to NEW behavior to eliminate long warnings. It shall be set in root
13# CMakeLists.txt otherwise project() will throw out the warnings.
14if(POLICY CMP0123)
15 cmake_policy(SET CMP0123 NEW)
16endif()
17
Anton Komlev4d4cc682023-09-05 16:33:53 +010018#--- SPE artifacts -------------------------------------------------------------
19
20if (NOT DEFINED CONFIG_SPE_PATH OR NOT EXISTS ${CONFIG_SPE_PATH})
21 message(FATAL_ERROR "CONFIG_SPE_PATH = ${CONFIG_SPE_PATH} is not defined or incorrect. Please provide full path to TF-M build artifacts using -DCONFIG_SPE_PATH=")
22endif()
23
24list(APPEND CMAKE_MODULE_PATH ${CONFIG_SPE_PATH}/cmake)
David Hu1ffdcfe2023-10-13 14:52:40 +080025
26# A platform sprecific MCPU and architecture flags for NS side
27include(${CONFIG_SPE_PATH}/platform/cpuarch.cmake)
28
Anton Komlev4d4cc682023-09-05 16:33:53 +010029include(spe_config)
30include(${CONFIG_SPE_PATH}/platform/config.cmake)
31
32set(CPU_ARCH ${PSA_API_TEST_CPU_ARCH})
33set(SUITE ${TEST_PSA_API})
34
35if (NOT "${TEST_PSA_API}" STREQUAL "IPC")
36 set(TARGET tgt_dev_apis_tfm_${PSA_API_TEST_TARGET})
37else()
38 set(TARGET tgt_ff_tfm_${PSA_API_TEST_TARGET})
39endif()
40
41#--- NSPE side project ---------------------------------------------------------
42
Anton Komlev4d4cc682023-09-05 16:33:53 +010043list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/../cmake)
David Hu7042a262023-10-14 23:47:29 +080044include(toolchain_selection)
Anton Komlev4d4cc682023-09-05 16:33:53 +010045
David Hue90feae2023-10-14 15:17:44 +080046include(${TFM_TOOLCHAIN_FILE})
David Hu4d3f4f62023-10-18 11:56:32 +080047project("TF-M PSA Arch tests" LANGUAGES C ASM)
David Hue90feae2023-10-14 15:17:44 +080048tfm_toolchain_reload_compiler()
Anton Komlev4d4cc682023-09-05 16:33:53 +010049
50add_executable(tfm_ns)
51
52add_subdirectory(../app_broker ${CMAKE_BINARY_DIR}/app_broker)
53
54list(APPEND PSA_INCLUDE_PATHS ${CONFIG_SPE_PATH}/interface/include)
55
56if(NOT PSA_INCLUDE_PATHS)
57 set(PSA_INCLUDE_PATHS ${INTERFACE_INC_DIR}/
58 ${CMAKE_BINARY_DIR}/generated/api-tests/platform/manifests/
59 ${CMAKE_BINARY_DIR}/generated/interface/include
60 )
61endif()
62
63set(PLATFORM_PSA_ISOLATION_LEVEL ${TFM_ISOLATION_LEVEL})
64
65add_subdirectory(${PSA_ARCH_TESTS_PATH}/api-tests ${CMAKE_BINARY_DIR}/api-tests)
66
67############################# TFM NS main app ##################################
68
69target_sources(tfm_ns
70 PRIVATE
71 test_app.c
72)
73
74target_link_libraries(tfm_ns
75 PRIVATE
76 tfm_test_broker
77 val_nspe
78 pal_nspe
79 test_combine
80)
81
82set_target_properties(tfm_ns PROPERTIES
83 SUFFIX ".axf"
84 RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
85)
86
David Hu1c1b8162023-10-14 22:31:01 +080087target_add_scatter_file(tfm_ns ${CONFIG_SPE_PATH}/platform/linker_scripts)
88
89target_link_options(tfm_ns
90 PRIVATE
91 $<$<C_COMPILER_ID:GNU>:-Wl,-Map=${CMAKE_BINARY_DIR}/bin/tfm_ns.map>
David Hub4c9f9f2023-10-14 15:38:03 +080092 $<$<C_COMPILER_ID:ARMClang>:--map>
David Hu1c1b8162023-10-14 22:31:01 +080093)
David Hue90feae2023-10-14 15:17:44 +080094
95add_convert_to_bin_target(tfm_ns)