blob: 29c15017a35f2f29a06be80c8c697e7c99981895 [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
13if (NOT DEFINED CMAKE_TOOLCHAIN_FILE)
14 set(CROSS_COMPILE arm-none-eabi)
15 set(CMAKE_TOOLCHAIN_FILE ${CONFIG_SPE_PATH}/cmake/toolchain_ns_GNUARM.cmake)
16endif()
17
David Hu1ffdcfe2023-10-13 14:52:40 +080018# A platform sprecific MCPU and architecture flags for NS side
19include(${CONFIG_SPE_PATH}/platform/cpuarch.cmake)
Kevin Peng21613562023-09-04 14:39:28 +080020# Platform abilities for example IRQ test support status
21include(${CONFIG_SPE_PATH}/platform/config.cmake OPTIONAL)
Anton Komlev84283b02023-08-16 10:57:56 +010022
23set(TFM_NS_REG_TEST ON)
24set(NS ON)
Anton Komlev84283b02023-08-16 10:57:56 +010025
Kevin Peng21613562023-09-04 14:39:28 +080026# Test suite configurations - set up by SPE build
27include(${CONFIG_SPE_PATH}/config_ns_test.cmake)
Anton Komlev84283b02023-08-16 10:57:56 +010028
Kevin Peng21613562023-09-04 14:39:28 +080029# Test configurations
Anton Komlev84283b02023-08-16 10:57:56 +010030include(${CMAKE_CURRENT_LIST_DIR}/test/config/default_test_config.cmake)
31
32list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/../cmake)
33list(APPEND CMAKE_MODULE_PATH ${CONFIG_SPE_PATH}/cmake)
Kevin Pengaa32cdf2023-09-11 10:38:22 +080034include(remote_library)
35
36add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/../lib/ext ${CMAKE_BINARY_DIR}/lib/ext)
Anton Komlev84283b02023-08-16 10:57:56 +010037
38project(tfm_ns LANGUAGES C)
39
40add_executable(tfm_ns)
41
Anton Komlevc0ad6042023-08-29 18:23:26 +010042add_subdirectory(../app_broker ${CMAKE_BINARY_DIR}/app_broker)
Anton Komleve4b96ad2023-09-05 17:09:28 +010043add_subdirectory(test)
Anton Komlev84283b02023-08-16 10:57:56 +010044
45############################# TFM NS main app ##################################
46
47target_sources(tfm_ns
48 PRIVATE
49 test_app.c
50)
51
52target_link_libraries(tfm_ns
53 PRIVATE
54 tfm_test_broker
55 tfm_ns_tests
56 tfm_test_framework_common
57)
58
59set_target_properties(tfm_ns PROPERTIES
60 SUFFIX ".axf"
61 RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
62)
David Hu1c1b8162023-10-14 22:31:01 +080063
64target_add_scatter_file(tfm_ns ${CONFIG_SPE_PATH}/platform/linker_scripts)
65
66target_link_options(tfm_ns
67 PRIVATE
68 $<$<C_COMPILER_ID:GNU>:-Wl,-Map=${CMAKE_BINARY_DIR}/bin/tfm_ns.map>
69)