Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame^] | 1 | #------------------------------------------------------------------------------- |
| 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. |
| 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) |
| 32 | list(APPEND ALL_SRC_C_S "${CORE_TEST_DIR}/tfm_core_test/tfm_ss_core_test.c") |
| 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) |
| 38 | list(APPEND ALL_SRC_C_S "${CORE_TEST_DIR}/tfm_core_test_2/tfm_ss_core_test_2.c") |
| 39 | endif() |
| 40 | |
| 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 | |
| 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) |
| 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") |
| 54 | |
| 55 | list(APPEND ALL_SRC_C_NS "${CORE_TEST_DIR}/tfm_secure_client_service/tfm_secure_client_service_api.c") |
| 56 | endif() |
| 57 | |
| 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) |
| 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" |
| 63 | ) |
| 64 | endif() |
| 65 | |
| 66 | if (NOT DEFINED TFM_PARTITION_TEST_PS) |
| 67 | message(FATAL_ERROR "Incomplete build configuration: TFM_PARTITION_TEST_PS is undefined.") |
| 68 | elseif (TFM_PARTITION_TEST_PS) |
| 69 | list(APPEND ALL_SRC_C_S "${CORE_TEST_DIR}/tfm_ps_test_service/tfm_ps_test_service.c" |
| 70 | "${CORE_TEST_DIR}/tfm_ps_test_service/tfm_ps_test_service_api.c") |
| 71 | endif() |
| 72 | |
| 73 | embedded_include_directories(PATH ${TFM_ROOT_DIR} ABSOLUTE) |
| 74 | embedded_include_directories(PATH ${TFM_ROOT_DIR}/interface/include ABSOLUTE) |
| 75 | embedded_include_directories(PATH ${TFM_ROOT_DIR}/platform/include ABSOLUTE) |
| 76 | embedded_include_directories(PATH ${TFM_ROOT_DIR}/secure_fw/include ABSOLUTE) |
| 77 | |
| 78 | set(BUILD_CMSIS_CORE Off) |
| 79 | set(BUILD_RETARGET Off) |
| 80 | set(BUILD_NATIVE_DRIVERS Off) |
| 81 | set(BUILD_STARTUP Off) |
| 82 | set(BUILD_TARGET_CFG Off) |
| 83 | set(BUILD_TARGET_HARDWARE_KEYS Off) |
| 84 | set(BUILD_TARGET_NV_COUNTERS Off) |
| 85 | set(BUILD_CMSIS_DRIVERS Off) |
| 86 | set(BUILD_UART_STDOUT Off) |
| 87 | set(BUILD_FLASH Off) |
| 88 | if (CORE_TEST_POSITIVE OR CORE_TEST_INTERACTIVE) |
| 89 | set(BUILD_PLAT_TEST On) |
| 90 | set(BUILD_TIME On) |
| 91 | else() |
| 92 | set(BUILD_PLAT_TEST Off) |
| 93 | set(BUILD_TIME Off) |
| 94 | endif() |
| 95 | if(NOT DEFINED PLATFORM_CMAKE_FILE) |
| 96 | message (FATAL_ERROR "Platform specific CMake is not defined. Please set PLATFORM_CMAKE_FILE.") |
| 97 | elseif(NOT EXISTS ${PLATFORM_CMAKE_FILE}) |
| 98 | message (FATAL_ERROR "Platform specific CMake \"${PLATFORM_CMAKE_FILE}\" file does not exist. Please fix value of PLATFORM_CMAKE_FILE.") |
| 99 | else() |
| 100 | include(${PLATFORM_CMAKE_FILE}) |
| 101 | endif() |