blob: 758b7ab5b2a676eca86da36839112ad8e59ef351 [file] [log] [blame]
Balint Dobszay72c3f042020-11-23 18:23:57 +01001#-------------------------------------------------------------------------------
Gyorgy Szingc31afbf2021-02-12 01:51:55 +01002# Copyright (c) 2020-2021, Arm Limited and Contributors. All rights reserved.
Balint Dobszay72c3f042020-11-23 18:23:57 +01003#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6#-------------------------------------------------------------------------------
7cmake_minimum_required(VERSION 3.16)
8include(../../deployment.cmake REQUIRED)
9
10#-------------------------------------------------------------------------------
11# The CMakeLists.txt for building the sfs-demo deployment for opteesp
12#
13# Used for building a demo sp that acts as a client of the secure storage
14# service, deployed in another sp.
15#-------------------------------------------------------------------------------
16include(${TS_ROOT}/environments/opteesp/env.cmake)
17project(trusted-services LANGUAGES C ASM)
18add_executable(sfs-demo)
19set(SP_UUID "01109cf8-e5ca-446f-9b55-f3cdc65110c8")
20
21
22# Include SP DEV KIT interface
23set(SP_DEV_KIT_INC_DIR ${CMAKE_CURRENT_LIST_DIR})
24list(APPEND CMAKE_MODULE_PATH "${TS_ROOT}/external/Spdevkit")
25find_package(Spdevkit REQUIRED)
26sp_dev_kit_configure_linking(TARGET sfs-demo DEFINES ARM64=1)
27target_link_libraries(sfs-demo ${SP_DEV_KIT_LIBRARIES})
28
29
30add_components(TARGET "sfs-demo"
31 BASE_DIR ${TS_ROOT}
32 COMPONENTS
33 components/messaging/ffa/libsp
34 components/rpc/common/interface
35 components/rpc/common/caller
36 components/rpc/ffarpc/caller/sp
37 components/service/common
julhal011260f102021-02-15 17:34:08 +000038 components/service/secure_storage/frontend/psa/its
39 components/service/secure_storage/backend/secure_storage_client
Balint Dobszay72c3f042020-11-23 18:23:57 +010040 protocols/rpc/common/packed-c
41 protocols/service/secure_storage/packed-c
42 environments/opteesp
43)
44
45target_sources(sfs-demo PRIVATE
46 sp.c
47)
48
49target_compile_definitions(sfs-demo PRIVATE
50 ARM64=1
51)
52
53target_include_directories(sfs-demo PRIVATE
54 ${TS_ROOT}
55 ${TS_ROOT}/components
56 ${TS_ROOT}/deployments/sfs-demo/opteesp
57)
58
59if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
60 target_compile_options(sfs-demo PRIVATE
61 -fdiagnostics-show-option
62 -fpic
63 -gdwarf-2
64 -mstrict-align
65 -O0
66 -std=gnu99
67 )
68
69 # Options for GCC that control linking
70 target_link_options(sfs-demo PRIVATE
71 -e __sp_entry
72 -fno-lto
73 -nostdlib
74 -pie
75 -zmax-page-size=4096
76 )
77 # Options directly for LD, these are not understood by GCC
78 target_link_options(sfs-demo PRIVATE
79 -Wl,--as-needed
80 -Wl,--sort-section=alignment
81 # -Wl,--dynamic-list ${CMAKE_CURRENT_LIST_DIR}/dyn_list
82 )
83endif()
84
85compiler_generate_stripped_elf(TARGET sfs-demo NAME "${SP_UUID}.stripped.elf" RES STRIPPED_ELF)
86
87######################################## install
88if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
89 set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install CACHE PATH "location to install build output to." FORCE)
90endif()
91#TODO: API header, protobuf files?
Gyorgy Szingc31afbf2021-02-12 01:51:55 +010092install(TARGETS sfs-demo DESTINATION ${TS_ENV}/bin)
93install(FILES ${STRIPPED_ELF} DESTINATION ${TS_ENV}/bin)