blob: 78f288cbc490134ce3a0593e4e81fc22eed1a61f [file] [log] [blame]
Imre Kis840ded22022-01-13 15:32:01 +01001#-------------------------------------------------------------------------------
2# Copyright (c) 2021-2022, Arm Limited and Contributors. All rights reserved.
3#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6#-------------------------------------------------------------------------------
7cmake_minimum_required(VERSION 3.18)
8
9# Set default platform.
10set(TS_PLATFORM "arm/fvp/fvp_base_revc-2xaemv8a" CACHE STRING "Target platform location.")
11include(../../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#-------------------------------------------------------------------------------
20include(${TS_ROOT}/environments/sp/env.cmake)
21set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Build type")
22project(trusted-services LANGUAGES C ASM)
23add_executable(attestation)
24target_include_directories(attestation PRIVATE "${TOP_LEVEL_INCLUDE_DIRS}")
25set(SP_NAME "attestation")
26set(SP_UUID "a1baf155-8876-4695-8f7c-54955e8db974")
27set(TRACE_PREFIX "ATT" CACHE STRING "Trace prefix")
28set(SP_STACK_SIZE "64 * 1024" CACHE STRING "Stack size")
29set(SP_HEAP_SIZE "32 * 1024" CACHE STRING "Heap size")
30
31#-------------------------------------------------------------------------------
32# Default deployment specific configuration
33#
34#-------------------------------------------------------------------------------
35set(TS_NO_FLOAT_HW ON)
36
37#-------------------------------------------------------------------------------
38# Components that are specific to deployment in the sp environment.
39#
40#-------------------------------------------------------------------------------
41add_components(TARGET "attestation"
42 BASE_DIR ${TS_ROOT}
43 COMPONENTS
44 environments/sp
45)
46
47include(../attestation.cmake REQUIRED)
48
49#-------------------------------------------------------------------------------
50# Set target platform to provide drivers needed by the deployment
51#
52#-------------------------------------------------------------------------------
53add_platform(TARGET "attestation")
54
55target_compile_definitions(attestation PRIVATE
56 ARM64=1
57)
58
59if(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 )
76endif()
77
78compiler_generate_binary_output(TARGET attestation NAME "${SP_UUID}.bin" SP_BINARY)
79install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${SP_UUID}.bin DESTINATION ${TS_ENV}/bin)
80
81include(${TS_ROOT}/tools/cmake/common/ExportMemoryRegionsToManifest.cmake REQUIRED)
82export_memory_regions_to_manifest(TARGET attestation NAME "${SP_UUID}_memory_regions.dtsi" RES EXPORT_MEMORY_REGIONS_DTSI)
83
84######################################## install
85if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
86 set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install CACHE PATH "location to install build output to." FORCE)
87endif()
88install(TARGETS attestation
89 PUBLIC_HEADER DESTINATION ${TS_ENV}/include
90 RUNTIME DESTINATION ${TS_ENV}/bin
91 )
92
93include(${TS_ROOT}/tools/cmake/common/ExportSp.cmake)
94export_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)