blob: 364aa306d94cfd58f9245f9bfe9de368f4d96d40 [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")
20set(SP_UUID_LE "0xf89c1001 0x6f44cae5 0xcdf3559b 0xc81051c6")
Imre Kiseeee9642021-12-17 13:59:46 +010021set(SP_HEAP_SIZE "32 * 1024" CACHE STRING "SP heap size in bytes")
Imre Kis2ccd8e82021-10-08 11:21:14 +020022set(TRACE_PREFIX "SFSDEMO" CACHE STRING "Trace prefix")
Balint Dobszay72c3f042020-11-23 18:23:57 +010023
Balint Dobszay72c3f042020-11-23 18:23:57 +010024add_components(TARGET "sfs-demo"
25 BASE_DIR ${TS_ROOT}
26 COMPONENTS
Balint Dobszay72c3f042020-11-23 18:23:57 +010027 environments/opteesp
28)
29
Imre Kisd0ed5c22021-12-15 17:05:47 +010030include(../sfs-demo.cmake REQUIRED)
Balint Dobszay72c3f042020-11-23 18:23:57 +010031
32target_compile_definitions(sfs-demo PRIVATE
33 ARM64=1
34)
35
36target_include_directories(sfs-demo PRIVATE
Balint Dobszay72c3f042020-11-23 18:23:57 +010037 ${TS_ROOT}/deployments/sfs-demo/opteesp
38)
39
40if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
41 target_compile_options(sfs-demo PRIVATE
42 -fdiagnostics-show-option
Balint Dobszay72c3f042020-11-23 18:23:57 +010043 -gdwarf-2
44 -mstrict-align
45 -O0
Andrew Beggs97a00d42021-06-15 15:45:46 +000046 -std=c99
Balint Dobszay72c3f042020-11-23 18:23:57 +010047 )
48
49 # Options for GCC that control linking
50 target_link_options(sfs-demo PRIVATE
Balint Dobszay72c3f042020-11-23 18:23:57 +010051 -zmax-page-size=4096
52 )
53 # Options directly for LD, these are not understood by GCC
54 target_link_options(sfs-demo PRIVATE
55 -Wl,--as-needed
56 -Wl,--sort-section=alignment
57 # -Wl,--dynamic-list ${CMAKE_CURRENT_LIST_DIR}/dyn_list
58 )
59endif()
60
Balint Dobszayc9daea92022-06-15 15:17:11 +020061compiler_generate_stripped_elf(TARGET sfs-demo NAME "${SP_UUID_CANON}.stripped.elf" RES STRIPPED_ELF)
Balint Dobszay72c3f042020-11-23 18:23:57 +010062
63######################################## install
64if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
65 set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install CACHE PATH "location to install build output to." FORCE)
66endif()
Imre Kis5a35dda2022-03-03 11:38:12 +010067install(TARGETS sfs-demo
68 PUBLIC_HEADER DESTINATION ${TS_ENV}/include
69 RUNTIME DESTINATION ${TS_ENV}/bin
70 )
Gyorgy Szingc31afbf2021-02-12 01:51:55 +010071install(FILES ${STRIPPED_ELF} DESTINATION ${TS_ENV}/bin)
Imre Kis5a35dda2022-03-03 11:38:12 +010072
73include(${TS_ROOT}/tools/cmake/common/ExportSp.cmake)
74export_sp(
Balint Dobszayc9daea92022-06-15 15:17:11 +020075 SP_UUID_CANON ${SP_UUID_CANON}
76 SP_UUID_LE ${SP_UUID_LE}
Imre Kis5a35dda2022-03-03 11:38:12 +010077 SP_NAME "sfs-demo"
78 MK_IN ${TS_ROOT}/environments/opteesp/sp.mk.in
79 DTS_IN ${CMAKE_CURRENT_LIST_DIR}/default_sfs-demo.dts.in
80 JSON_IN ${TS_ROOT}/environments/opteesp/sp_pkg.json.in
81)