Balint Dobszay | 72c3f04 | 2020-11-23 18:23:57 +0100 | [diff] [blame] | 1 | #------------------------------------------------------------------------------- |
Imre Kis | eeee964 | 2021-12-17 13:59:46 +0100 | [diff] [blame] | 2 | # Copyright (c) 2020-2022, Arm Limited and Contributors. All rights reserved. |
Balint Dobszay | 72c3f04 | 2020-11-23 18:23:57 +0100 | [diff] [blame] | 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) |
Balint Dobszay | 72c3f04 | 2020-11-23 18:23:57 +0100 | [diff] [blame] | 8 | include(../../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 | #------------------------------------------------------------------------------- |
| 16 | include(${TS_ROOT}/environments/opteesp/env.cmake) |
| 17 | project(trusted-services LANGUAGES C ASM) |
| 18 | add_executable(sfs-demo) |
Balint Dobszay | c9daea9 | 2022-06-15 15:17:11 +0200 | [diff] [blame] | 19 | set(SP_UUID_CANON "01109cf8-e5ca-446f-9b55-f3cdc65110c8") |
Imre Kis | eeee964 | 2021-12-17 13:59:46 +0100 | [diff] [blame] | 20 | set(SP_HEAP_SIZE "32 * 1024" CACHE STRING "SP heap size in bytes") |
Imre Kis | 2ccd8e8 | 2021-10-08 11:21:14 +0200 | [diff] [blame] | 21 | set(TRACE_PREFIX "SFSDEMO" CACHE STRING "Trace prefix") |
Jelle Sels | f1cb052 | 2022-06-30 11:31:31 +0200 | [diff] [blame^] | 22 | include(${TS_ROOT}/tools/cmake/common/TargetCompileDefinitions.cmake) |
| 23 | set_target_uuids( |
| 24 | SP_UUID ${SP_UUID_CANON} |
| 25 | SP_NAME "sfs-demo" |
| 26 | ) |
Balint Dobszay | 72c3f04 | 2020-11-23 18:23:57 +0100 | [diff] [blame] | 27 | |
Balint Dobszay | 72c3f04 | 2020-11-23 18:23:57 +0100 | [diff] [blame] | 28 | add_components(TARGET "sfs-demo" |
| 29 | BASE_DIR ${TS_ROOT} |
| 30 | COMPONENTS |
Balint Dobszay | 72c3f04 | 2020-11-23 18:23:57 +0100 | [diff] [blame] | 31 | environments/opteesp |
| 32 | ) |
| 33 | |
Imre Kis | d0ed5c2 | 2021-12-15 17:05:47 +0100 | [diff] [blame] | 34 | include(../sfs-demo.cmake REQUIRED) |
Balint Dobszay | 72c3f04 | 2020-11-23 18:23:57 +0100 | [diff] [blame] | 35 | |
| 36 | target_compile_definitions(sfs-demo PRIVATE |
| 37 | ARM64=1 |
| 38 | ) |
| 39 | |
| 40 | target_include_directories(sfs-demo PRIVATE |
Balint Dobszay | 72c3f04 | 2020-11-23 18:23:57 +0100 | [diff] [blame] | 41 | ${TS_ROOT}/deployments/sfs-demo/opteesp |
| 42 | ) |
| 43 | |
| 44 | if(CMAKE_C_COMPILER_ID STREQUAL "GNU") |
| 45 | target_compile_options(sfs-demo PRIVATE |
| 46 | -fdiagnostics-show-option |
Balint Dobszay | 72c3f04 | 2020-11-23 18:23:57 +0100 | [diff] [blame] | 47 | -gdwarf-2 |
| 48 | -mstrict-align |
| 49 | -O0 |
Andrew Beggs | 97a00d4 | 2021-06-15 15:45:46 +0000 | [diff] [blame] | 50 | -std=c99 |
Balint Dobszay | 72c3f04 | 2020-11-23 18:23:57 +0100 | [diff] [blame] | 51 | ) |
| 52 | |
| 53 | # Options for GCC that control linking |
| 54 | target_link_options(sfs-demo PRIVATE |
Balint Dobszay | 72c3f04 | 2020-11-23 18:23:57 +0100 | [diff] [blame] | 55 | -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 | ) |
| 63 | endif() |
| 64 | |
Balint Dobszay | c9daea9 | 2022-06-15 15:17:11 +0200 | [diff] [blame] | 65 | compiler_generate_stripped_elf(TARGET sfs-demo NAME "${SP_UUID_CANON}.stripped.elf" RES STRIPPED_ELF) |
Balint Dobszay | 72c3f04 | 2020-11-23 18:23:57 +0100 | [diff] [blame] | 66 | |
| 67 | ######################################## install |
| 68 | if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) |
| 69 | set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install CACHE PATH "location to install build output to." FORCE) |
| 70 | endif() |
Imre Kis | 5a35dda | 2022-03-03 11:38:12 +0100 | [diff] [blame] | 71 | install(TARGETS sfs-demo |
| 72 | PUBLIC_HEADER DESTINATION ${TS_ENV}/include |
| 73 | RUNTIME DESTINATION ${TS_ENV}/bin |
| 74 | ) |
Gyorgy Szing | c31afbf | 2021-02-12 01:51:55 +0100 | [diff] [blame] | 75 | install(FILES ${STRIPPED_ELF} DESTINATION ${TS_ENV}/bin) |
Imre Kis | 5a35dda | 2022-03-03 11:38:12 +0100 | [diff] [blame] | 76 | |
| 77 | include(${TS_ROOT}/tools/cmake/common/ExportSp.cmake) |
| 78 | export_sp( |
Balint Dobszay | c9daea9 | 2022-06-15 15:17:11 +0200 | [diff] [blame] | 79 | SP_UUID_CANON ${SP_UUID_CANON} |
| 80 | SP_UUID_LE ${SP_UUID_LE} |
Imre Kis | 5a35dda | 2022-03-03 11:38:12 +0100 | [diff] [blame] | 81 | 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 | ) |