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 | #------------------------------------------------------------------------------- |
| 7 | cmake_minimum_required(VERSION 3.16) |
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}") |
| 24 | set(SP_UUID "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") |
Julian Hall | 527ddd5 | 2021-06-28 11:57:17 +0100 | [diff] [blame] | 26 | |
| 27 | #------------------------------------------------------------------------------- |
Julian Hall | 527ddd5 | 2021-06-28 11:57:17 +0100 | [diff] [blame] | 28 | # Components that are specific to deployment in the opteesp environment. |
| 29 | # |
| 30 | #------------------------------------------------------------------------------- |
| 31 | add_components(TARGET "se-proxy" |
| 32 | BASE_DIR ${TS_ROOT} |
| 33 | COMPONENTS |
Balint Dobszay | 286ff75 | 2022-03-04 15:57:19 +0100 | [diff] [blame] | 34 | "components/common/fdt" |
Imre Kis | 2ccd8e8 | 2021-10-08 11:21:14 +0200 | [diff] [blame] | 35 | "components/common/trace" |
| 36 | "components/common/utils" |
Julian Hall | 527ddd5 | 2021-06-28 11:57:17 +0100 | [diff] [blame] | 37 | "protocols/rpc/common/packed-c" |
| 38 | "protocols/service/secure_storage/packed-c" |
| 39 | "protocols/service/crypto/protobuf" |
| 40 | "environments/opteesp" |
| 41 | "components/common/tlv" |
| 42 | "components/config/ramstore" |
| 43 | "components/config/loader/sp" |
| 44 | "components/messaging/ffa/libsp" |
| 45 | "components/rpc/ffarpc/endpoint" |
| 46 | "components/rpc/common/interface" |
| 47 | "components/rpc/common/demux" |
| 48 | "components/service/common/include" |
| 49 | "components/service/common/serializer/protobuf" |
Julian Hall | 628be29 | 2021-08-04 16:57:40 +0100 | [diff] [blame] | 50 | "components/service/common/client" |
Julian Hall | 527ddd5 | 2021-06-28 11:57:17 +0100 | [diff] [blame] | 51 | "components/service/common/provider" |
Julian Hall | 3e61454 | 2021-07-29 11:47:47 +0100 | [diff] [blame] | 52 | "components/service/discovery/provider" |
| 53 | "components/service/discovery/provider/serializer/packed-c" |
Julian Hall | 628be29 | 2021-08-04 16:57:40 +0100 | [diff] [blame] | 54 | "components/service/crypto/include" |
Julian Hall | 9061e6c | 2021-06-29 14:24:20 +0100 | [diff] [blame] | 55 | "components/service/crypto/provider" |
Julian Hall | 527ddd5 | 2021-06-28 11:57:17 +0100 | [diff] [blame] | 56 | "components/service/crypto/provider/serializer/protobuf" |
| 57 | "components/service/crypto/provider/serializer/packed-c" |
Julian Hall | 7bfb18e | 2021-07-13 15:48:13 +0100 | [diff] [blame] | 58 | "components/service/crypto/provider/extension/hash" |
| 59 | "components/service/crypto/provider/extension/hash/serializer/packed-c" |
Julian Hall | e7bccbe | 2021-07-16 09:50:34 +0100 | [diff] [blame] | 60 | "components/service/crypto/provider/extension/cipher" |
| 61 | "components/service/crypto/provider/extension/cipher/serializer/packed-c" |
Julian Hall | fe487b7 | 2021-07-19 10:29:59 +0100 | [diff] [blame] | 62 | "components/service/crypto/provider/extension/key_derivation" |
| 63 | "components/service/crypto/provider/extension/key_derivation/serializer/packed-c" |
Julian Hall | a6d3cbc | 2021-07-20 10:13:21 +0100 | [diff] [blame] | 64 | "components/service/crypto/provider/extension/mac" |
| 65 | "components/service/crypto/provider/extension/mac/serializer/packed-c" |
Julian Hall | 7bfb18e | 2021-07-13 15:48:13 +0100 | [diff] [blame] | 66 | "components/service/crypto/factory/full" |
Julian Hall | 527ddd5 | 2021-06-28 11:57:17 +0100 | [diff] [blame] | 67 | "components/service/secure_storage/include" |
| 68 | "components/service/secure_storage/frontend/secure_storage_provider" |
| 69 | "components/service/attestation/include" |
| 70 | "components/service/attestation/provider" |
| 71 | "components/service/attestation/provider/serializer/packed-c" |
| 72 | |
Julian Hall | 628be29 | 2021-08-04 16:57:40 +0100 | [diff] [blame] | 73 | # Stub service provider backends |
| 74 | "components/rpc/dummy" |
| 75 | "components/rpc/common/caller" |
| 76 | "components/service/attestation/reporter/stub" |
| 77 | "components/service/attestation/key_mngr/stub" |
| 78 | "components/service/crypto/backend/stub" |
| 79 | "components/service/crypto/client/psa" |
| 80 | "components/service/secure_storage/backend/mock_store" |
Julian Hall | 527ddd5 | 2021-06-28 11:57:17 +0100 | [diff] [blame] | 81 | ) |
| 82 | |
| 83 | target_sources(se-proxy PRIVATE |
| 84 | se_proxy_sp.c |
| 85 | service_proxy_factory.c |
| 86 | ) |
| 87 | |
| 88 | #------------------------------------------------------------------------------- |
Gyorgy Szing | a365a04 | 2021-12-02 01:48:27 +0100 | [diff] [blame] | 89 | # Set target platform to provide drivers needed by the deployment |
Julian Hall | 527ddd5 | 2021-06-28 11:57:17 +0100 | [diff] [blame] | 90 | # |
| 91 | #------------------------------------------------------------------------------- |
Julian Hall | 527ddd5 | 2021-06-28 11:57:17 +0100 | [diff] [blame] | 92 | add_platform(TARGET "se-proxy") |
| 93 | |
| 94 | #------------------------------------------------------------------------------- |
| 95 | # Components used from external projects |
| 96 | # |
| 97 | #------------------------------------------------------------------------------- |
| 98 | |
Imre Kis | 23583e3 | 2021-10-22 14:54:51 +0200 | [diff] [blame] | 99 | # Get libc include dir |
| 100 | get_property(LIBC_INCLUDE_PATH TARGET c PROPERTY INTERFACE_INCLUDE_DIRECTORIES) |
| 101 | |
Julian Hall | 527ddd5 | 2021-06-28 11:57:17 +0100 | [diff] [blame] | 102 | # Nanopb |
Imre Kis | 23583e3 | 2021-10-22 14:54:51 +0200 | [diff] [blame] | 103 | list(APPEND NANOPB_EXTERNAL_INCLUDE_PATHS ${LIBC_INCLUDE_PATH}) |
Julian Hall | 527ddd5 | 2021-06-28 11:57:17 +0100 | [diff] [blame] | 104 | include(../../../external/nanopb/nanopb.cmake) |
| 105 | target_link_libraries(se-proxy PRIVATE nanopb::protobuf-nanopb-static) |
| 106 | protobuf_generate_all(TGT "se-proxy" NAMESPACE "protobuf" BASE_DIR "${TS_ROOT}/protocols") |
| 107 | |
Julian Hall | 527ddd5 | 2021-06-28 11:57:17 +0100 | [diff] [blame] | 108 | ################################################################# |
| 109 | |
| 110 | target_compile_definitions(se-proxy PRIVATE |
| 111 | ARM64=1 |
| 112 | ) |
| 113 | |
| 114 | target_include_directories(se-proxy PRIVATE |
| 115 | ${TS_ROOT} |
| 116 | ${TS_ROOT}/components |
| 117 | ${TS_ROOT}/deployments/se-proxy/opteesp |
| 118 | ) |
| 119 | |
| 120 | if(CMAKE_C_COMPILER_ID STREQUAL "GNU") |
| 121 | target_compile_options(se-proxy PRIVATE |
| 122 | -fdiagnostics-show-option |
| 123 | -gdwarf-2 |
| 124 | -mstrict-align |
| 125 | -O0 |
| 126 | -std=c99 |
| 127 | ) |
| 128 | |
| 129 | # Options for GCC that control linking |
| 130 | target_link_options(se-proxy PRIVATE |
| 131 | -zmax-page-size=4096 |
| 132 | ) |
| 133 | # Options directly for LD, these are not understood by GCC |
| 134 | target_link_options(se-proxy PRIVATE |
| 135 | -Wl,--as-needed |
| 136 | -Wl,--sort-section=alignment |
| 137 | # -Wl,--dynamic-list ${CMAKE_CURRENT_LIST_DIR}/dyn_list |
| 138 | ) |
| 139 | endif() |
| 140 | |
| 141 | compiler_generate_stripped_elf(TARGET se-proxy NAME "${SP_UUID}.stripped.elf" RES STRIPPED_ELF) |
| 142 | |
| 143 | ######################################## install |
| 144 | if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) |
| 145 | set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install CACHE PATH "location to install build output to." FORCE) |
| 146 | endif() |
| 147 | #TODO: api headers |
| 148 | |
| 149 | install(TARGETS se-proxy |
| 150 | PUBLIC_HEADER DESTINATION ${TS_ENV}/include |
| 151 | RUNTIME DESTINATION ${TS_ENV}/bin |
| 152 | ) |
| 153 | install(FILES ${STRIPPED_ELF} DESTINATION ${TS_ENV}/bin) |
| 154 | |
| 155 | get_property(_PROTO_FILES TARGET se-proxy PROPERTY PROTOBUF_FILES) |
| 156 | install(FILES ${_PROTO_FILES} DESTINATION ${TS_ENV}/lib/protobuf) |
| 157 | |
Imre Kis | a74aaf9 | 2021-12-14 17:13:06 +0100 | [diff] [blame^] | 158 | include(${TS_ROOT}/tools/cmake/common/ExportSp.cmake) |
| 159 | export_sp( |
| 160 | SP_UUID ${SP_UUID} |
| 161 | SP_NAME "se-proxy" |
| 162 | MK_IN ${TS_ROOT}/environments/opteesp/sp.mk.in |
| 163 | DTS_IN ${CMAKE_CURRENT_LIST_DIR}/default_se-proxy.dts.in |
| 164 | JSON_IN ${TS_ROOT}/environments/opteesp/sp_pkg.json.in |
| 165 | ) |