blob: d3a7d151b26fe3a44bb17891b7a603044f0d4573 [file] [log] [blame]
Balint Dobszay72c3f042020-11-23 18:23:57 +01001#-------------------------------------------------------------------------------
2# Copyright (c) 2020, Arm Limited and Contributors. All rights reserved.
3#
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
38 components/service/secure_storage/client/psa
39 protocols/rpc/common/packed-c
40 protocols/service/secure_storage/packed-c
41 environments/opteesp
42)
43
44target_sources(sfs-demo PRIVATE
45 sp.c
46)
47
48target_compile_definitions(sfs-demo PRIVATE
49 ARM64=1
50)
51
52target_include_directories(sfs-demo PRIVATE
53 ${TS_ROOT}
54 ${TS_ROOT}/components
55 ${TS_ROOT}/deployments/sfs-demo/opteesp
56)
57
58if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
59 target_compile_options(sfs-demo PRIVATE
60 -fdiagnostics-show-option
61 -fpic
62 -gdwarf-2
63 -mstrict-align
64 -O0
65 -std=gnu99
66 )
67
68 # Options for GCC that control linking
69 target_link_options(sfs-demo PRIVATE
70 -e __sp_entry
71 -fno-lto
72 -nostdlib
73 -pie
74 -zmax-page-size=4096
75 )
76 # Options directly for LD, these are not understood by GCC
77 target_link_options(sfs-demo PRIVATE
78 -Wl,--as-needed
79 -Wl,--sort-section=alignment
80 # -Wl,--dynamic-list ${CMAKE_CURRENT_LIST_DIR}/dyn_list
81 )
82endif()
83
84compiler_generate_stripped_elf(TARGET sfs-demo NAME "${SP_UUID}.stripped.elf" RES STRIPPED_ELF)
85
86######################################## install
87if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
88 set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install CACHE PATH "location to install build output to." FORCE)
89endif()
90#TODO: API header, protobuf files?
91install(TARGETS sfs-demo DESTINATION bin)
92install(FILES ${STRIPPED_ELF} DESTINATION bin)