blob: ef86ef3e8ec218ee50e70df4478660adf6fc4c6e [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}")
Balint Dobszayc9daea92022-06-15 15:17:11 +020023set(SP_UUID_CANON "a1baf155-8876-4695-8f7c-54955e8db974")
24set(SP_UUID_LE "0x55f1baa1 0x95467688 0x95547c8f 0x74b98d5e")
Imre Kiseeee9642021-12-17 13:59:46 +010025set(SP_HEAP_SIZE "32 * 1024" CACHE STRING "SP heap size in bytes")
Imre Kis2ccd8e82021-10-08 11:21:14 +020026set(TRACE_PREFIX "ATT" CACHE STRING "Trace prefix")
Julian Hallcaa4af82021-05-19 12:02:36 +010027
Julian Hallcaa4af82021-05-19 12:02:36 +010028#-------------------------------------------------------------------------------
29# Default deployment specific configuration
30#
31#-------------------------------------------------------------------------------
32set(TS_NO_FLOAT_HW ON)
33
34#-------------------------------------------------------------------------------
35# Components that are specific to deployment in the opteesp environment.
36#
37#-------------------------------------------------------------------------------
38add_components(TARGET "attestation"
39 BASE_DIR ${TS_ROOT}
40 COMPONENTS
Julian Hallcaa4af82021-05-19 12:02:36 +010041 "environments/opteesp"
42)
43
Imre Kisd0ed5c22021-12-15 17:05:47 +010044include(../attestation.cmake REQUIRED)
Julian Hallcaa4af82021-05-19 12:02:36 +010045
46#-------------------------------------------------------------------------------
Gyorgy Szinga365a042021-12-02 01:48:27 +010047# Set target platform to provide drivers needed by the deployment
Julian Hallcaa4af82021-05-19 12:02:36 +010048#
49#-------------------------------------------------------------------------------
50add_platform(TARGET "attestation")
51
Julian Hallcaa4af82021-05-19 12:02:36 +010052target_compile_definitions(attestation PRIVATE
53 ARM64=1
54)
55
56target_include_directories(attestation PRIVATE
Julian Hallcaa4af82021-05-19 12:02:36 +010057 ${TS_ROOT}/deployments/attestation/opteesp
58)
59
60if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
61 target_compile_options(attestation PRIVATE
62 -fdiagnostics-show-option
Julian Hallcaa4af82021-05-19 12:02:36 +010063 -gdwarf-2
64 -mstrict-align
65 -O0
Andrew Beggs97a00d42021-06-15 15:45:46 +000066 -std=c99
Julian Hallcaa4af82021-05-19 12:02:36 +010067 )
68
69 # Options for GCC that control linking
70 target_link_options(attestation PRIVATE
Julian Hallcaa4af82021-05-19 12:02:36 +010071 -zmax-page-size=4096
72 )
73 # Options directly for LD, these are not understood by GCC
74 target_link_options(attestation PRIVATE
75 -Wl,--as-needed
76 -Wl,--sort-section=alignment
77 # -Wl,--dynamic-list ${CMAKE_CURRENT_LIST_DIR}/dyn_list
78 )
79endif()
80
Balint Dobszayc9daea92022-06-15 15:17:11 +020081compiler_generate_stripped_elf(TARGET attestation NAME "${SP_UUID_CANON}.stripped.elf" RES STRIPPED_ELF)
Julian Hallcaa4af82021-05-19 12:02:36 +010082
83######################################## install
84if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
85 set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install CACHE PATH "location to install build output to." FORCE)
86endif()
87#TODO: api headers
88
89install(TARGETS attestation
90 PUBLIC_HEADER DESTINATION ${TS_ENV}/include
91 RUNTIME DESTINATION ${TS_ENV}/bin
92 )
93install(FILES ${STRIPPED_ELF} DESTINATION ${TS_ENV}/bin)
94
95get_property(_PROTO_FILES TARGET attestation PROPERTY PROTOBUF_FILES)
96install(FILES ${_PROTO_FILES} DESTINATION ${TS_ENV}/lib/protobuf)
97
Imre Kisa74aaf92021-12-14 17:13:06 +010098include(${TS_ROOT}/tools/cmake/common/ExportSp.cmake)
99export_sp(
Balint Dobszayc9daea92022-06-15 15:17:11 +0200100 SP_UUID_CANON ${SP_UUID_CANON}
101 SP_UUID_LE ${SP_UUID_LE}
Imre Kisa74aaf92021-12-14 17:13:06 +0100102 SP_NAME "attestation"
103 MK_IN ${TS_ROOT}/environments/opteesp/sp.mk.in
104 DTS_IN ${CMAKE_CURRENT_LIST_DIR}/default_attestation.dts.in
105 JSON_IN ${TS_ROOT}/environments/opteesp/sp_pkg.json.in
106)