Julian Hall | 527ddd5 | 2021-06-28 11:57:17 +0100 | [diff] [blame] | 1 | #------------------------------------------------------------------------------- |
Imre Kis | eeee964 | 2021-12-17 13:59:46 +0100 | [diff] [blame] | 2 | # Copyright (c) 2021-2022, Arm Limited and Contributors. All rights reserved. |
Julian Hall | 527ddd5 | 2021-06-28 11:57:17 +0100 | [diff] [blame] | 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # |
| 6 | #------------------------------------------------------------------------------- |
Balint Dobszay | 047aea8 | 2022-05-16 14:20:53 +0200 | [diff] [blame] | 7 | cmake_minimum_required(VERSION 3.18 FATAL_ERROR) |
Gyorgy Szing | a365a04 | 2021-12-02 01:48:27 +0100 | [diff] [blame] | 8 | |
| 9 | # Set default platform. |
| 10 | set(TS_PLATFORM "arm/fvp/fvp_base_revc-2xaemv8a" CACHE STRING "Target platform location.") |
Julian Hall | 527ddd5 | 2021-06-28 11:57:17 +0100 | [diff] [blame] | 11 | include(../../deployment.cmake REQUIRED) |
| 12 | |
| 13 | #------------------------------------------------------------------------------- |
| 14 | # The CMakeLists.txt for building the se-proxy deployment for opteesp |
| 15 | # |
| 16 | # Builds proxy service providers that communicate with a separate secure element |
| 17 | # that hosts a set of service endpoints. This deployment is for running in an |
| 18 | # SEL0 secure partition hosted by OPTEE in the role of SPM. |
| 19 | #------------------------------------------------------------------------------- |
| 20 | include(${TS_ROOT}/environments/opteesp/env.cmake) |
| 21 | project(trusted-services LANGUAGES C ASM) |
| 22 | add_executable(se-proxy) |
| 23 | target_include_directories(se-proxy PRIVATE "${TOP_LEVEL_INCLUDE_DIRS}") |
Balint Dobszay | c9daea9 | 2022-06-15 15:17:11 +0200 | [diff] [blame] | 24 | set(SP_UUID_CANON "46bb39d1-b4d9-45b5-88ff-040027dab249") |
Imre Kis | eeee964 | 2021-12-17 13:59:46 +0100 | [diff] [blame] | 25 | set(SP_HEAP_SIZE "32 * 1024" CACHE STRING "SP heap size in bytes") |
Imre Kis | d0ed5c2 | 2021-12-15 17:05:47 +0100 | [diff] [blame] | 26 | set(TRACE_PREFIX "SEPROXY" CACHE STRING "Trace prefix") |
Jelle Sels | f1cb052 | 2022-06-30 11:31:31 +0200 | [diff] [blame] | 27 | include(${TS_ROOT}/tools/cmake/common/TargetCompileDefinitions.cmake) |
| 28 | set_target_uuids( |
| 29 | SP_UUID ${SP_UUID_CANON} |
| 30 | SP_NAME "se-proxy" |
| 31 | ) |
Julian Hall | 527ddd5 | 2021-06-28 11:57:17 +0100 | [diff] [blame] | 32 | |
| 33 | #------------------------------------------------------------------------------- |
Julian Hall | 527ddd5 | 2021-06-28 11:57:17 +0100 | [diff] [blame] | 34 | # Components that are specific to deployment in the opteesp environment. |
| 35 | # |
| 36 | #------------------------------------------------------------------------------- |
| 37 | add_components(TARGET "se-proxy" |
| 38 | BASE_DIR ${TS_ROOT} |
| 39 | COMPONENTS |
Julian Hall | 527ddd5 | 2021-06-28 11:57:17 +0100 | [diff] [blame] | 40 | "environments/opteesp" |
Julian Hall | 527ddd5 | 2021-06-28 11:57:17 +0100 | [diff] [blame] | 41 | ) |
| 42 | |
Imre Kis | d0ed5c2 | 2021-12-15 17:05:47 +0100 | [diff] [blame] | 43 | include(../se-proxy.cmake REQUIRED) |
Julian Hall | 527ddd5 | 2021-06-28 11:57:17 +0100 | [diff] [blame] | 44 | |
| 45 | #------------------------------------------------------------------------------- |
Gyorgy Szing | a365a04 | 2021-12-02 01:48:27 +0100 | [diff] [blame] | 46 | # Set target platform to provide drivers needed by the deployment |
Julian Hall | 527ddd5 | 2021-06-28 11:57:17 +0100 | [diff] [blame] | 47 | # |
| 48 | #------------------------------------------------------------------------------- |
Julian Hall | 527ddd5 | 2021-06-28 11:57:17 +0100 | [diff] [blame] | 49 | add_platform(TARGET "se-proxy") |
| 50 | |
Julian Hall | 527ddd5 | 2021-06-28 11:57:17 +0100 | [diff] [blame] | 51 | |
| 52 | target_compile_definitions(se-proxy PRIVATE |
| 53 | ARM64=1 |
| 54 | ) |
| 55 | |
| 56 | target_include_directories(se-proxy PRIVATE |
Julian Hall | 527ddd5 | 2021-06-28 11:57:17 +0100 | [diff] [blame] | 57 | ${TS_ROOT}/deployments/se-proxy/opteesp |
| 58 | ) |
| 59 | |
| 60 | if(CMAKE_C_COMPILER_ID STREQUAL "GNU") |
| 61 | target_compile_options(se-proxy PRIVATE |
Julian Hall | 527ddd5 | 2021-06-28 11:57:17 +0100 | [diff] [blame] | 62 | -std=c99 |
| 63 | ) |
| 64 | |
Julian Hall | 527ddd5 | 2021-06-28 11:57:17 +0100 | [diff] [blame] | 65 | endif() |
| 66 | |
Balint Dobszay | c9daea9 | 2022-06-15 15:17:11 +0200 | [diff] [blame] | 67 | compiler_generate_stripped_elf(TARGET se-proxy NAME "${SP_UUID_CANON}.stripped.elf" RES STRIPPED_ELF) |
Julian Hall | 527ddd5 | 2021-06-28 11:57:17 +0100 | [diff] [blame] | 68 | |
| 69 | ######################################## install |
| 70 | if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) |
| 71 | set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install CACHE PATH "location to install build output to." FORCE) |
| 72 | endif() |
| 73 | #TODO: api headers |
| 74 | |
| 75 | install(TARGETS se-proxy |
| 76 | PUBLIC_HEADER DESTINATION ${TS_ENV}/include |
| 77 | RUNTIME DESTINATION ${TS_ENV}/bin |
| 78 | ) |
| 79 | install(FILES ${STRIPPED_ELF} DESTINATION ${TS_ENV}/bin) |
| 80 | |
| 81 | get_property(_PROTO_FILES TARGET se-proxy PROPERTY PROTOBUF_FILES) |
| 82 | install(FILES ${_PROTO_FILES} DESTINATION ${TS_ENV}/lib/protobuf) |
| 83 | |
Imre Kis | a74aaf9 | 2021-12-14 17:13:06 +0100 | [diff] [blame] | 84 | include(${TS_ROOT}/tools/cmake/common/ExportSp.cmake) |
| 85 | export_sp( |
Balint Dobszay | c9daea9 | 2022-06-15 15:17:11 +0200 | [diff] [blame] | 86 | SP_UUID_CANON ${SP_UUID_CANON} |
| 87 | SP_UUID_LE ${SP_UUID_LE} |
Imre Kis | a74aaf9 | 2021-12-14 17:13:06 +0100 | [diff] [blame] | 88 | SP_NAME "se-proxy" |
| 89 | MK_IN ${TS_ROOT}/environments/opteesp/sp.mk.in |
| 90 | DTS_IN ${CMAKE_CURRENT_LIST_DIR}/default_se-proxy.dts.in |
| 91 | JSON_IN ${TS_ROOT}/environments/opteesp/sp_pkg.json.in |
| 92 | ) |