Gyorgy Szing | 30fa987 | 2017-12-05 01:08:47 +0000 | [diff] [blame] | 1 | #------------------------------------------------------------------------------- |
Ken Liu | 1f345b0 | 2020-05-30 21:11:05 +0800 | [diff] [blame] | 2 | # Copyright (c) 2017-2020, Arm Limited. All rights reserved. |
Gyorgy Szing | 30fa987 | 2017-12-05 01:08:47 +0000 | [diff] [blame] | 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. |
| 22 | set(CORE_TEST_DIR ${CMAKE_CURRENT_LIST_DIR}) |
| 23 | |
| 24 | #Check input variables |
| 25 | if (NOT DEFINED TFM_ROOT_DIR) |
| 26 | message(FATAL_ERROR "Please set TFM_ROOT_DIR before including this file.") |
| 27 | endif() |
| 28 | |
| 29 | if (NOT DEFINED ENABLE_CORE_TESTS) |
| 30 | message(FATAL_ERROR "Incomplete build configuration: ENABLE_CORE_TESTS is undefined. ") |
| 31 | elseif(ENABLE_CORE_TESTS) |
Mate Toth-Pal | 8d7f12b | 2018-06-18 17:40:09 +0200 | [diff] [blame] | 32 | list(APPEND ALL_SRC_C_S "${CORE_TEST_DIR}/tfm_core_test/tfm_ss_core_test.c") |
Gyorgy Szing | 30fa987 | 2017-12-05 01:08:47 +0000 | [diff] [blame] | 33 | endif() |
| 34 | |
| 35 | if (NOT DEFINED ENABLE_CORE_TESTS_2) |
| 36 | message(FATAL_ERROR "Incomplete build configuration: ENABLE_CORE_TESTS_2 is undefined. ") |
| 37 | elseif(ENABLE_CORE_TESTS_2) |
Mate Toth-Pal | 8d7f12b | 2018-06-18 17:40:09 +0200 | [diff] [blame] | 38 | list(APPEND ALL_SRC_C_S "${CORE_TEST_DIR}/tfm_core_test_2/tfm_ss_core_test_2.c") |
Gyorgy Szing | 30fa987 | 2017-12-05 01:08:47 +0000 | [diff] [blame] | 39 | endif() |
| 40 | |
Mate Toth-Pal | 14c29d0 | 2019-03-05 16:22:13 +0100 | [diff] [blame] | 41 | if (NOT DEFINED ENABLE_IRQ_TEST_SERVICES) |
| 42 | message(FATAL_ERROR "Incomplete build configuration: ENABLE_IRQ_TEST_SERVICES is undefined. ") |
| 43 | elseif(ENABLE_IRQ_TEST_SERVICES) |
| 44 | list(APPEND ALL_SRC_C_S |
| 45 | "${CORE_TEST_DIR}/tfm_irq_test_service_1/tfm_irq_test_service_1.c") |
| 46 | endif() |
| 47 | |
Ben Davis | 6d7256b | 2018-04-18 14:16:53 +0100 | [diff] [blame] | 48 | if (NOT DEFINED TFM_PARTITION_TEST_SECURE_SERVICES) |
| 49 | message(FATAL_ERROR "Incomplete build configuration: TFM_PARTITION_TEST_SECURE_SERVICES is undefined. ") |
| 50 | elseif (TFM_PARTITION_TEST_SECURE_SERVICES) |
Jamie Fox | 830ff76 | 2019-12-16 15:20:22 +0000 | [diff] [blame] | 51 | list(APPEND ALL_SRC_C_S "${CORE_TEST_DIR}/tfm_secure_client_service/tfm_secure_client_service.c" |
| 52 | "${CORE_TEST_DIR}/tfm_secure_client_2/tfm_secure_client_2.c" |
| 53 | "${CORE_TEST_DIR}/tfm_secure_client_2/tfm_secure_client_2_api.c") |
Ben Davis | 6d7256b | 2018-04-18 14:16:53 +0100 | [diff] [blame] | 54 | |
Mate Toth-Pal | 1379e15 | 2018-07-30 17:38:29 +0200 | [diff] [blame] | 55 | list(APPEND ALL_SRC_C_NS "${CORE_TEST_DIR}/tfm_secure_client_service/tfm_secure_client_service_api.c") |
Ben Davis | 6d7256b | 2018-04-18 14:16:53 +0100 | [diff] [blame] | 56 | endif() |
| 57 | |
Edison Ai | ed36e5e | 2019-06-11 16:06:40 +0800 | [diff] [blame] | 58 | if (NOT DEFINED TFM_PARTITION_TEST_CORE_IPC) |
| 59 | message(FATAL_ERROR "Incomplete build configuration: TFM_PARTITION_TEST_CORE_IPC is undefined. ") |
| 60 | elseif (TFM_PARTITION_TEST_CORE_IPC) |
Edison Ai | bb614aa | 2018-11-21 15:15:00 +0800 | [diff] [blame] | 61 | list(APPEND ALL_SRC_C_S "${CORE_TEST_DIR}/tfm_ipc_service/tfm_ipc_service_test.c" |
| 62 | "${CORE_TEST_DIR}/tfm_ipc_client/tfm_ipc_client_test.c" |
Edison Ai | 202a81e | 2018-06-25 13:36:04 +0800 | [diff] [blame] | 63 | ) |
| 64 | endif() |
| 65 | |
Jamie Fox | 0e823a0 | 2019-10-28 17:28:19 +0000 | [diff] [blame] | 66 | if (NOT DEFINED TFM_PARTITION_TEST_SST) |
| 67 | message(FATAL_ERROR "Incomplete build configuration: TFM_PARTITION_TEST_SST is undefined.") |
| 68 | elseif (TFM_PARTITION_TEST_SST) |
| 69 | list(APPEND ALL_SRC_C_S "${CORE_TEST_DIR}/tfm_sst_test_service/tfm_sst_test_service.c" |
| 70 | "${CORE_TEST_DIR}/tfm_sst_test_service/tfm_sst_test_service_api.c") |
| 71 | endif() |
| 72 | |
David Hu | 240f58e | 2019-10-10 10:55:07 +0800 | [diff] [blame] | 73 | if (NOT DEFINED TFM_MULTI_CORE_TEST) |
| 74 | message(FATAL_ERROR "Incomplete build configuration: TFM_MULTI_CORE_TEST is undefined.") |
| 75 | elseif (TFM_MULTI_CORE_TEST) |
| 76 | list(APPEND ALL_SRC_C_S "${CORE_TEST_DIR}/tfm_multi_core_test/tfm_multi_core_test.c") |
| 77 | endif() |
| 78 | |
Gyorgy Szing | 30fa987 | 2017-12-05 01:08:47 +0000 | [diff] [blame] | 79 | embedded_include_directories(PATH ${TFM_ROOT_DIR} ABSOLUTE) |
| 80 | embedded_include_directories(PATH ${TFM_ROOT_DIR}/interface/include ABSOLUTE) |
Mate Toth-Pal | d3c7766 | 2019-02-20 16:23:00 +0100 | [diff] [blame] | 81 | embedded_include_directories(PATH ${TFM_ROOT_DIR}/platform/include ABSOLUTE) |
Ken Liu | 1f345b0 | 2020-05-30 21:11:05 +0800 | [diff] [blame] | 82 | embedded_include_directories(PATH ${TFM_ROOT_DIR}/secure_fw/include ABSOLUTE) |
Gyorgy Szing | 30fa987 | 2017-12-05 01:08:47 +0000 | [diff] [blame] | 83 | |
Marc Moreno Berengue | a1f296f | 2018-01-25 15:21:22 +0000 | [diff] [blame] | 84 | set(BUILD_CMSIS_CORE Off) |
| 85 | set(BUILD_RETARGET Off) |
| 86 | set(BUILD_NATIVE_DRIVERS Off) |
| 87 | set(BUILD_STARTUP Off) |
| 88 | set(BUILD_TARGET_CFG Off) |
| 89 | set(BUILD_TARGET_HARDWARE_KEYS Off) |
Marc Moreno Berengue | 4cc81fc | 2018-08-10 14:32:01 +0100 | [diff] [blame] | 90 | set(BUILD_TARGET_NV_COUNTERS Off) |
Marc Moreno Berengue | a1f296f | 2018-01-25 15:21:22 +0000 | [diff] [blame] | 91 | set(BUILD_CMSIS_DRIVERS Off) |
Marc Moreno Berengue | a1f296f | 2018-01-25 15:21:22 +0000 | [diff] [blame] | 92 | set(BUILD_UART_STDOUT Off) |
| 93 | set(BUILD_FLASH Off) |
Mate Toth-Pal | a9f8e9e | 2019-03-05 16:11:14 +0100 | [diff] [blame] | 94 | if (CORE_TEST_POSITIVE) |
Mate Toth-Pal | d3c7766 | 2019-02-20 16:23:00 +0100 | [diff] [blame] | 95 | set(BUILD_PLAT_TEST On) |
Mate Toth-Pal | a9f8e9e | 2019-03-05 16:11:14 +0100 | [diff] [blame] | 96 | set(BUILD_TIME On) |
Mate Toth-Pal | d3c7766 | 2019-02-20 16:23:00 +0100 | [diff] [blame] | 97 | else() |
| 98 | set(BUILD_PLAT_TEST Off) |
Mate Toth-Pal | a9f8e9e | 2019-03-05 16:11:14 +0100 | [diff] [blame] | 99 | set(BUILD_TIME Off) |
Mate Toth-Pal | d3c7766 | 2019-02-20 16:23:00 +0100 | [diff] [blame] | 100 | endif() |
Marc Moreno Berengue | a1f296f | 2018-01-25 15:21:22 +0000 | [diff] [blame] | 101 | if(NOT DEFINED PLATFORM_CMAKE_FILE) |
| 102 | message (FATAL_ERROR "Platform specific CMake is not defined. Please set PLATFORM_CMAKE_FILE.") |
| 103 | elseif(NOT EXISTS ${PLATFORM_CMAKE_FILE}) |
| 104 | message (FATAL_ERROR "Platform specific CMake \"${PLATFORM_CMAKE_FILE}\" file does not exist. Please fix value of PLATFORM_CMAKE_FILE.") |
| 105 | else() |
| 106 | include(${PLATFORM_CMAKE_FILE}) |
| 107 | endif() |