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") |
| 25 | set(SP_UUID_LE "0xd139bb46 0xb545d9b4 0x0004ff88 0x49b2da27") |
Imre Kis | eeee964 | 2021-12-17 13:59:46 +0100 | [diff] [blame] | 26 | 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] | 27 | set(TRACE_PREFIX "SEPROXY" CACHE STRING "Trace prefix") |
Julian Hall | 527ddd5 | 2021-06-28 11:57:17 +0100 | [diff] [blame] | 28 | |
| 29 | #------------------------------------------------------------------------------- |
Julian Hall | 527ddd5 | 2021-06-28 11:57:17 +0100 | [diff] [blame] | 30 | # Components that are specific to deployment in the opteesp environment. |
| 31 | # |
| 32 | #------------------------------------------------------------------------------- |
| 33 | add_components(TARGET "se-proxy" |
| 34 | BASE_DIR ${TS_ROOT} |
| 35 | COMPONENTS |
Julian Hall | 527ddd5 | 2021-06-28 11:57:17 +0100 | [diff] [blame] | 36 | "environments/opteesp" |
Julian Hall | 527ddd5 | 2021-06-28 11:57:17 +0100 | [diff] [blame] | 37 | ) |
| 38 | |
Imre Kis | d0ed5c2 | 2021-12-15 17:05:47 +0100 | [diff] [blame] | 39 | include(../se-proxy.cmake REQUIRED) |
Julian Hall | 527ddd5 | 2021-06-28 11:57:17 +0100 | [diff] [blame] | 40 | |
| 41 | #------------------------------------------------------------------------------- |
Gyorgy Szing | a365a04 | 2021-12-02 01:48:27 +0100 | [diff] [blame] | 42 | # Set target platform to provide drivers needed by the deployment |
Julian Hall | 527ddd5 | 2021-06-28 11:57:17 +0100 | [diff] [blame] | 43 | # |
| 44 | #------------------------------------------------------------------------------- |
Julian Hall | 527ddd5 | 2021-06-28 11:57:17 +0100 | [diff] [blame] | 45 | add_platform(TARGET "se-proxy") |
| 46 | |
Julian Hall | 527ddd5 | 2021-06-28 11:57:17 +0100 | [diff] [blame] | 47 | |
| 48 | target_compile_definitions(se-proxy PRIVATE |
| 49 | ARM64=1 |
| 50 | ) |
| 51 | |
| 52 | target_include_directories(se-proxy PRIVATE |
Julian Hall | 527ddd5 | 2021-06-28 11:57:17 +0100 | [diff] [blame] | 53 | ${TS_ROOT}/deployments/se-proxy/opteesp |
| 54 | ) |
| 55 | |
| 56 | if(CMAKE_C_COMPILER_ID STREQUAL "GNU") |
| 57 | target_compile_options(se-proxy PRIVATE |
| 58 | -fdiagnostics-show-option |
| 59 | -gdwarf-2 |
| 60 | -mstrict-align |
| 61 | -O0 |
| 62 | -std=c99 |
| 63 | ) |
| 64 | |
| 65 | # Options for GCC that control linking |
| 66 | target_link_options(se-proxy PRIVATE |
| 67 | -zmax-page-size=4096 |
| 68 | ) |
| 69 | # Options directly for LD, these are not understood by GCC |
| 70 | target_link_options(se-proxy PRIVATE |
| 71 | -Wl,--as-needed |
| 72 | -Wl,--sort-section=alignment |
| 73 | # -Wl,--dynamic-list ${CMAKE_CURRENT_LIST_DIR}/dyn_list |
| 74 | ) |
| 75 | endif() |
| 76 | |
Balint Dobszay | c9daea9 | 2022-06-15 15:17:11 +0200 | [diff] [blame] | 77 | 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] | 78 | |
| 79 | ######################################## install |
| 80 | if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) |
| 81 | set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install CACHE PATH "location to install build output to." FORCE) |
| 82 | endif() |
| 83 | #TODO: api headers |
| 84 | |
| 85 | install(TARGETS se-proxy |
| 86 | PUBLIC_HEADER DESTINATION ${TS_ENV}/include |
| 87 | RUNTIME DESTINATION ${TS_ENV}/bin |
| 88 | ) |
| 89 | install(FILES ${STRIPPED_ELF} DESTINATION ${TS_ENV}/bin) |
| 90 | |
| 91 | get_property(_PROTO_FILES TARGET se-proxy PROPERTY PROTOBUF_FILES) |
| 92 | install(FILES ${_PROTO_FILES} DESTINATION ${TS_ENV}/lib/protobuf) |
| 93 | |
Imre Kis | a74aaf9 | 2021-12-14 17:13:06 +0100 | [diff] [blame] | 94 | include(${TS_ROOT}/tools/cmake/common/ExportSp.cmake) |
| 95 | export_sp( |
Balint Dobszay | c9daea9 | 2022-06-15 15:17:11 +0200 | [diff] [blame] | 96 | SP_UUID_CANON ${SP_UUID_CANON} |
| 97 | SP_UUID_LE ${SP_UUID_LE} |
Imre Kis | a74aaf9 | 2021-12-14 17:13:06 +0100 | [diff] [blame] | 98 | SP_NAME "se-proxy" |
| 99 | MK_IN ${TS_ROOT}/environments/opteesp/sp.mk.in |
| 100 | DTS_IN ${CMAKE_CURRENT_LIST_DIR}/default_se-proxy.dts.in |
| 101 | JSON_IN ${TS_ROOT}/environments/opteesp/sp_pkg.json.in |
| 102 | ) |