blob: 1c6753a46a9dc39904bddb165df21ef60f3ffbdb [file] [log] [blame]
Julian Hall527ddd52021-06-28 11:57:17 +01001#-------------------------------------------------------------------------------
Imre Kiseeee9642021-12-17 13:59:46 +01002# Copyright (c) 2021-2022, Arm Limited and Contributors. All rights reserved.
Julian Hall527ddd52021-06-28 11:57:17 +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 Hall527ddd52021-06-28 11:57:17 +010011include(../../deployment.cmake REQUIRED)
12
13#-------------------------------------------------------------------------------
14# The CMakeLists.txt for building the se-proxy deployment for opteesp
15#
16# Builds proxy service providers that communicate with a separate secure element
17# that hosts a set of service endpoints. This deployment is for running in an
18# SEL0 secure partition hosted by OPTEE in the role of SPM.
19#-------------------------------------------------------------------------------
20include(${TS_ROOT}/environments/opteesp/env.cmake)
21project(trusted-services LANGUAGES C ASM)
22add_executable(se-proxy)
23target_include_directories(se-proxy PRIVATE "${TOP_LEVEL_INCLUDE_DIRS}")
Balint Dobszayc9daea92022-06-15 15:17:11 +020024set(SP_UUID_CANON "46bb39d1-b4d9-45b5-88ff-040027dab249")
Imre Kiseeee9642021-12-17 13:59:46 +010025set(SP_HEAP_SIZE "32 * 1024" CACHE STRING "SP heap size in bytes")
Imre Kisd0ed5c22021-12-15 17:05:47 +010026set(TRACE_PREFIX "SEPROXY" CACHE STRING "Trace prefix")
Jelle Selsf1cb0522022-06-30 11:31:31 +020027include(${TS_ROOT}/tools/cmake/common/TargetCompileDefinitions.cmake)
28set_target_uuids(
29 SP_UUID ${SP_UUID_CANON}
30 SP_NAME "se-proxy"
31)
Julian Hall527ddd52021-06-28 11:57:17 +010032
33#-------------------------------------------------------------------------------
Julian Hall527ddd52021-06-28 11:57:17 +010034# Components that are specific to deployment in the opteesp environment.
35#
36#-------------------------------------------------------------------------------
37add_components(TARGET "se-proxy"
38 BASE_DIR ${TS_ROOT}
39 COMPONENTS
Julian Hall527ddd52021-06-28 11:57:17 +010040 "environments/opteesp"
Julian Hall527ddd52021-06-28 11:57:17 +010041)
42
Imre Kisd0ed5c22021-12-15 17:05:47 +010043include(../se-proxy.cmake REQUIRED)
Julian Hall527ddd52021-06-28 11:57:17 +010044
45#-------------------------------------------------------------------------------
Gyorgy Szinga365a042021-12-02 01:48:27 +010046# Set target platform to provide drivers needed by the deployment
Julian Hall527ddd52021-06-28 11:57:17 +010047#
48#-------------------------------------------------------------------------------
Julian Hall527ddd52021-06-28 11:57:17 +010049add_platform(TARGET "se-proxy")
50
Julian Hall527ddd52021-06-28 11:57:17 +010051
52target_compile_definitions(se-proxy PRIVATE
53 ARM64=1
54)
55
56target_include_directories(se-proxy PRIVATE
Julian Hall527ddd52021-06-28 11:57:17 +010057 ${TS_ROOT}/deployments/se-proxy/opteesp
58)
59
60if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
61 target_compile_options(se-proxy PRIVATE
62 -fdiagnostics-show-option
63 -gdwarf-2
64 -mstrict-align
65 -O0
66 -std=c99
67 )
68
69 # Options for GCC that control linking
70 target_link_options(se-proxy PRIVATE
71 -zmax-page-size=4096
72 )
73 # Options directly for LD, these are not understood by GCC
74 target_link_options(se-proxy 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 se-proxy NAME "${SP_UUID_CANON}.stripped.elf" RES STRIPPED_ELF)
Julian Hall527ddd52021-06-28 11:57:17 +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 se-proxy
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 se-proxy 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 "se-proxy"
103 MK_IN ${TS_ROOT}/environments/opteesp/sp.mk.in
104 DTS_IN ${CMAKE_CURRENT_LIST_DIR}/default_se-proxy.dts.in
105 JSON_IN ${TS_ROOT}/environments/opteesp/sp_pkg.json.in
106)