blob: 5e9f99257dd58e996675dbda832f383ada13b9db [file] [log] [blame]
Imre Kis840ded22022-01-13 15:32:01 +01001#-------------------------------------------------------------------------------
2# Copyright (c) 2020-2022, Arm Limited and Contributors. All rights reserved.
3#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6#-------------------------------------------------------------------------------
Balint Dobszay047aea82022-05-16 14:20:53 +02007cmake_minimum_required(VERSION 3.18 FATAL_ERROR)
Imre Kis840ded22022-01-13 15:32:01 +01008include(../../deployment.cmake REQUIRED)
9
10#-------------------------------------------------------------------------------
11# The CMakeLists.txt for building the sfs-demo deployment for
12# generic sp environment.
13#
14# Used for building a demo sp that acts as a client of the secure storage
15# service, deployed in another sp.
16#-------------------------------------------------------------------------------
17include(${TS_ROOT}/environments/sp/env.cmake)
18set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Build type")
19project(trusted-services LANGUAGES C ASM)
20add_executable(sfs-demo)
21target_include_directories(sfs-demo PRIVATE "${TOP_LEVEL_INCLUDE_DIRS}")
22set(SP_NAME "sfs-demo")
23set(SP_UUID "01109cf8-e5ca-446f-9b55-f3cdc65110c8")
24set(TRACE_PREFIX "SFSDEMO" CACHE STRING "Trace prefix")
25set(SP_STACK_SIZE "64 * 1024" CACHE STRING "Stack size")
26set(SP_HEAP_SIZE "32 * 1024" CACHE STRING "Heap size")
27
28add_components(TARGET "sfs-demo"
29 BASE_DIR ${TS_ROOT}
30 COMPONENTS
31 environments/sp
32)
33
34include(../sfs-demo.cmake REQUIRED)
35
36target_compile_definitions(sfs-demo PRIVATE
37 ARM64=1
38)
39
40if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
41 target_compile_options(sfs-demo PRIVATE
42 -fdiagnostics-show-option
43 -gdwarf-2
44 -mstrict-align
45 -std=c99
46 )
47
48 # Options for GCC that control linking
49 target_link_options(sfs-demo PRIVATE
50 -zmax-page-size=4096
51 )
52 # Options directly for LD, these are not understood by GCC
53 target_link_options(sfs-demo PRIVATE
54 -Wl,--as-needed
55 -Wl,--sort-section=alignment
56 )
57endif()
58
59compiler_generate_binary_output(TARGET sfs-demo NAME "${SP_UUID}.bin" SP_BINARY)
60install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${SP_UUID}.bin DESTINATION ${TS_ENV}/bin)
61
62include(${TS_ROOT}/tools/cmake/common/ExportMemoryRegionsToManifest.cmake REQUIRED)
63export_memory_regions_to_manifest(TARGET sfs-demo NAME "${SP_UUID}_memory_regions.dtsi" RES EXPORT_MEMORY_REGIONS_DTSI)
64
65######################################## install
66if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
67 set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install CACHE PATH "location to install build output to." FORCE)
68endif()
69install(TARGETS sfs-demo
70 PUBLIC_HEADER DESTINATION ${TS_ENV}/include
71 RUNTIME DESTINATION ${TS_ENV}/bin
72 )
73
74include(${TS_ROOT}/tools/cmake/common/ExportSp.cmake REQUIRED)
75export_sp(
76 SP_UUID ${SP_UUID}
77 SP_NAME ${SP_NAME}
78 DTS_IN ${CMAKE_CURRENT_LIST_DIR}/default_${SP_NAME}.dts.in
79 DTS_MEM_REGIONS ${SP_UUID}_memory_regions.dtsi
80 JSON_IN ${TS_ROOT}/environments/sp/sp_pkg.json.in
81)