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 | #------------------------------------------------------------------------------- |
Balint Dobszay | 047aea8 | 2022-05-16 14:20:53 +0200 | [diff] [blame] | 7 | cmake_minimum_required(VERSION 3.18 FATAL_ERROR) |
Imre Kis | 840ded2 | 2022-01-13 15:32:01 +0100 | [diff] [blame] | 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") |
Balint Dobszay | c9daea9 | 2022-06-15 15:17:11 +0200 | [diff] [blame] | 26 | set(SP_UUID_CANON "a1baf155-8876-4695-8f7c-54955e8db974") |
| 27 | set(SP_UUID_LE "0x55f1baa1 0x95467688 0x95547c8f 0x74b98d5e") |
Imre Kis | 840ded2 | 2022-01-13 15:32:01 +0100 | [diff] [blame] | 28 | set(TRACE_PREFIX "ATT" CACHE STRING "Trace prefix") |
| 29 | set(SP_STACK_SIZE "64 * 1024" CACHE STRING "Stack size") |
| 30 | set(SP_HEAP_SIZE "32 * 1024" CACHE STRING "Heap size") |
| 31 | |
| 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 sp environment. |
| 40 | # |
| 41 | #------------------------------------------------------------------------------- |
| 42 | add_components(TARGET "attestation" |
| 43 | BASE_DIR ${TS_ROOT} |
| 44 | COMPONENTS |
| 45 | environments/sp |
| 46 | ) |
| 47 | |
| 48 | include(../attestation.cmake REQUIRED) |
| 49 | |
| 50 | #------------------------------------------------------------------------------- |
| 51 | # Set target platform to provide drivers needed by the deployment |
| 52 | # |
| 53 | #------------------------------------------------------------------------------- |
| 54 | add_platform(TARGET "attestation") |
| 55 | |
| 56 | target_compile_definitions(attestation PRIVATE |
| 57 | ARM64=1 |
| 58 | ) |
| 59 | |
| 60 | if(CMAKE_C_COMPILER_ID STREQUAL "GNU") |
| 61 | target_compile_options(attestation PRIVATE |
Imre Kis | 840ded2 | 2022-01-13 15:32:01 +0100 | [diff] [blame] | 62 | -std=c99 |
| 63 | ) |
| 64 | |
Imre Kis | 840ded2 | 2022-01-13 15:32:01 +0100 | [diff] [blame] | 65 | endif() |
| 66 | |
Balint Dobszay | c9daea9 | 2022-06-15 15:17:11 +0200 | [diff] [blame] | 67 | compiler_generate_binary_output(TARGET attestation NAME "${SP_UUID_CANON}.bin" SP_BINARY) |
| 68 | install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${SP_UUID_CANON}.bin DESTINATION ${TS_ENV}/bin) |
Imre Kis | 840ded2 | 2022-01-13 15:32:01 +0100 | [diff] [blame] | 69 | |
| 70 | include(${TS_ROOT}/tools/cmake/common/ExportMemoryRegionsToManifest.cmake REQUIRED) |
Balint Dobszay | c9daea9 | 2022-06-15 15:17:11 +0200 | [diff] [blame] | 71 | export_memory_regions_to_manifest(TARGET attestation NAME "${SP_UUID_CANON}_memory_regions.dtsi" RES EXPORT_MEMORY_REGIONS_DTSI) |
Imre Kis | 840ded2 | 2022-01-13 15:32:01 +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 | install(TARGETS attestation |
| 78 | PUBLIC_HEADER DESTINATION ${TS_ENV}/include |
| 79 | RUNTIME DESTINATION ${TS_ENV}/bin |
| 80 | ) |
| 81 | |
| 82 | include(${TS_ROOT}/tools/cmake/common/ExportSp.cmake) |
| 83 | export_sp( |
Balint Dobszay | c9daea9 | 2022-06-15 15:17:11 +0200 | [diff] [blame] | 84 | SP_UUID_CANON ${SP_UUID_CANON} |
| 85 | SP_UUID_LE ${SP_UUID_LE} |
Imre Kis | 840ded2 | 2022-01-13 15:32:01 +0100 | [diff] [blame] | 86 | SP_NAME ${SP_NAME} |
| 87 | DTS_IN ${CMAKE_CURRENT_LIST_DIR}/default_${SP_NAME}.dts.in |
Balint Dobszay | c9daea9 | 2022-06-15 15:17:11 +0200 | [diff] [blame] | 88 | DTS_MEM_REGIONS ${SP_UUID_CANON}_memory_regions.dtsi |
Imre Kis | 840ded2 | 2022-01-13 15:32:01 +0100 | [diff] [blame] | 89 | JSON_IN ${TS_ROOT}/environments/sp/sp_pkg.json.in |
| 90 | ) |