Imre Kis | 840ded2 | 2022-01-13 15:32:01 +0100 | [diff] [blame] | 1 | #------------------------------------------------------------------------------- |
| 2 | # Copyright (c) 2020-2022, Arm Limited and Contributors. All rights reserved. |
| 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # |
| 6 | #------------------------------------------------------------------------------- |
Balint Dobszay | 047aea8 | 2022-05-16 14:20:53 +0200 | [diff] [blame] | 7 | cmake_minimum_required(VERSION 3.18 FATAL_ERROR) |
Imre Kis | 840ded2 | 2022-01-13 15:32:01 +0100 | [diff] [blame] | 8 | include(../../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 | #------------------------------------------------------------------------------- |
| 17 | include(${TS_ROOT}/environments/sp/env.cmake) |
| 18 | set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Build type") |
| 19 | project(trusted-services LANGUAGES C ASM) |
| 20 | add_executable(sfs-demo) |
| 21 | target_include_directories(sfs-demo PRIVATE "${TOP_LEVEL_INCLUDE_DIRS}") |
| 22 | set(SP_NAME "sfs-demo") |
Balint Dobszay | c9daea9 | 2022-06-15 15:17:11 +0200 | [diff] [blame^] | 23 | set(SP_UUID_CANON "01109cf8-e5ca-446f-9b55-f3cdc65110c8") |
| 24 | set(SP_UUID_LE "0xf89c1001 0x6f44cae5 0xcdf3559b 0xc81051c6") |
Imre Kis | 840ded2 | 2022-01-13 15:32:01 +0100 | [diff] [blame] | 25 | set(TRACE_PREFIX "SFSDEMO" CACHE STRING "Trace prefix") |
| 26 | set(SP_STACK_SIZE "64 * 1024" CACHE STRING "Stack size") |
| 27 | set(SP_HEAP_SIZE "32 * 1024" CACHE STRING "Heap size") |
| 28 | |
| 29 | add_components(TARGET "sfs-demo" |
| 30 | BASE_DIR ${TS_ROOT} |
| 31 | COMPONENTS |
| 32 | environments/sp |
| 33 | ) |
| 34 | |
| 35 | include(../sfs-demo.cmake REQUIRED) |
| 36 | |
| 37 | target_compile_definitions(sfs-demo PRIVATE |
| 38 | ARM64=1 |
| 39 | ) |
| 40 | |
| 41 | if(CMAKE_C_COMPILER_ID STREQUAL "GNU") |
| 42 | target_compile_options(sfs-demo PRIVATE |
| 43 | -fdiagnostics-show-option |
| 44 | -gdwarf-2 |
| 45 | -mstrict-align |
| 46 | -std=c99 |
| 47 | ) |
| 48 | |
| 49 | # Options for GCC that control linking |
| 50 | target_link_options(sfs-demo PRIVATE |
| 51 | -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 | ) |
| 58 | endif() |
| 59 | |
Balint Dobszay | c9daea9 | 2022-06-15 15:17:11 +0200 | [diff] [blame^] | 60 | compiler_generate_binary_output(TARGET sfs-demo NAME "${SP_UUID_CANON}.bin" SP_BINARY) |
| 61 | install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${SP_UUID_CANON}.bin DESTINATION ${TS_ENV}/bin) |
Imre Kis | 840ded2 | 2022-01-13 15:32:01 +0100 | [diff] [blame] | 62 | |
| 63 | include(${TS_ROOT}/tools/cmake/common/ExportMemoryRegionsToManifest.cmake REQUIRED) |
Balint Dobszay | c9daea9 | 2022-06-15 15:17:11 +0200 | [diff] [blame^] | 64 | export_memory_regions_to_manifest(TARGET sfs-demo NAME "${SP_UUID_CANON}_memory_regions.dtsi" RES EXPORT_MEMORY_REGIONS_DTSI) |
Imre Kis | 840ded2 | 2022-01-13 15:32:01 +0100 | [diff] [blame] | 65 | |
| 66 | ######################################## install |
| 67 | if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) |
| 68 | set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install CACHE PATH "location to install build output to." FORCE) |
| 69 | endif() |
| 70 | install(TARGETS sfs-demo |
| 71 | PUBLIC_HEADER DESTINATION ${TS_ENV}/include |
| 72 | RUNTIME DESTINATION ${TS_ENV}/bin |
| 73 | ) |
| 74 | |
| 75 | include(${TS_ROOT}/tools/cmake/common/ExportSp.cmake REQUIRED) |
| 76 | export_sp( |
Balint Dobszay | c9daea9 | 2022-06-15 15:17:11 +0200 | [diff] [blame^] | 77 | SP_UUID_CANON ${SP_UUID_CANON} |
| 78 | SP_UUID_LE ${SP_UUID_LE} |
Imre Kis | 840ded2 | 2022-01-13 15:32:01 +0100 | [diff] [blame] | 79 | SP_NAME ${SP_NAME} |
| 80 | DTS_IN ${CMAKE_CURRENT_LIST_DIR}/default_${SP_NAME}.dts.in |
Balint Dobszay | c9daea9 | 2022-06-15 15:17:11 +0200 | [diff] [blame^] | 81 | DTS_MEM_REGIONS ${SP_UUID_CANON}_memory_regions.dtsi |
Imre Kis | 840ded2 | 2022-01-13 15:32:01 +0100 | [diff] [blame] | 82 | JSON_IN ${TS_ROOT}/environments/sp/sp_pkg.json.in |
| 83 | ) |