blob: c4ac6bf38d57037261addc7b65dded37b966fd7b [file] [log] [blame]
Julian Hallcaa4af82021-05-19 12:02:36 +01001#-------------------------------------------------------------------------------
Imre Kiseeee9642021-12-17 13:59:46 +01002# Copyright (c) 2021-2022, Arm Limited and Contributors. All rights reserved.
Julian Hallcaa4af82021-05-19 12:02:36 +01003#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6#-------------------------------------------------------------------------------
Balint Dobszay047aea82022-05-16 14:20:53 +02007cmake_minimum_required(VERSION 3.18 FATAL_ERROR)
Gyorgy Szinga365a042021-12-02 01:48:27 +01008
9# Set default platform.
10set(TS_PLATFORM "arm/fvp/fvp_base_revc-2xaemv8a" CACHE STRING "Target platform location.")
Julian Hallcaa4af82021-05-19 12:02:36 +010011include(../../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#-------------------------------------------------------------------------------
19include(${TS_ROOT}/environments/opteesp/env.cmake)
20project(trusted-services LANGUAGES C ASM)
21add_executable(attestation)
22target_include_directories(attestation PRIVATE "${TOP_LEVEL_INCLUDE_DIRS}")
23set(SP_UUID "a1baf155-8876-4695-8f7c-54955e8db974")
Imre Kiseeee9642021-12-17 13:59:46 +010024set(SP_HEAP_SIZE "32 * 1024" CACHE STRING "SP heap size in bytes")
Imre Kis2ccd8e82021-10-08 11:21:14 +020025set(TRACE_PREFIX "ATT" CACHE STRING "Trace prefix")
Julian Hallcaa4af82021-05-19 12:02:36 +010026
Julian Hallcaa4af82021-05-19 12:02:36 +010027#-------------------------------------------------------------------------------
28# Default deployment specific configuration
29#
30#-------------------------------------------------------------------------------
31set(TS_NO_FLOAT_HW ON)
32
33#-------------------------------------------------------------------------------
34# Components that are specific to deployment in the opteesp environment.
35#
36#-------------------------------------------------------------------------------
37add_components(TARGET "attestation"
38 BASE_DIR ${TS_ROOT}
39 COMPONENTS
Julian Hallcaa4af82021-05-19 12:02:36 +010040 "environments/opteesp"
41)
42
Imre Kisd0ed5c22021-12-15 17:05:47 +010043include(../attestation.cmake REQUIRED)
Julian Hallcaa4af82021-05-19 12:02:36 +010044
45#-------------------------------------------------------------------------------
Gyorgy Szinga365a042021-12-02 01:48:27 +010046# Set target platform to provide drivers needed by the deployment
Julian Hallcaa4af82021-05-19 12:02:36 +010047#
48#-------------------------------------------------------------------------------
49add_platform(TARGET "attestation")
50
Julian Hallcaa4af82021-05-19 12:02:36 +010051target_compile_definitions(attestation PRIVATE
52 ARM64=1
53)
54
55target_include_directories(attestation PRIVATE
Julian Hallcaa4af82021-05-19 12:02:36 +010056 ${TS_ROOT}/deployments/attestation/opteesp
57)
58
59if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
60 target_compile_options(attestation PRIVATE
61 -fdiagnostics-show-option
Julian Hallcaa4af82021-05-19 12:02:36 +010062 -gdwarf-2
63 -mstrict-align
64 -O0
Andrew Beggs97a00d42021-06-15 15:45:46 +000065 -std=c99
Julian Hallcaa4af82021-05-19 12:02:36 +010066 )
67
68 # Options for GCC that control linking
69 target_link_options(attestation PRIVATE
Julian Hallcaa4af82021-05-19 12:02:36 +010070 -zmax-page-size=4096
71 )
72 # Options directly for LD, these are not understood by GCC
73 target_link_options(attestation PRIVATE
74 -Wl,--as-needed
75 -Wl,--sort-section=alignment
76 # -Wl,--dynamic-list ${CMAKE_CURRENT_LIST_DIR}/dyn_list
77 )
78endif()
79
80compiler_generate_stripped_elf(TARGET attestation NAME "${SP_UUID}.stripped.elf" RES STRIPPED_ELF)
81
82######################################## install
83if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
84 set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install CACHE PATH "location to install build output to." FORCE)
85endif()
86#TODO: api headers
87
88install(TARGETS attestation
89 PUBLIC_HEADER DESTINATION ${TS_ENV}/include
90 RUNTIME DESTINATION ${TS_ENV}/bin
91 )
92install(FILES ${STRIPPED_ELF} DESTINATION ${TS_ENV}/bin)
93
94get_property(_PROTO_FILES TARGET attestation PROPERTY PROTOBUF_FILES)
95install(FILES ${_PROTO_FILES} DESTINATION ${TS_ENV}/lib/protobuf)
96
Imre Kisa74aaf92021-12-14 17:13:06 +010097include(${TS_ROOT}/tools/cmake/common/ExportSp.cmake)
98export_sp(
99 SP_UUID ${SP_UUID}
100 SP_NAME "attestation"
101 MK_IN ${TS_ROOT}/environments/opteesp/sp.mk.in
102 DTS_IN ${CMAKE_CURRENT_LIST_DIR}/default_attestation.dts.in
103 JSON_IN ${TS_ROOT}/environments/opteesp/sp_pkg.json.in
104)