blob: afece9f960d03df9e3febf1e0a891a3cf61b9e71 [file] [log] [blame]
Kevin Peng62a87112020-07-07 15:07:46 +08001#-------------------------------------------------------------------------------
2# Copyright (c) 2017-2020, Arm Limited. All rights reserved.
3#
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)
Ken Liu5b5e2962020-08-18 21:11:47 +080032 list(APPEND ALL_SRC_C_S "${CORE_TEST_DIR}/tfm_core_test/tfm_ss_core_test.c"
33 "${CORE_TEST_DIR}/tfm_core_test/auto_generated/intermedia_tfm_ss_core_test.c")
Kevin Peng62a87112020-07-07 15:07:46 +080034endif()
35
36if (NOT DEFINED ENABLE_CORE_TESTS_2)
37 message(FATAL_ERROR "Incomplete build configuration: ENABLE_CORE_TESTS_2 is undefined. ")
38elseif(ENABLE_CORE_TESTS_2)
Ken Liu5b5e2962020-08-18 21:11:47 +080039 list(APPEND ALL_SRC_C_S "${CORE_TEST_DIR}/tfm_core_test_2/tfm_ss_core_test_2.c"
40 "${CORE_TEST_DIR}/tfm_core_test_2/auto_generated/intermedia_tfm_ss_core_test_2.c")
Kevin Peng62a87112020-07-07 15:07:46 +080041endif()
42
43if (NOT DEFINED ENABLE_IRQ_TEST_SERVICES)
44 message(FATAL_ERROR "Incomplete build configuration: ENABLE_IRQ_TEST_SERVICES is undefined. ")
45elseif(ENABLE_IRQ_TEST_SERVICES)
46 list(APPEND ALL_SRC_C_S
Ken Liu5b5e2962020-08-18 21:11:47 +080047 "${CORE_TEST_DIR}/tfm_irq_test_service_1/tfm_irq_test_service_1.c"
48 "${CORE_TEST_DIR}/tfm_irq_test_service_1/auto_generated/intermedia_tfm_irq_test_service_1.c")
Kevin Peng62a87112020-07-07 15:07:46 +080049endif()
50
51if (NOT DEFINED TFM_PARTITION_TEST_SECURE_SERVICES)
52 message(FATAL_ERROR "Incomplete build configuration: TFM_PARTITION_TEST_SECURE_SERVICES is undefined. ")
53elseif (TFM_PARTITION_TEST_SECURE_SERVICES)
Ken Liu5b5e2962020-08-18 21:11:47 +080054 list(APPEND ALL_SRC_C_S
55 "${CORE_TEST_DIR}/tfm_secure_client_service/tfm_secure_client_service.c"
56 "${CORE_TEST_DIR}/tfm_secure_client_service/auto_generated/intermedia_tfm_secure_client_service.c"
Kevin Peng62a87112020-07-07 15:07:46 +080057 "${CORE_TEST_DIR}/tfm_secure_client_2/tfm_secure_client_2.c"
Ken Liu5b5e2962020-08-18 21:11:47 +080058 "${CORE_TEST_DIR}/tfm_secure_client_2/tfm_secure_client_2_api.c"
59 "${CORE_TEST_DIR}/tfm_secure_client_2/auto_generated/intermedia_tfm_secure_client_2.c")
Kevin Peng62a87112020-07-07 15:07:46 +080060
61 list(APPEND ALL_SRC_C_NS "${CORE_TEST_DIR}/tfm_secure_client_service/tfm_secure_client_service_api.c")
62endif()
63
64if (NOT DEFINED TFM_PARTITION_TEST_CORE_IPC)
65 message(FATAL_ERROR "Incomplete build configuration: TFM_PARTITION_TEST_CORE_IPC is undefined. ")
66elseif (TFM_PARTITION_TEST_CORE_IPC)
67 list(APPEND ALL_SRC_C_S "${CORE_TEST_DIR}/tfm_ipc_service/tfm_ipc_service_test.c"
Ken Liu5b5e2962020-08-18 21:11:47 +080068 "${CORE_TEST_DIR}/tfm_ipc_service/auto_generated/intermedia_tfm_ipc_service_test.c"
Kevin Peng62a87112020-07-07 15:07:46 +080069 "${CORE_TEST_DIR}/tfm_ipc_client/tfm_ipc_client_test.c"
Ken Liu5b5e2962020-08-18 21:11:47 +080070 "${CORE_TEST_DIR}/tfm_ipc_client/auto_generated/intermedia_tfm_ipc_client_test.c"
Kevin Peng62a87112020-07-07 15:07:46 +080071 )
72endif()
73
74if (NOT DEFINED TFM_PARTITION_TEST_PS)
75 message(FATAL_ERROR "Incomplete build configuration: TFM_PARTITION_TEST_PS is undefined.")
76elseif (TFM_PARTITION_TEST_PS)
77 list(APPEND ALL_SRC_C_S "${CORE_TEST_DIR}/tfm_ps_test_service/tfm_ps_test_service.c"
Ken Liu5b5e2962020-08-18 21:11:47 +080078 "${CORE_TEST_DIR}/tfm_ps_test_service/tfm_ps_test_service_api.c"
79 "${CORE_TEST_DIR}/tfm_ps_test_service/auto_generated/intermedia_tfm_ps_test_service.c")
Kevin Peng62a87112020-07-07 15:07:46 +080080endif()
81
82embedded_include_directories(PATH ${TFM_ROOT_DIR} ABSOLUTE)
83embedded_include_directories(PATH ${TFM_ROOT_DIR}/interface/include ABSOLUTE)
84embedded_include_directories(PATH ${TFM_ROOT_DIR}/platform/include ABSOLUTE)
85embedded_include_directories(PATH ${TFM_ROOT_DIR}/secure_fw/include ABSOLUTE)
86
87set(BUILD_CMSIS_CORE Off)
88set(BUILD_RETARGET Off)
89set(BUILD_NATIVE_DRIVERS Off)
90set(BUILD_STARTUP Off)
91set(BUILD_TARGET_CFG Off)
92set(BUILD_TARGET_HARDWARE_KEYS Off)
93set(BUILD_TARGET_NV_COUNTERS Off)
94set(BUILD_CMSIS_DRIVERS Off)
95set(BUILD_UART_STDOUT Off)
96set(BUILD_FLASH Off)
97if (CORE_TEST_POSITIVE OR CORE_TEST_INTERACTIVE)
98 set(BUILD_PLAT_TEST On)
99 set(BUILD_TIME On)
100else()
101 set(BUILD_PLAT_TEST Off)
102 set(BUILD_TIME Off)
103endif()
104if(NOT DEFINED PLATFORM_CMAKE_FILE)
105 message (FATAL_ERROR "Platform specific CMake is not defined. Please set PLATFORM_CMAKE_FILE.")
106elseif(NOT EXISTS ${PLATFORM_CMAKE_FILE})
107 message (FATAL_ERROR "Platform specific CMake \"${PLATFORM_CMAKE_FILE}\" file does not exist. Please fix value of PLATFORM_CMAKE_FILE.")
108else()
109 include(${PLATFORM_CMAKE_FILE})
110endif()