Anton Komlev | 4d4cc68 | 2023-09-05 16:33:53 +0100 | [diff] [blame] | 1 | #------------------------------------------------------------------------------- |
| 2 | # Copyright (c) 2023, Arm Limited. All rights reserved. |
| 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # |
| 6 | #------------------------------------------------------------------------------- |
| 7 | cmake_minimum_required(VERSION 3.15) |
| 8 | |
| 9 | #--- SPE artifacts ------------------------------------------------------------- |
| 10 | |
| 11 | if (NOT DEFINED CONFIG_SPE_PATH OR NOT EXISTS ${CONFIG_SPE_PATH}) |
| 12 | 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=") |
| 13 | endif() |
| 14 | |
| 15 | list(APPEND CMAKE_MODULE_PATH ${CONFIG_SPE_PATH}/cmake) |
David Hu | 1ffdcfe | 2023-10-13 14:52:40 +0800 | [diff] [blame^] | 16 | |
| 17 | # A platform sprecific MCPU and architecture flags for NS side |
| 18 | include(${CONFIG_SPE_PATH}/platform/cpuarch.cmake) |
| 19 | |
Anton Komlev | 4d4cc68 | 2023-09-05 16:33:53 +0100 | [diff] [blame] | 20 | include(spe_config) |
| 21 | include(${CONFIG_SPE_PATH}/platform/config.cmake) |
| 22 | |
| 23 | set(CPU_ARCH ${PSA_API_TEST_CPU_ARCH}) |
| 24 | set(SUITE ${TEST_PSA_API}) |
| 25 | |
| 26 | if (NOT "${TEST_PSA_API}" STREQUAL "IPC") |
| 27 | set(TARGET tgt_dev_apis_tfm_${PSA_API_TEST_TARGET}) |
| 28 | else() |
| 29 | set(TARGET tgt_ff_tfm_${PSA_API_TEST_TARGET}) |
| 30 | endif() |
| 31 | |
| 32 | #--- NSPE side project --------------------------------------------------------- |
| 33 | |
| 34 | if (NOT DEFINED CMAKE_TOOLCHAIN_FILE) |
| 35 | set(CROSS_COMPILE arm-none-eabi) |
| 36 | set(CMAKE_TOOLCHAIN_FILE ${CONFIG_SPE_PATH}/cmake/toolchain_ns_GNUARM.cmake) |
| 37 | endif() |
| 38 | |
| 39 | list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/../cmake) |
| 40 | |
| 41 | project("TF-M PSA Arch tests" LANGUAGES C) |
| 42 | |
| 43 | add_executable(tfm_ns) |
| 44 | |
| 45 | add_subdirectory(../app_broker ${CMAKE_BINARY_DIR}/app_broker) |
| 46 | |
| 47 | list(APPEND PSA_INCLUDE_PATHS ${CONFIG_SPE_PATH}/interface/include) |
| 48 | |
| 49 | if(NOT PSA_INCLUDE_PATHS) |
| 50 | set(PSA_INCLUDE_PATHS ${INTERFACE_INC_DIR}/ |
| 51 | ${CMAKE_BINARY_DIR}/generated/api-tests/platform/manifests/ |
| 52 | ${CMAKE_BINARY_DIR}/generated/interface/include |
| 53 | ) |
| 54 | endif() |
| 55 | |
| 56 | set(PLATFORM_PSA_ISOLATION_LEVEL ${TFM_ISOLATION_LEVEL}) |
| 57 | |
| 58 | add_subdirectory(${PSA_ARCH_TESTS_PATH}/api-tests ${CMAKE_BINARY_DIR}/api-tests) |
| 59 | |
| 60 | ############################# TFM NS main app ################################## |
| 61 | |
| 62 | target_sources(tfm_ns |
| 63 | PRIVATE |
| 64 | test_app.c |
| 65 | ) |
| 66 | |
| 67 | target_link_libraries(tfm_ns |
| 68 | PRIVATE |
| 69 | tfm_test_broker |
| 70 | val_nspe |
| 71 | pal_nspe |
| 72 | test_combine |
| 73 | ) |
| 74 | |
| 75 | set_target_properties(tfm_ns PROPERTIES |
| 76 | SUFFIX ".axf" |
| 77 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" |
| 78 | ) |
| 79 | |
David Hu | 1c1b816 | 2023-10-14 22:31:01 +0800 | [diff] [blame] | 80 | target_add_scatter_file(tfm_ns ${CONFIG_SPE_PATH}/platform/linker_scripts) |
| 81 | |
| 82 | target_link_options(tfm_ns |
| 83 | PRIVATE |
| 84 | $<$<C_COMPILER_ID:GNU>:-Wl,-Map=${CMAKE_BINARY_DIR}/bin/tfm_ns.map> |
| 85 | ) |