Jelle Sels | 0375666 | 2021-05-20 10:41:57 +0200 | [diff] [blame] | 1 | #------------------------------------------------------------------------------- |
| 2 | # Copyright (c) 2022, Arm Limited and Contributors. All rights reserved. |
| 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # |
| 6 | #------------------------------------------------------------------------------- |
| 7 | #------------------------------------------------------------------------------- |
| 8 | # The CMakeLists.txt for building the spm-test sp deployment for opteesp |
| 9 | # |
| 10 | # Used for building the SPs used in the spm test. The SP can be build twice |
| 11 | # , to be able to test inter SPs communication. This is done by passing the |
| 12 | # -DSP_NUMBER=1 parameter. |
| 13 | #------------------------------------------------------------------------------- |
| 14 | target_include_directories(spm-test${SP_NUMBER} PRIVATE "${TOP_LEVEL_INCLUDE_DIRS}") |
| 15 | |
| 16 | include(${TS_ROOT}/tools/cmake/common/TargetCompileDefinitions.cmake) |
| 17 | set_target_uuids( |
| 18 | SP_UUID ${SP_UUID_CANON} |
| 19 | SP_NAME "spm-test${SP_NUMBER}" |
| 20 | ) |
| 21 | set(SP_HEAP_SIZE "32 * 1024" CACHE STRING "SP heap size in bytes") |
| 22 | set(TRACE_PREFIX "SPM-TEST${SP_NUMBER}" CACHE STRING "Trace prefix") |
| 23 | |
| 24 | #------------------------------------------------------------------------------- |
| 25 | # Extend with components that are common across all deployments of |
| 26 | # spm-test |
| 27 | # |
| 28 | #------------------------------------------------------------------------------- |
| 29 | target_include_directories(spm-test${SP_NUMBER} PRIVATE |
| 30 | ${TS_ROOT} |
| 31 | ${TS_ROOT}/components |
| 32 | ) |
| 33 | |
| 34 | #------------------------------------------------------------------------------- |
| 35 | # Set target platform to provide drivers needed by the deployment |
| 36 | # |
| 37 | #------------------------------------------------------------------------------- |
| 38 | add_platform(TARGET spm-test${SP_NUMBER}) |
| 39 | |
| 40 | ################################################################# |
| 41 | |
| 42 | target_compile_definitions(spm-test${SP_NUMBER} PRIVATE |
| 43 | ARM64=1 |
| 44 | ) |
| 45 | |
| 46 | target_include_directories(spm-test${SP_NUMBER} PRIVATE |
| 47 | ${TS_ROOT}/components/service/spm_test |
| 48 | ) |
| 49 | |
Gyorgy Szing | 34aaf21 | 2022-10-20 07:26:23 +0200 | [diff] [blame] | 50 | if(CMAKE_C_COMPILER_ID STREQUAL "GNU") |
| 51 | target_compile_options(spm-test${SP_NUMBER} PRIVATE |
| 52 | -std=c99 |
| 53 | ) |
| 54 | endif() |
| 55 | |
Jelle Sels | 0375666 | 2021-05-20 10:41:57 +0200 | [diff] [blame] | 56 | #------------------------------------------------------------------------------- |
| 57 | # Deployment specific source files |
| 58 | #------------------------------------------------------------------------------- |
| 59 | target_sources(spm-test${SP_NUMBER} PRIVATE |
| 60 | ${TS_ROOT}/components/service/spm_test/sp.c |
| 61 | ) |
Jelle Sels | 0375666 | 2021-05-20 10:41:57 +0200 | [diff] [blame] | 62 | |
| 63 | compiler_generate_stripped_elf(TARGET spm-test${SP_NUMBER} NAME "${SP_UUID_CANON}.stripped.elf" RES STRIPPED_ELF) |
| 64 | |
| 65 | ######################################## install |
| 66 | if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) |
| 67 | set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install CACHE PATH "location to install build output to." FORCE) |
| 68 | endif() |
| 69 | |
Jelle Sels | 0375666 | 2021-05-20 10:41:57 +0200 | [diff] [blame] | 70 | install(TARGETS spm-test${SP_NUMBER} |
| 71 | PUBLIC_HEADER DESTINATION ${TS_ENV}/include |
| 72 | RUNTIME DESTINATION ${TS_ENV}/bin |
| 73 | ) |
| 74 | install(FILES ${STRIPPED_ELF} DESTINATION ${TS_ENV}/bin) |
| 75 | |
| 76 | |
| 77 | include(${TS_ROOT}/tools/cmake/common/ExportSp.cmake) |
| 78 | export_sp( |
| 79 | SP_UUID_CANON ${SP_UUID_CANON} |
Gyorgy Szing | 3e3db70 | 2023-07-21 14:18:19 +0200 | [diff] [blame^] | 80 | SP_BIN_UUID_CANON ${SP_BIN_UUID_CANON} |
Jelle Sels | 0375666 | 2021-05-20 10:41:57 +0200 | [diff] [blame] | 81 | SP_UUID_LE ${SP_UUID_LE} |
| 82 | SP_NAME "spm-test${SP_NUMBER}" |
| 83 | MK_IN ${TS_ROOT}/environments/opteesp/sp.mk.in |
| 84 | DTS_IN ${TS_ROOT}/deployments/spm-test${SP_NUMBER}/opteesp/default_spm_test${SP_NUMBER}.dts.in |
| 85 | JSON_IN ${TS_ROOT}/environments/opteesp/sp_pkg.json.in |
| 86 | ) |