blob: a60f744f0001e84f5a819e1628205865846ebfea [file] [log] [blame]
Anton Komlev84283b02023-08-16 10:57:56 +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 Komlev84283b02023-08-16 10:57:56 +010018if (NOT DEFINED CONFIG_SPE_PATH OR NOT EXISTS ${CONFIG_SPE_PATH})
19 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=")
20endif()
21
David Hu7042a262023-10-14 23:47:29 +080022list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/../cmake)
23list(APPEND CMAKE_MODULE_PATH ${CONFIG_SPE_PATH}/cmake)
24include(remote_library)
25include(toolchain_selection)
Anton Komlev84283b02023-08-16 10:57:56 +010026
David Hu1ffdcfe2023-10-13 14:52:40 +080027# A platform sprecific MCPU and architecture flags for NS side
28include(${CONFIG_SPE_PATH}/platform/cpuarch.cmake)
Kevin Peng21613562023-09-04 14:39:28 +080029# Platform abilities for example IRQ test support status
30include(${CONFIG_SPE_PATH}/platform/config.cmake OPTIONAL)
Anton Komlev84283b02023-08-16 10:57:56 +010031
32set(TFM_NS_REG_TEST ON)
33set(NS ON)
Anton Komlev84283b02023-08-16 10:57:56 +010034
Kevin Peng21613562023-09-04 14:39:28 +080035# Test suite configurations - set up by SPE build
36include(${CONFIG_SPE_PATH}/config_ns_test.cmake)
Anton Komlev84283b02023-08-16 10:57:56 +010037
Kevin Peng21613562023-09-04 14:39:28 +080038# Test configurations
Anton Komlev84283b02023-08-16 10:57:56 +010039include(${CMAKE_CURRENT_LIST_DIR}/test/config/default_test_config.cmake)
40
David Hue90feae2023-10-14 15:17:44 +080041include(${TFM_TOOLCHAIN_FILE})
David Hu4d3f4f62023-10-18 11:56:32 +080042project(tfm_ns LANGUAGES C ASM)
David Hue90feae2023-10-14 15:17:44 +080043tfm_toolchain_reload_compiler()
Anton Komlev84283b02023-08-16 10:57:56 +010044
45add_executable(tfm_ns)
46
David Hu87b46a82023-10-21 23:23:42 +080047add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/../lib/ext ${CMAKE_BINARY_DIR}/lib/ext)
Anton Komlevc0ad6042023-08-29 18:23:26 +010048add_subdirectory(../app_broker ${CMAKE_BINARY_DIR}/app_broker)
Anton Komleve4b96ad2023-09-05 17:09:28 +010049add_subdirectory(test)
Anton Komlev84283b02023-08-16 10:57:56 +010050
51############################# TFM NS main app ##################################
52
53target_sources(tfm_ns
54 PRIVATE
55 test_app.c
56)
57
58target_link_libraries(tfm_ns
59 PRIVATE
60 tfm_test_broker
61 tfm_ns_tests
62 tfm_test_framework_common
63)
64
65set_target_properties(tfm_ns PROPERTIES
66 SUFFIX ".axf"
67 RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
68)
David Hu1c1b8162023-10-14 22:31:01 +080069
70target_add_scatter_file(tfm_ns ${CONFIG_SPE_PATH}/platform/linker_scripts)
71
72target_link_options(tfm_ns
73 PRIVATE
74 $<$<C_COMPILER_ID:GNU>:-Wl,-Map=${CMAKE_BINARY_DIR}/bin/tfm_ns.map>
David Hub4c9f9f2023-10-14 15:38:03 +080075 $<$<C_COMPILER_ID:ARMClang>:--map>
David Hu1c1b8162023-10-14 22:31:01 +080076)
David Hue90feae2023-10-14 15:17:44 +080077
78add_convert_to_bin_target(tfm_ns)