Imre Kis | 840ded2 | 2022-01-13 15:32:01 +0100 | [diff] [blame^] | 1 | #------------------------------------------------------------------------------- |
| 2 | # Copyright (c) 2021-2022, Arm Limited and Contributors. All rights reserved. |
| 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # |
| 6 | #------------------------------------------------------------------------------- |
| 7 | cmake_minimum_required(VERSION 3.18) |
| 8 | |
| 9 | # Set default platform. |
| 10 | set(TS_PLATFORM "arm/fvp/fvp_base_revc-2xaemv8a" CACHE STRING "Target platform location.") |
| 11 | include(../../deployment.cmake REQUIRED) |
| 12 | |
| 13 | #------------------------------------------------------------------------------- |
| 14 | # The CMakeLists.txt for building the attestation deployment for generic sp |
| 15 | # environment. |
| 16 | # |
| 17 | # Builds the attestation service provider for running in an SEL0 secure |
| 18 | # partition hosted by any SPM. |
| 19 | #------------------------------------------------------------------------------- |
| 20 | include(${TS_ROOT}/environments/sp/env.cmake) |
| 21 | set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Build type") |
| 22 | project(trusted-services LANGUAGES C ASM) |
| 23 | add_executable(attestation) |
| 24 | target_include_directories(attestation PRIVATE "${TOP_LEVEL_INCLUDE_DIRS}") |
| 25 | set(SP_NAME "attestation") |
| 26 | set(SP_UUID "a1baf155-8876-4695-8f7c-54955e8db974") |
| 27 | set(TRACE_PREFIX "ATT" CACHE STRING "Trace prefix") |
| 28 | set(SP_STACK_SIZE "64 * 1024" CACHE STRING "Stack size") |
| 29 | set(SP_HEAP_SIZE "32 * 1024" CACHE STRING "Heap size") |
| 30 | |
| 31 | #------------------------------------------------------------------------------- |
| 32 | # Default deployment specific configuration |
| 33 | # |
| 34 | #------------------------------------------------------------------------------- |
| 35 | set(TS_NO_FLOAT_HW ON) |
| 36 | |
| 37 | #------------------------------------------------------------------------------- |
| 38 | # Components that are specific to deployment in the sp environment. |
| 39 | # |
| 40 | #------------------------------------------------------------------------------- |
| 41 | add_components(TARGET "attestation" |
| 42 | BASE_DIR ${TS_ROOT} |
| 43 | COMPONENTS |
| 44 | environments/sp |
| 45 | ) |
| 46 | |
| 47 | include(../attestation.cmake REQUIRED) |
| 48 | |
| 49 | #------------------------------------------------------------------------------- |
| 50 | # Set target platform to provide drivers needed by the deployment |
| 51 | # |
| 52 | #------------------------------------------------------------------------------- |
| 53 | add_platform(TARGET "attestation") |
| 54 | |
| 55 | target_compile_definitions(attestation PRIVATE |
| 56 | ARM64=1 |
| 57 | ) |
| 58 | |
| 59 | if(CMAKE_C_COMPILER_ID STREQUAL "GNU") |
| 60 | target_compile_options(attestation PRIVATE |
| 61 | -fdiagnostics-show-option |
| 62 | -gdwarf-2 |
| 63 | -mstrict-align |
| 64 | -std=c99 |
| 65 | ) |
| 66 | |
| 67 | # Options for GCC that control linking |
| 68 | target_link_options(attestation PRIVATE |
| 69 | -zmax-page-size=4096 |
| 70 | ) |
| 71 | # Options directly for LD, these are not understood by GCC |
| 72 | target_link_options(attestation PRIVATE |
| 73 | -Wl,--as-needed |
| 74 | -Wl,--sort-section=alignment |
| 75 | ) |
| 76 | endif() |
| 77 | |
| 78 | compiler_generate_binary_output(TARGET attestation NAME "${SP_UUID}.bin" SP_BINARY) |
| 79 | install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${SP_UUID}.bin DESTINATION ${TS_ENV}/bin) |
| 80 | |
| 81 | include(${TS_ROOT}/tools/cmake/common/ExportMemoryRegionsToManifest.cmake REQUIRED) |
| 82 | export_memory_regions_to_manifest(TARGET attestation NAME "${SP_UUID}_memory_regions.dtsi" RES EXPORT_MEMORY_REGIONS_DTSI) |
| 83 | |
| 84 | ######################################## install |
| 85 | if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) |
| 86 | set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install CACHE PATH "location to install build output to." FORCE) |
| 87 | endif() |
| 88 | install(TARGETS attestation |
| 89 | PUBLIC_HEADER DESTINATION ${TS_ENV}/include |
| 90 | RUNTIME DESTINATION ${TS_ENV}/bin |
| 91 | ) |
| 92 | |
| 93 | include(${TS_ROOT}/tools/cmake/common/ExportSp.cmake) |
| 94 | export_sp( |
| 95 | SP_UUID ${SP_UUID} |
| 96 | SP_NAME ${SP_NAME} |
| 97 | DTS_IN ${CMAKE_CURRENT_LIST_DIR}/default_${SP_NAME}.dts.in |
| 98 | DTS_MEM_REGIONS ${SP_UUID}_memory_regions.dtsi |
| 99 | JSON_IN ${TS_ROOT}/environments/sp/sp_pkg.json.in |
| 100 | ) |