Balint Dobszay | 72c3f04 | 2020-11-23 18:23:57 +0100 | [diff] [blame] | 1 | #------------------------------------------------------------------------------- |
Gyorgy Szing | c31afbf | 2021-02-12 01:51:55 +0100 | [diff] [blame] | 2 | # Copyright (c) 2020-2021, 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 | #------------------------------------------------------------------------------- |
| 7 | cmake_minimum_required(VERSION 3.16) |
| 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) |
| 19 | set(SP_UUID "01109cf8-e5ca-446f-9b55-f3cdc65110c8") |
| 20 | |
| 21 | |
| 22 | # Include SP DEV KIT interface |
| 23 | set(SP_DEV_KIT_INC_DIR ${CMAKE_CURRENT_LIST_DIR}) |
| 24 | list(APPEND CMAKE_MODULE_PATH "${TS_ROOT}/external/Spdevkit") |
| 25 | find_package(Spdevkit REQUIRED) |
| 26 | sp_dev_kit_configure_linking(TARGET sfs-demo DEFINES ARM64=1) |
| 27 | target_link_libraries(sfs-demo ${SP_DEV_KIT_LIBRARIES}) |
| 28 | |
| 29 | |
| 30 | add_components(TARGET "sfs-demo" |
| 31 | BASE_DIR ${TS_ROOT} |
| 32 | COMPONENTS |
| 33 | components/messaging/ffa/libsp |
| 34 | components/rpc/common/interface |
| 35 | components/rpc/common/caller |
| 36 | components/rpc/ffarpc/caller/sp |
| 37 | components/service/common |
julhal01 | 1260f10 | 2021-02-15 17:34:08 +0000 | [diff] [blame] | 38 | components/service/secure_storage/frontend/psa/its |
| 39 | components/service/secure_storage/backend/secure_storage_client |
Balint Dobszay | 72c3f04 | 2020-11-23 18:23:57 +0100 | [diff] [blame] | 40 | protocols/rpc/common/packed-c |
| 41 | protocols/service/secure_storage/packed-c |
| 42 | environments/opteesp |
| 43 | ) |
| 44 | |
| 45 | target_sources(sfs-demo PRIVATE |
| 46 | sp.c |
| 47 | ) |
| 48 | |
| 49 | target_compile_definitions(sfs-demo PRIVATE |
| 50 | ARM64=1 |
| 51 | ) |
| 52 | |
| 53 | target_include_directories(sfs-demo PRIVATE |
| 54 | ${TS_ROOT} |
| 55 | ${TS_ROOT}/components |
| 56 | ${TS_ROOT}/deployments/sfs-demo/opteesp |
| 57 | ) |
| 58 | |
| 59 | if(CMAKE_C_COMPILER_ID STREQUAL "GNU") |
| 60 | target_compile_options(sfs-demo PRIVATE |
| 61 | -fdiagnostics-show-option |
| 62 | -fpic |
| 63 | -gdwarf-2 |
| 64 | -mstrict-align |
| 65 | -O0 |
| 66 | -std=gnu99 |
| 67 | ) |
| 68 | |
| 69 | # Options for GCC that control linking |
| 70 | target_link_options(sfs-demo PRIVATE |
| 71 | -e __sp_entry |
| 72 | -fno-lto |
| 73 | -nostdlib |
| 74 | -pie |
| 75 | -zmax-page-size=4096 |
| 76 | ) |
| 77 | # Options directly for LD, these are not understood by GCC |
| 78 | target_link_options(sfs-demo PRIVATE |
| 79 | -Wl,--as-needed |
| 80 | -Wl,--sort-section=alignment |
| 81 | # -Wl,--dynamic-list ${CMAKE_CURRENT_LIST_DIR}/dyn_list |
| 82 | ) |
| 83 | endif() |
| 84 | |
| 85 | compiler_generate_stripped_elf(TARGET sfs-demo NAME "${SP_UUID}.stripped.elf" RES STRIPPED_ELF) |
| 86 | |
| 87 | ######################################## install |
| 88 | if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) |
| 89 | set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install CACHE PATH "location to install build output to." FORCE) |
| 90 | endif() |
| 91 | #TODO: API header, protobuf files? |
Gyorgy Szing | c31afbf | 2021-02-12 01:51:55 +0100 | [diff] [blame] | 92 | install(TARGETS sfs-demo DESTINATION ${TS_ENV}/bin) |
| 93 | install(FILES ${STRIPPED_ELF} DESTINATION ${TS_ENV}/bin) |