Julian Hall | caa4af8 | 2021-05-19 12:02:36 +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 | caa4af8 | 2021-05-19 12:02:36 +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 | caa4af8 | 2021-05-19 12:02:36 +0100 | [diff] [blame] | 11 | include(../../deployment.cmake REQUIRED) |
| 12 | |
| 13 | #------------------------------------------------------------------------------- |
| 14 | # The CMakeLists.txt for building the attestation deployment for opteesp |
| 15 | # |
| 16 | # Builds the attestation service provider for running in an SEL0 secure partition |
| 17 | # hosted by OPTEE in the role of SPM. |
| 18 | #------------------------------------------------------------------------------- |
| 19 | include(${TS_ROOT}/environments/opteesp/env.cmake) |
| 20 | project(trusted-services LANGUAGES C ASM) |
| 21 | add_executable(attestation) |
| 22 | target_include_directories(attestation PRIVATE "${TOP_LEVEL_INCLUDE_DIRS}") |
Balint Dobszay | c9daea9 | 2022-06-15 15:17:11 +0200 | [diff] [blame] | 23 | set(SP_UUID_CANON "a1baf155-8876-4695-8f7c-54955e8db974") |
Imre Kis | eeee964 | 2021-12-17 13:59:46 +0100 | [diff] [blame] | 24 | set(SP_HEAP_SIZE "32 * 1024" CACHE STRING "SP heap size in bytes") |
Imre Kis | 2ccd8e8 | 2021-10-08 11:21:14 +0200 | [diff] [blame] | 25 | set(TRACE_PREFIX "ATT" CACHE STRING "Trace prefix") |
Jelle Sels | f1cb052 | 2022-06-30 11:31:31 +0200 | [diff] [blame] | 26 | include(${TS_ROOT}/tools/cmake/common/TargetCompileDefinitions.cmake) |
| 27 | set_target_uuids( |
| 28 | SP_UUID ${SP_UUID_CANON} |
| 29 | SP_NAME "attestation" |
| 30 | ) |
Julian Hall | caa4af8 | 2021-05-19 12:02:36 +0100 | [diff] [blame] | 31 | |
Julian Hall | caa4af8 | 2021-05-19 12:02:36 +0100 | [diff] [blame] | 32 | #------------------------------------------------------------------------------- |
| 33 | # Default deployment specific configuration |
| 34 | # |
| 35 | #------------------------------------------------------------------------------- |
| 36 | set(TS_NO_FLOAT_HW ON) |
| 37 | |
| 38 | #------------------------------------------------------------------------------- |
| 39 | # Components that are specific to deployment in the opteesp environment. |
| 40 | # |
| 41 | #------------------------------------------------------------------------------- |
| 42 | add_components(TARGET "attestation" |
| 43 | BASE_DIR ${TS_ROOT} |
| 44 | COMPONENTS |
Julian Hall | caa4af8 | 2021-05-19 12:02:36 +0100 | [diff] [blame] | 45 | "environments/opteesp" |
| 46 | ) |
| 47 | |
Imre Kis | d0ed5c2 | 2021-12-15 17:05:47 +0100 | [diff] [blame] | 48 | include(../attestation.cmake REQUIRED) |
Julian Hall | caa4af8 | 2021-05-19 12:02:36 +0100 | [diff] [blame] | 49 | |
| 50 | #------------------------------------------------------------------------------- |
Gyorgy Szing | a365a04 | 2021-12-02 01:48:27 +0100 | [diff] [blame] | 51 | # Set target platform to provide drivers needed by the deployment |
Julian Hall | caa4af8 | 2021-05-19 12:02:36 +0100 | [diff] [blame] | 52 | # |
| 53 | #------------------------------------------------------------------------------- |
| 54 | add_platform(TARGET "attestation") |
| 55 | |
Julian Hall | caa4af8 | 2021-05-19 12:02:36 +0100 | [diff] [blame] | 56 | target_compile_definitions(attestation PRIVATE |
| 57 | ARM64=1 |
| 58 | ) |
| 59 | |
| 60 | target_include_directories(attestation PRIVATE |
Julian Hall | caa4af8 | 2021-05-19 12:02:36 +0100 | [diff] [blame] | 61 | ${TS_ROOT}/deployments/attestation/opteesp |
| 62 | ) |
| 63 | |
| 64 | if(CMAKE_C_COMPILER_ID STREQUAL "GNU") |
| 65 | target_compile_options(attestation PRIVATE |
Andrew Beggs | 97a00d4 | 2021-06-15 15:45:46 +0000 | [diff] [blame] | 66 | -std=c99 |
Julian Hall | caa4af8 | 2021-05-19 12:02:36 +0100 | [diff] [blame] | 67 | ) |
| 68 | |
Julian Hall | caa4af8 | 2021-05-19 12:02:36 +0100 | [diff] [blame] | 69 | endif() |
| 70 | |
Balint Dobszay | c9daea9 | 2022-06-15 15:17:11 +0200 | [diff] [blame] | 71 | compiler_generate_stripped_elf(TARGET attestation NAME "${SP_UUID_CANON}.stripped.elf" RES STRIPPED_ELF) |
Julian Hall | caa4af8 | 2021-05-19 12:02:36 +0100 | [diff] [blame] | 72 | |
| 73 | ######################################## install |
| 74 | if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) |
| 75 | set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install CACHE PATH "location to install build output to." FORCE) |
| 76 | endif() |
| 77 | #TODO: api headers |
| 78 | |
| 79 | install(TARGETS attestation |
| 80 | PUBLIC_HEADER DESTINATION ${TS_ENV}/include |
| 81 | RUNTIME DESTINATION ${TS_ENV}/bin |
| 82 | ) |
| 83 | install(FILES ${STRIPPED_ELF} DESTINATION ${TS_ENV}/bin) |
| 84 | |
| 85 | get_property(_PROTO_FILES TARGET attestation PROPERTY PROTOBUF_FILES) |
| 86 | install(FILES ${_PROTO_FILES} DESTINATION ${TS_ENV}/lib/protobuf) |
| 87 | |
Imre Kis | a74aaf9 | 2021-12-14 17:13:06 +0100 | [diff] [blame] | 88 | include(${TS_ROOT}/tools/cmake/common/ExportSp.cmake) |
| 89 | export_sp( |
Balint Dobszay | c9daea9 | 2022-06-15 15:17:11 +0200 | [diff] [blame] | 90 | SP_UUID_CANON ${SP_UUID_CANON} |
| 91 | SP_UUID_LE ${SP_UUID_LE} |
Imre Kis | a74aaf9 | 2021-12-14 17:13:06 +0100 | [diff] [blame] | 92 | SP_NAME "attestation" |
| 93 | MK_IN ${TS_ROOT}/environments/opteesp/sp.mk.in |
| 94 | DTS_IN ${CMAKE_CURRENT_LIST_DIR}/default_attestation.dts.in |
| 95 | JSON_IN ${TS_ROOT}/environments/opteesp/sp_pkg.json.in |
| 96 | ) |