blob: aab0d5788106ad5480021460bb107235dcad5f54 [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 +01008
9# Set default platform.
10set(TS_PLATFORM "arm/fvp/fvp_base_revc-2xaemv8a" CACHE STRING "Target platform location.")
Gyorgy Szing34aaf212022-10-20 07:26:23 +020011
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.
14if (NOT DEFINED CMAKE_BUILD_TYPE)
15 set(CMAKE_BUILD_TYPE "MinSizWithDebInfo" CACHE STRING "Build type.")
16endif()
17
Julian Hall64f1d872022-09-05 16:52:40 +010018include(../../../deployment.cmake REQUIRED)
Imre Kis840ded22022-01-13 15:32:01 +010019
20#-------------------------------------------------------------------------------
21# The CMakeLists.txt for building the crypto deployment for generic sp
22# environment.
23#
24# Builds the Crypto service provider for running in an SEL0 secure partition
25# hosted by any SPM.
26#-------------------------------------------------------------------------------
27include(${TS_ROOT}/environments/sp/env.cmake)
28set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Build type")
29project(trusted-services LANGUAGES C ASM)
30add_executable(crypto)
31target_include_directories(crypto PRIVATE "${TOP_LEVEL_INCLUDE_DIRS}")
32set(SP_NAME "crypto")
Jelle Sels4960c412023-02-01 09:43:24 +010033set(SP_BIN_UUID_CANON "d9df52d5-16a2-4bb2-9aa4-d26d3b84e8c0")
34set(SP_FFA_UUID_CANON "${TS_RPC_UUID_CANON}")
Imre Kis840ded22022-01-13 15:32:01 +010035set(TRACE_PREFIX "CRYPTO" CACHE STRING "Trace prefix")
36set(SP_STACK_SIZE "64 * 1024" CACHE STRING "Stack size")
37set(SP_HEAP_SIZE "490 * 1024" CACHE STRING "Heap size")
Gabor Toth1b0c11a2024-04-05 11:43:55 +020038set(SP_BOOT_ORDER "4" CACHE STRING "Boot order of the SP")
Imre Kis840ded22022-01-13 15:32:01 +010039
40#-------------------------------------------------------------------------------
41# Components that are specific to deployment in the opteesp environment.
42#
43#-------------------------------------------------------------------------------
44add_components(TARGET "crypto"
45 BASE_DIR ${TS_ROOT}
46 COMPONENTS
47 environments/sp
48)
49
Julian Hall64f1d872022-09-05 16:52:40 +010050include(../../env/commonsp/crypto_sp.cmake REQUIRED)
51include(../../crypto.cmake REQUIRED)
52include(../../infra/baremetal-psa.cmake REQUIRED)
Imre Kis840ded22022-01-13 15:32:01 +010053
54#-------------------------------------------------------------------------------
55# Set target platform to provide drivers needed by the deployment
56#
57#-------------------------------------------------------------------------------
58add_platform(TARGET "crypto")
59
Julian Hall64f1d872022-09-05 16:52:40 +010060#-------------------------------------------------------------------------------
61# Deployment specific build options
62#-------------------------------------------------------------------------------
Imre Kis840ded22022-01-13 15:32:01 +010063target_compile_definitions(crypto PRIVATE
64 ARM64=1
65)
66
67if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
68 target_compile_options(crypto PRIVATE
Imre Kis840ded22022-01-13 15:32:01 +010069 -std=c99
70 )
71
Imre Kis840ded22022-01-13 15:32:01 +010072endif()
73
Jelle Sels4960c412023-02-01 09:43:24 +010074compiler_generate_binary_output(TARGET crypto NAME "${SP_BIN_UUID_CANON}.bin" SP_BINARY)
75install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${SP_BIN_UUID_CANON}.bin DESTINATION ${TS_ENV}/bin)
Imre Kis840ded22022-01-13 15:32:01 +010076
77include(${TS_ROOT}/tools/cmake/common/ExportMemoryRegionsToManifest.cmake REQUIRED)
Jelle Sels4960c412023-02-01 09:43:24 +010078export_memory_regions_to_manifest(TARGET crypto NAME "${SP_BIN_UUID_CANON}_memory_regions.dtsi" RES EXPORT_MEMORY_REGIONS_DTSI)
Imre Kis840ded22022-01-13 15:32:01 +010079
Julian Hall64f1d872022-09-05 16:52:40 +010080#-------------------------------------------------------------------------------
81# Deployment specific install options
82#-------------------------------------------------------------------------------
Imre Kis840ded22022-01-13 15:32:01 +010083if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
84 set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install CACHE PATH "location to install build output to." FORCE)
85endif()
86install(TARGETS crypto
Imre Kis840ded22022-01-13 15:32:01 +010087 RUNTIME DESTINATION ${TS_ENV}/bin
88 )
89
90include(${TS_ROOT}/tools/cmake/common/ExportSp.cmake REQUIRED)
91export_sp(
Jelle Sels4960c412023-02-01 09:43:24 +010092 SP_FFA_UUID_CANON ${SP_FFA_UUID_CANON}
93 SP_BIN_UUID_CANON ${SP_BIN_UUID_CANON}
Gabor Toth7e4babe2024-03-14 11:09:19 +010094 SP_BOOT_ORDER ${SP_BOOT_ORDER}
Imre Kis840ded22022-01-13 15:32:01 +010095 SP_NAME ${SP_NAME}
96 DTS_IN ${CMAKE_CURRENT_LIST_DIR}/default_${SP_NAME}.dts.in
Jelle Sels4960c412023-02-01 09:43:24 +010097 DTS_MEM_REGIONS ${SP_BIN_UUID_CANON}_memory_regions.dtsi
Imre Kis840ded22022-01-13 15:32:01 +010098 JSON_IN ${TS_ROOT}/environments/sp/sp_pkg.json.in
99)