blob: 0aabff2f831b97e3de04aff8728489dacd928854 [file] [log] [blame]
Boris Deletic08f48962020-10-28 12:42:58 +00001#-------------------------------------------------------------------------------
Raef Colesb8c93e32021-06-03 10:10:45 +01002# Copyright (c) 2020-2021, Arm Limited. All rights reserved.
Boris Deletic08f48962020-10-28 12:42:58 +00003#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6#-------------------------------------------------------------------------------
7
8if (NOT TFM_PARTITION_EXAMPLE)
9 return()
10endif()
11
12cmake_minimum_required(VERSION 3.15)
13cmake_policy(SET CMP0079 NEW)
14
Raef Colesb8c93e32021-06-03 10:10:45 +010015# 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_example STATIC)
Boris Deletic08f48962020-10-28 12:42:58 +000019
Shawn Shanfe9cd2d2021-06-18 13:34:13 +080020# Add the source files generated by parse tools when building. The intermedia
21# file defines the partition stack. The load info file includes the static data
22# of the partition.
Raef Colesb8c93e32021-06-03 10:10:45 +010023target_sources(tfm_app_rot_partition_example
Boris Deletic08f48962020-10-28 12:42:58 +000024 PRIVATE
25 tfm_example_partition.c
Shawn Shanfe9cd2d2021-06-18 13:34:13 +080026 $<$<BOOL:${TFM_PSA_API}>:
27 ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/example_partition/auto_generated/intermedia_tfm_example_partition.c>
28)
29target_sources(tfm_partitions
30 INTERFACE
31 $<$<BOOL:${TFM_PSA_API}>:
32 ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/example_partition/auto_generated/load_info_tfm_example_partition.c>
Boris Deletic08f48962020-10-28 12:42:58 +000033)
34
Raef Colesb8c93e32021-06-03 10:10:45 +010035target_include_directories(tfm_app_rot_partition_example
Boris Deletic08f48962020-10-28 12:42:58 +000036 PRIVATE
37 $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
Shawn Shanfe9cd2d2021-06-18 13:34:13 +080038 PUBLIC
Boris Deletic08f48962020-10-28 12:42:58 +000039 ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/example_partition
40)
41
Raef Colesb8c93e32021-06-03 10:10:45 +010042target_link_libraries(tfm_app_rot_partition_example
Boris Deletic08f48962020-10-28 12:42:58 +000043 PRIVATE
44 tfm_secure_api
45 psa_interface
46 platform_s
Shawn Shan77ea2312021-06-17 14:58:53 +080047 tfm_sprt
Boris Deletic08f48962020-10-28 12:42:58 +000048)
49
50############################ Secure API ########################################
51
52target_sources(tfm_secure_api
Raef Colesb8c93e32021-06-03 10:10:45 +010053 INTERFACE
Boris Deletic08f48962020-10-28 12:42:58 +000054 ${CMAKE_CURRENT_SOURCE_DIR}/tfm_example_partition_secure_api.c
55)
56
57# The veneers give warnings about not being properly declared so they get hidden
58# to not overshadow _real_ warnings.
59set_source_files_properties(tfm_example_partition_secure_api.c
60 PROPERTIES
61 COMPILE_FLAGS -Wno-implicit-function-declaration
62)
63
64############################ Partition Defs ####################################
65
66target_link_libraries(tfm_partitions
67 INTERFACE
Raef Colesb8c93e32021-06-03 10:10:45 +010068 tfm_app_rot_partition_example
Boris Deletic08f48962020-10-28 12:42:58 +000069)
70
71target_compile_definitions(tfm_partition_defs
72 INTERFACE
73 TFM_PARTITION_EXAMPLE
74)