Julian Hall | 4061ed6 | 2020-11-23 18:24:06 +0100 | [diff] [blame] | 1 | #------------------------------------------------------------------------------- |
Gyorgy Szing | 8a1e7f4 | 2023-07-26 18:26:48 +0200 | [diff] [blame] | 2 | # Copyright (c) 2020-2023, Arm Limited and Contributors. All rights reserved. |
Julian Hall | 4061ed6 | 2020-11-23 18:24:06 +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) |
Gyorgy Szing | a365a04 | 2021-12-02 01:48:27 +0100 | [diff] [blame] | 8 | |
| 9 | # Set default platform. |
| 10 | set(TS_PLATFORM "arm/fvp/fvp_base_revc-2xaemv8a" CACHE STRING "Target platform location.") |
Gyorgy Szing | 34aaf21 | 2022-10-20 07:26:23 +0200 | [diff] [blame] | 11 | |
| 12 | # Te crypto SP is big. Set default build type to MinSizWithDebInfo to avoid running ouf of |
| 13 | # secure memory on low resource IoT platforms. |
| 14 | if (NOT DEFINED CMAKE_BUILD_TYPE) |
| 15 | set(CMAKE_BUILD_TYPE "MinSizWithDebInfo" CACHE STRING "Build type.") |
| 16 | endif() |
| 17 | |
Julian Hall | 64f1d87 | 2022-09-05 16:52:40 +0100 | [diff] [blame] | 18 | include(../../../deployment.cmake REQUIRED) |
Julian Hall | 4061ed6 | 2020-11-23 18:24:06 +0100 | [diff] [blame] | 19 | |
| 20 | #------------------------------------------------------------------------------- |
| 21 | # The CMakeLists.txt for building the crypto deployment for opteesp |
| 22 | # |
| 23 | # Builds the Crypto service provider for running in an SEL0 secure partition |
| 24 | # hosted by OPTEE in the role of SPM. |
| 25 | #------------------------------------------------------------------------------- |
| 26 | include(${TS_ROOT}/environments/opteesp/env.cmake) |
| 27 | project(trusted-services LANGUAGES C ASM) |
Imre Kis | d0ed5c2 | 2021-12-15 17:05:47 +0100 | [diff] [blame] | 28 | add_executable(crypto) |
| 29 | target_include_directories(crypto PRIVATE "${TOP_LEVEL_INCLUDE_DIRS}") |
Jelle Sels | 4960c41 | 2023-02-01 09:43:24 +0100 | [diff] [blame] | 30 | set(SP_BIN_UUID_CANON "d9df52d5-16a2-4bb2-9aa4-d26d3b84e8c0") |
| 31 | set(SP_FFA_UUID_CANON "${TS_RPC_UUID_CANON}") |
Imre Kis | eeee964 | 2021-12-17 13:59:46 +0100 | [diff] [blame] | 32 | set(SP_HEAP_SIZE "490 * 1024" CACHE STRING "SP heap size in bytes") |
Gabor Toth | 1b0c11a | 2024-04-05 11:43:55 +0200 | [diff] [blame] | 33 | set(SP_BOOT_ORDER "4" CACHE STRING "Boot order of the SP") |
Imre Kis | 2ccd8e8 | 2021-10-08 11:21:14 +0200 | [diff] [blame] | 34 | set(TRACE_PREFIX "CRYPTO" CACHE STRING "Trace prefix") |
Julian Hall | 4061ed6 | 2020-11-23 18:24:06 +0100 | [diff] [blame] | 35 | |
Julian Hall | 64f1d87 | 2022-09-05 16:52:40 +0100 | [diff] [blame] | 36 | target_include_directories(crypto PRIVATE |
| 37 | ${CMAKE_CURRENT_LIST_DIR} |
| 38 | ) |
| 39 | |
julhal01 | ffa98d8 | 2021-01-20 13:51:58 +0000 | [diff] [blame] | 40 | #------------------------------------------------------------------------------- |
Julian Hall | 64f1d87 | 2022-09-05 16:52:40 +0100 | [diff] [blame] | 41 | # Deployment specific components |
julhal01 | ffa98d8 | 2021-01-20 13:51:58 +0000 | [diff] [blame] | 42 | # |
| 43 | #------------------------------------------------------------------------------- |
Jelle Sels | 4960c41 | 2023-02-01 09:43:24 +0100 | [diff] [blame] | 44 | |
Imre Kis | d0ed5c2 | 2021-12-15 17:05:47 +0100 | [diff] [blame] | 45 | add_components(TARGET "crypto" |
Julian Hall | 4061ed6 | 2020-11-23 18:24:06 +0100 | [diff] [blame] | 46 | BASE_DIR ${TS_ROOT} |
| 47 | COMPONENTS |
Julian Hall | 4061ed6 | 2020-11-23 18:24:06 +0100 | [diff] [blame] | 48 | "environments/opteesp" |
| 49 | ) |
| 50 | |
Julian Hall | 64f1d87 | 2022-09-05 16:52:40 +0100 | [diff] [blame] | 51 | include(../../env/commonsp/crypto_sp.cmake REQUIRED) |
| 52 | include(../../crypto.cmake REQUIRED) |
| 53 | include(../../infra/baremetal-psa.cmake REQUIRED) |
Julian Hall | 4061ed6 | 2020-11-23 18:24:06 +0100 | [diff] [blame] | 54 | |
julhal01 | ffa98d8 | 2021-01-20 13:51:58 +0000 | [diff] [blame] | 55 | #------------------------------------------------------------------------------- |
Gyorgy Szing | a365a04 | 2021-12-02 01:48:27 +0100 | [diff] [blame] | 56 | # Set target platform to provide drivers needed by the deployment |
julhal01 | ffa98d8 | 2021-01-20 13:51:58 +0000 | [diff] [blame] | 57 | # |
| 58 | #------------------------------------------------------------------------------- |
Imre Kis | d0ed5c2 | 2021-12-15 17:05:47 +0100 | [diff] [blame] | 59 | add_platform(TARGET "crypto") |
Julian Hall | 4061ed6 | 2020-11-23 18:24:06 +0100 | [diff] [blame] | 60 | |
Julian Hall | 64f1d87 | 2022-09-05 16:52:40 +0100 | [diff] [blame] | 61 | #------------------------------------------------------------------------------- |
| 62 | # Deployment specific build options |
| 63 | #------------------------------------------------------------------------------- |
Imre Kis | d0ed5c2 | 2021-12-15 17:05:47 +0100 | [diff] [blame] | 64 | target_compile_definitions(crypto PRIVATE |
Julian Hall | 4061ed6 | 2020-11-23 18:24:06 +0100 | [diff] [blame] | 65 | ARM64=1 |
| 66 | ) |
| 67 | |
Julian Hall | 4061ed6 | 2020-11-23 18:24:06 +0100 | [diff] [blame] | 68 | if(CMAKE_C_COMPILER_ID STREQUAL "GNU") |
Imre Kis | d0ed5c2 | 2021-12-15 17:05:47 +0100 | [diff] [blame] | 69 | target_compile_options(crypto PRIVATE |
Andrew Beggs | 97a00d4 | 2021-06-15 15:45:46 +0000 | [diff] [blame] | 70 | -std=c99 |
Julian Hall | 4061ed6 | 2020-11-23 18:24:06 +0100 | [diff] [blame] | 71 | ) |
| 72 | |
Julian Hall | 4061ed6 | 2020-11-23 18:24:06 +0100 | [diff] [blame] | 73 | endif() |
| 74 | |
Julian Hall | 64f1d87 | 2022-09-05 16:52:40 +0100 | [diff] [blame] | 75 | #------------------------------------------------------------------------------- |
| 76 | # Deployment specific install options |
| 77 | #------------------------------------------------------------------------------- |
Julian Hall | 4061ed6 | 2020-11-23 18:24:06 +0100 | [diff] [blame] | 78 | if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) |
| 79 | set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install CACHE PATH "location to install build output to." FORCE) |
| 80 | endif() |
| 81 | #TODO: api headers |
Gyorgy Szing | c31afbf | 2021-02-12 01:51:55 +0100 | [diff] [blame] | 82 | |
Imre Kis | d0ed5c2 | 2021-12-15 17:05:47 +0100 | [diff] [blame] | 83 | install(TARGETS crypto |
Gyorgy Szing | c31afbf | 2021-02-12 01:51:55 +0100 | [diff] [blame] | 84 | RUNTIME DESTINATION ${TS_ENV}/bin |
Julian Hall | 4061ed6 | 2020-11-23 18:24:06 +0100 | [diff] [blame] | 85 | ) |
Julian Hall | 4061ed6 | 2020-11-23 18:24:06 +0100 | [diff] [blame] | 86 | |
Imre Kis | d0ed5c2 | 2021-12-15 17:05:47 +0100 | [diff] [blame] | 87 | get_property(_PROTO_FILES TARGET crypto PROPERTY PROTOBUF_FILES) |
Gyorgy Szing | c31afbf | 2021-02-12 01:51:55 +0100 | [diff] [blame] | 88 | install(FILES ${_PROTO_FILES} DESTINATION ${TS_ENV}/lib/protobuf) |
Julian Hall | 4061ed6 | 2020-11-23 18:24:06 +0100 | [diff] [blame] | 89 | |
Imre Kis | a74aaf9 | 2021-12-14 17:13:06 +0100 | [diff] [blame] | 90 | include(${TS_ROOT}/tools/cmake/common/ExportSp.cmake) |
| 91 | export_sp( |
Jelle Sels | 4960c41 | 2023-02-01 09:43:24 +0100 | [diff] [blame] | 92 | SP_FFA_UUID_CANON ${SP_FFA_UUID_CANON} |
| 93 | SP_BIN_UUID_CANON ${SP_BIN_UUID_CANON} |
Gabor Toth | 7e4babe | 2024-03-14 11:09:19 +0100 | [diff] [blame] | 94 | SP_BOOT_ORDER ${SP_BOOT_ORDER} |
Imre Kis | a74aaf9 | 2021-12-14 17:13:06 +0100 | [diff] [blame] | 95 | SP_NAME "crypto" |
| 96 | MK_IN ${TS_ROOT}/environments/opteesp/sp.mk.in |
| 97 | DTS_IN ${CMAKE_CURRENT_LIST_DIR}/default_crypto.dts.in |
| 98 | JSON_IN ${TS_ROOT}/environments/opteesp/sp_pkg.json.in |
| 99 | ) |