blob: ac07e60db46632c3b528ffd7da1dc95471cd4e34 [file] [log] [blame]
Balint Dobszay72c3f042020-11-23 18:23:57 +01001#-------------------------------------------------------------------------------
Imre Kiseeee9642021-12-17 13:59:46 +01002# Copyright (c) 2020-2022, Arm Limited and Contributors. All rights reserved.
Balint Dobszay72c3f042020-11-23 18:23:57 +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)
Balint Dobszay72c3f042020-11-23 18:23:57 +01008include(../../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)
Balint Dobszayc9daea92022-06-15 15:17:11 +020019set(SP_UUID_CANON "01109cf8-e5ca-446f-9b55-f3cdc65110c8")
Imre Kiseeee9642021-12-17 13:59:46 +010020set(SP_HEAP_SIZE "32 * 1024" CACHE STRING "SP heap size in bytes")
Imre Kis2ccd8e82021-10-08 11:21:14 +020021set(TRACE_PREFIX "SFSDEMO" CACHE STRING "Trace prefix")
Jelle Selsf1cb0522022-06-30 11:31:31 +020022include(${TS_ROOT}/tools/cmake/common/TargetCompileDefinitions.cmake)
23set_target_uuids(
24 SP_UUID ${SP_UUID_CANON}
25 SP_NAME "sfs-demo"
26)
Balint Dobszay72c3f042020-11-23 18:23:57 +010027
Balint Dobszay72c3f042020-11-23 18:23:57 +010028add_components(TARGET "sfs-demo"
29 BASE_DIR ${TS_ROOT}
30 COMPONENTS
Balint Dobszay72c3f042020-11-23 18:23:57 +010031 environments/opteesp
32)
33
Imre Kisd0ed5c22021-12-15 17:05:47 +010034include(../sfs-demo.cmake REQUIRED)
Balint Dobszay72c3f042020-11-23 18:23:57 +010035
36target_compile_definitions(sfs-demo PRIVATE
37 ARM64=1
38)
39
40target_include_directories(sfs-demo PRIVATE
Balint Dobszay72c3f042020-11-23 18:23:57 +010041 ${TS_ROOT}/deployments/sfs-demo/opteesp
42)
43
44if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
45 target_compile_options(sfs-demo PRIVATE
46 -fdiagnostics-show-option
Balint Dobszay72c3f042020-11-23 18:23:57 +010047 -gdwarf-2
48 -mstrict-align
49 -O0
Andrew Beggs97a00d42021-06-15 15:45:46 +000050 -std=c99
Balint Dobszay72c3f042020-11-23 18:23:57 +010051 )
52
53 # Options for GCC that control linking
54 target_link_options(sfs-demo PRIVATE
Balint Dobszay72c3f042020-11-23 18:23:57 +010055 -zmax-page-size=4096
56 )
57 # Options directly for LD, these are not understood by GCC
58 target_link_options(sfs-demo PRIVATE
59 -Wl,--as-needed
60 -Wl,--sort-section=alignment
61 # -Wl,--dynamic-list ${CMAKE_CURRENT_LIST_DIR}/dyn_list
62 )
63endif()
64
Balint Dobszayc9daea92022-06-15 15:17:11 +020065compiler_generate_stripped_elf(TARGET sfs-demo NAME "${SP_UUID_CANON}.stripped.elf" RES STRIPPED_ELF)
Balint Dobszay72c3f042020-11-23 18:23:57 +010066
67######################################## install
68if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
69 set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install CACHE PATH "location to install build output to." FORCE)
70endif()
Imre Kis5a35dda2022-03-03 11:38:12 +010071install(TARGETS sfs-demo
72 PUBLIC_HEADER DESTINATION ${TS_ENV}/include
73 RUNTIME DESTINATION ${TS_ENV}/bin
74 )
Gyorgy Szingc31afbf2021-02-12 01:51:55 +010075install(FILES ${STRIPPED_ELF} DESTINATION ${TS_ENV}/bin)
Imre Kis5a35dda2022-03-03 11:38:12 +010076
77include(${TS_ROOT}/tools/cmake/common/ExportSp.cmake)
78export_sp(
Balint Dobszayc9daea92022-06-15 15:17:11 +020079 SP_UUID_CANON ${SP_UUID_CANON}
80 SP_UUID_LE ${SP_UUID_LE}
Imre Kis5a35dda2022-03-03 11:38:12 +010081 SP_NAME "sfs-demo"
82 MK_IN ${TS_ROOT}/environments/opteesp/sp.mk.in
83 DTS_IN ${CMAKE_CURRENT_LIST_DIR}/default_sfs-demo.dts.in
84 JSON_IN ${TS_ROOT}/environments/opteesp/sp_pkg.json.in
85)