blob: d591ce659cf829a66019ddde3714eb8c07715d9b [file] [log] [blame]
Gyorgy Szing30fa9872017-12-05 01:08:47 +00001#-------------------------------------------------------------------------------
Marc Moreno Berengue3587a9f2019-01-14 15:56:46 +00002# Copyright (c) 2017-2019, Arm Limited. All rights reserved.
Gyorgy Szing30fa9872017-12-05 01:08:47 +00003#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6#-------------------------------------------------------------------------------
7
8#Definitions to compile the "secure services" module.
9#This file assumes it will be included from a project specific cmakefile, and
10#will not create a library or executable.
11#Inputs:
12# TFM_ROOT_DIR - root directory of the TF-M repository.
13#
14#Outputs:
15# Will modify include directories to make the source compile.
16# ALL_SRC_C: C source files to be compiled will be added to this list. This shall be added to your add_executable or add_library command.
17# ALL_SRC_CXX: C++ source files to be compiled will be added to this list. This shall be added to your add_executable or add_library command.
18# ALL_SRC_ASM: assembly source files to be compiled will be added to this list. This shall be added to your add_executable or add_library command.
19# Include directories will be modified by using the include_directories() commands as needed.
20
21#Get the current directory where this file is located.
22set(CORE_TEST_DIR ${CMAKE_CURRENT_LIST_DIR})
23
24#Check input variables
25if (NOT DEFINED TFM_ROOT_DIR)
26 message(FATAL_ERROR "Please set TFM_ROOT_DIR before including this file.")
27endif()
28
29if (NOT DEFINED ENABLE_CORE_TESTS)
30 message(FATAL_ERROR "Incomplete build configuration: ENABLE_CORE_TESTS is undefined. ")
31elseif(ENABLE_CORE_TESTS)
Mate Toth-Pal8d7f12b2018-06-18 17:40:09 +020032 list(APPEND ALL_SRC_C_S "${CORE_TEST_DIR}/tfm_core_test/tfm_ss_core_test.c")
Gyorgy Szing30fa9872017-12-05 01:08:47 +000033endif()
34
35if (NOT DEFINED ENABLE_CORE_TESTS_2)
36 message(FATAL_ERROR "Incomplete build configuration: ENABLE_CORE_TESTS_2 is undefined. ")
37elseif(ENABLE_CORE_TESTS_2)
Mate Toth-Pal8d7f12b2018-06-18 17:40:09 +020038 list(APPEND ALL_SRC_C_S "${CORE_TEST_DIR}/tfm_core_test_2/tfm_ss_core_test_2.c")
Gyorgy Szing30fa9872017-12-05 01:08:47 +000039endif()
40
Ben Davis6d7256b2018-04-18 14:16:53 +010041if (NOT DEFINED TFM_PARTITION_TEST_SECURE_SERVICES)
42 message(FATAL_ERROR "Incomplete build configuration: TFM_PARTITION_TEST_SECURE_SERVICES is undefined. ")
43elseif (TFM_PARTITION_TEST_SECURE_SERVICES)
44 list(APPEND ALL_SRC_C_S "${CORE_TEST_DIR}/tfm_secure_client_service/tfm_secure_client_service.c"
45 "${CORE_TEST_DIR}/tfm_secure_client_service/tfm_secure_client_service_veneers.c"
46 )
47
Mate Toth-Pal1379e152018-07-30 17:38:29 +020048 list(APPEND ALL_SRC_C_NS "${CORE_TEST_DIR}/tfm_secure_client_service/tfm_secure_client_service_api.c")
Ben Davis6d7256b2018-04-18 14:16:53 +010049endif()
50
Edison Ai202a81e2018-06-25 13:36:04 +080051if (NOT DEFINED CORE_TEST_IPC)
52 message(FATAL_ERROR "Incomplete build configuration: CORE_TEST_IPC is undefined. ")
53elseif (CORE_TEST_IPC)
Edison Aibb614aa2018-11-21 15:15:00 +080054 list(APPEND ALL_SRC_C_S "${CORE_TEST_DIR}/tfm_ipc_service/tfm_ipc_service_test.c"
55 "${CORE_TEST_DIR}/tfm_ipc_client/tfm_ipc_client_test.c"
Edison Ai202a81e2018-06-25 13:36:04 +080056 )
57endif()
58
Gyorgy Szing30fa9872017-12-05 01:08:47 +000059embedded_include_directories(PATH ${TFM_ROOT_DIR} ABSOLUTE)
60embedded_include_directories(PATH ${TFM_ROOT_DIR}/interface/include ABSOLUTE)
Mate Toth-Pald3c77662019-02-20 16:23:00 +010061embedded_include_directories(PATH ${TFM_ROOT_DIR}/platform/include ABSOLUTE)
Gyorgy Szing30fa9872017-12-05 01:08:47 +000062
Marc Moreno Berenguea1f296f2018-01-25 15:21:22 +000063set(BUILD_CMSIS_CORE Off)
64set(BUILD_RETARGET Off)
65set(BUILD_NATIVE_DRIVERS Off)
66set(BUILD_STARTUP Off)
67set(BUILD_TARGET_CFG Off)
68set(BUILD_TARGET_HARDWARE_KEYS Off)
Marc Moreno Berengue4cc81fc2018-08-10 14:32:01 +010069set(BUILD_TARGET_NV_COUNTERS Off)
Marc Moreno Berenguea1f296f2018-01-25 15:21:22 +000070set(BUILD_CMSIS_DRIVERS Off)
Marc Moreno Berenguea1f296f2018-01-25 15:21:22 +000071set(BUILD_UART_STDOUT Off)
72set(BUILD_FLASH Off)
Tamas Ban3681ce02018-11-22 15:19:24 +000073set(BUILD_BOOT_SEED Off)
Tamas Ban229f9db2018-08-17 12:57:13 +010074set(BUILD_DEVICE_ID On)
Mate Toth-Pala9f8e9e2019-03-05 16:11:14 +010075if (CORE_TEST_POSITIVE)
Mate Toth-Pald3c77662019-02-20 16:23:00 +010076 set(BUILD_PLAT_TEST On)
Mate Toth-Pala9f8e9e2019-03-05 16:11:14 +010077 set(BUILD_TIME On)
Mate Toth-Pald3c77662019-02-20 16:23:00 +010078else()
79 set(BUILD_PLAT_TEST Off)
Mate Toth-Pala9f8e9e2019-03-05 16:11:14 +010080 set(BUILD_TIME Off)
Mate Toth-Pald3c77662019-02-20 16:23:00 +010081endif()
Marc Moreno Berenguea1f296f2018-01-25 15:21:22 +000082if(NOT DEFINED PLATFORM_CMAKE_FILE)
83 message (FATAL_ERROR "Platform specific CMake is not defined. Please set PLATFORM_CMAKE_FILE.")
84elseif(NOT EXISTS ${PLATFORM_CMAKE_FILE})
85 message (FATAL_ERROR "Platform specific CMake \"${PLATFORM_CMAKE_FILE}\" file does not exist. Please fix value of PLATFORM_CMAKE_FILE.")
86else()
87 include(${PLATFORM_CMAKE_FILE})
88endif()