blob: 01f6ff5f2089902d96cee1692bf7e9f4f4c6feb0 [file] [log] [blame]
Jamie Foxab30e712023-03-30 17:48:36 +01001#-------------------------------------------------------------------------------
2# Copyright (c) 2023, Arm Limited. All rights reserved.
3#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6#-------------------------------------------------------------------------------
7
8if (NOT TFM_PARTITION_DPE)
9 return()
10endif()
11
12cmake_minimum_required(VERSION 3.15)
13cmake_policy(SET CMP0079 NEW)
14
15# The name of the target is required to be of the pattern
16# tfm_app_rot_partition_x or tfm_psa_rot_partition_x, as it affects how the
17# linker script will lay the partition in memory.
18add_library(tfm_app_rot_partition_dpe STATIC)
19
20target_sources(tfm_app_rot_partition_dpe
21 PRIVATE
Jamie Fox34681992023-09-04 18:14:06 +010022 dpe_boot_data.c
Maulik Patel2358bbb2023-07-21 10:56:56 +010023 dpe_certificate.c
Jamie Foxab30e712023-03-30 17:48:36 +010024 dpe_cmd_decode.c
Maulik Patelad2f3db2023-05-17 15:41:36 +010025 dpe_context_mngr.c
Maulik Patel58595d32023-06-22 10:08:53 +010026 dpe_crypto_interface.c
Jamie Foxe7f8b4e2023-05-30 18:03:20 +010027 dpe_log.c
Jamie Foxab30e712023-03-30 17:48:36 +010028 dpe_req_mngr.c
29)
30
31# Add the source files generated by parse tools when building.
32# The intermedia file defines the partition stack.
33target_sources(tfm_app_rot_partition_dpe
34 PRIVATE
35 ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/dice_protection_environment/auto_generated/intermedia_tfm_dpe.c
36)
37
38# The load info file includes the static data of the partition.
39target_sources(tfm_partitions
40 INTERFACE
41 ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/dice_protection_environment/auto_generated/load_info_tfm_dpe.c
42)
43
44target_include_directories(tfm_app_rot_partition_dpe
45 PRIVATE
46 ${CMAKE_CURRENT_SOURCE_DIR}
47 PUBLIC
48 ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/dice_protection_environment
49)
50
Maulik Patelad2f3db2023-05-17 15:41:36 +010051target_compile_definitions(tfm_app_rot_partition_dpe
52 PRIVATE
Jamie Fox34681992023-09-04 18:14:06 +010053 $<$<BOOL:${TFM_S_REG_TEST}>:DPE_TEST_MODE>
Maulik Patelad2f3db2023-05-17 15:41:36 +010054)
55
Jamie Foxab30e712023-03-30 17:48:36 +010056target_link_libraries(tfm_app_rot_partition_dpe
57 PRIVATE
58 tfm_sprt
59 qcbor
Maulik Patel2358bbb2023-07-21 10:56:56 +010060 tfm_t_cose_s
Jamie Fox34681992023-09-04 18:14:06 +010061 platform_s
Jamie Foxab30e712023-03-30 17:48:36 +010062)
63
64############################ Secure API ########################################
65
66target_sources(tfm_sprt
67 PRIVATE
68 ${CMAKE_CURRENT_SOURCE_DIR}/interface/src/dpe_cmd_encode.c
69 ${CMAKE_CURRENT_SOURCE_DIR}/interface/src/dpe_client.c
70)
71
72target_include_directories(tfm_sprt
73 PUBLIC
74 ${CMAKE_CURRENT_SOURCE_DIR}/interface/include
75)
76
77target_link_libraries(tfm_sprt
78 PRIVATE
79 qcbor
80)
81
82############################ Non-secure API ####################################
83
84add_library(dpe_api_ns INTERFACE)
85
86target_sources(dpe_api_ns
87 INTERFACE
88 ${CMAKE_CURRENT_SOURCE_DIR}/interface/src/dpe_cmd_encode.c
89 ${CMAKE_CURRENT_SOURCE_DIR}/interface/src/dpe_client.c
90)
91
92target_include_directories(dpe_api_ns
93 INTERFACE
94 ${CMAKE_CURRENT_SOURCE_DIR}/interface/include
95)
96
97target_link_libraries(dpe_api_ns
98 INTERFACE
99 tfm_qcbor_ns
100)
101
102############################ Partition Defs ####################################
103
104target_link_libraries(tfm_partitions
105 INTERFACE
106 tfm_app_rot_partition_dpe
107)
108
109target_compile_definitions(tfm_config
110 INTERFACE
111 TFM_PARTITION_DPE
112)
113
114install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/interface/src/dpe_cmd_encode.c
115 ${CMAKE_CURRENT_SOURCE_DIR}/interface/src/dpe_client.c
116 DESTINATION ${TFM_INSTALL_PATH}/interface/src)
117
118install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/interface/include/dice_protection_environment.h
119 ${CMAKE_CURRENT_SOURCE_DIR}/interface/include/dpe_client.h
120 DESTINATION ${TFM_INSTALL_PATH}/interface/include)