blob: e3f7685a976d5d1012c1b98056be009fdf33b391 [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
9if (NOT DEFINED CONFIG_SPE_PATH OR NOT EXISTS ${CONFIG_SPE_PATH})
10 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=")
11endif()
12
David Hue90feae2023-10-14 15:17:44 +080013if (NOT DEFINED TFM_TOOLCHAIN_FILE)
14 set(TFM_TOOLCHAIN_FILE ${CONFIG_SPE_PATH}/cmake/toolchain_ns_GNUARM.cmake)
Anton Komlev84283b02023-08-16 10:57:56 +010015endif()
16
David Hu1ffdcfe2023-10-13 14:52:40 +080017# A platform sprecific MCPU and architecture flags for NS side
18include(${CONFIG_SPE_PATH}/platform/cpuarch.cmake)
Kevin Peng21613562023-09-04 14:39:28 +080019# Platform abilities for example IRQ test support status
20include(${CONFIG_SPE_PATH}/platform/config.cmake OPTIONAL)
Anton Komlev84283b02023-08-16 10:57:56 +010021
22set(TFM_NS_REG_TEST ON)
23set(NS ON)
Anton Komlev84283b02023-08-16 10:57:56 +010024
Kevin Peng21613562023-09-04 14:39:28 +080025# Test suite configurations - set up by SPE build
26include(${CONFIG_SPE_PATH}/config_ns_test.cmake)
Anton Komlev84283b02023-08-16 10:57:56 +010027
Kevin Peng21613562023-09-04 14:39:28 +080028# Test configurations
Anton Komlev84283b02023-08-16 10:57:56 +010029include(${CMAKE_CURRENT_LIST_DIR}/test/config/default_test_config.cmake)
30
31list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/../cmake)
32list(APPEND CMAKE_MODULE_PATH ${CONFIG_SPE_PATH}/cmake)
Kevin Pengaa32cdf2023-09-11 10:38:22 +080033include(remote_library)
34
35add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/../lib/ext ${CMAKE_BINARY_DIR}/lib/ext)
Anton Komlev84283b02023-08-16 10:57:56 +010036
David Hue90feae2023-10-14 15:17:44 +080037include(${TFM_TOOLCHAIN_FILE})
Anton Komlev84283b02023-08-16 10:57:56 +010038project(tfm_ns LANGUAGES C)
David Hue90feae2023-10-14 15:17:44 +080039tfm_toolchain_reload_compiler()
Anton Komlev84283b02023-08-16 10:57:56 +010040
41add_executable(tfm_ns)
42
Anton Komlevc0ad6042023-08-29 18:23:26 +010043add_subdirectory(../app_broker ${CMAKE_BINARY_DIR}/app_broker)
Anton Komleve4b96ad2023-09-05 17:09:28 +010044add_subdirectory(test)
Anton Komlev84283b02023-08-16 10:57:56 +010045
46############################# TFM NS main app ##################################
47
48target_sources(tfm_ns
49 PRIVATE
50 test_app.c
51)
52
53target_link_libraries(tfm_ns
54 PRIVATE
55 tfm_test_broker
56 tfm_ns_tests
57 tfm_test_framework_common
58)
59
60set_target_properties(tfm_ns PROPERTIES
61 SUFFIX ".axf"
62 RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
63)
David Hu1c1b8162023-10-14 22:31:01 +080064
65target_add_scatter_file(tfm_ns ${CONFIG_SPE_PATH}/platform/linker_scripts)
66
67target_link_options(tfm_ns
68 PRIVATE
69 $<$<C_COMPILER_ID:GNU>:-Wl,-Map=${CMAKE_BINARY_DIR}/bin/tfm_ns.map>
70)
David Hue90feae2023-10-14 15:17:44 +080071
72add_convert_to_bin_target(tfm_ns)