blob: cb31de69f961e3c9abde5e3474923bede359f218 [file] [log] [blame]
Anton Komlev4bfd6c52022-06-29 17:10:26 +01001#-------------------------------------------------------------------------------
Kevin Penga9ec66f2022-07-05 15:21:16 +08002# Copyright (c) 2020-2022, Arm Limited. All rights reserved.
Anton Komlev4bfd6c52022-06-29 17:10:26 +01003#
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
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_example STATIC)
19
Anton Komlev4bfd6c52022-06-29 17:10:26 +010020target_sources(tfm_app_rot_partition_example
21 PRIVATE
22 tfm_example_partition.c
Anton Komlev4bfd6c52022-06-29 17:10:26 +010023)
Kevin Penga9ec66f2022-07-05 15:21:16 +080024
25# Add the source files generated by parse tools when building.
26# The intermedia file defines the partition stack.
27target_sources(tfm_app_rot_partition_example
28 PRIVATE
29 ${CMAKE_BINARY_DIR}/generated/example_partition/auto_generated/intermedia_tfm_example_partition.c
30)
31
32# The load info file includes the static data of the partition.
Anton Komlev4bfd6c52022-06-29 17:10:26 +010033target_sources(tfm_partitions
34 INTERFACE
Kevin Penga9ec66f2022-07-05 15:21:16 +080035 ${CMAKE_BINARY_DIR}/generated/example_partition/auto_generated/load_info_tfm_example_partition.c
Anton Komlev4bfd6c52022-06-29 17:10:26 +010036)
37
38target_include_directories(tfm_app_rot_partition_example
39 PRIVATE
Kevin Penga9ec66f2022-07-05 15:21:16 +080040 ${CMAKE_CURRENT_SOURCE_DIR}
Anton Komlev4bfd6c52022-06-29 17:10:26 +010041 PUBLIC
Kevin Penga9ec66f2022-07-05 15:21:16 +080042 ${CMAKE_BINARY_DIR}/generated/example_partition
Anton Komlev4bfd6c52022-06-29 17:10:26 +010043)
44
45target_link_libraries(tfm_app_rot_partition_example
46 PRIVATE
Anton Komlev4bfd6c52022-06-29 17:10:26 +010047 psa_interface
Anton Komlev4bfd6c52022-06-29 17:10:26 +010048 tfm_sprt
49)
50
51############################ Secure API ########################################
52
Kevin Penga9ec66f2022-07-05 15:21:16 +080053target_sources(tfm_sprt
Anton Komlev4bfd6c52022-06-29 17:10:26 +010054 INTERFACE
Kevin Penga9ec66f2022-07-05 15:21:16 +080055 ${CMAKE_CURRENT_SOURCE_DIR}/tfm_example_partition_api.c
56)
57
58target_include_directories(tfm_sprt
59 PUBLIC
60 .
Anton Komlev4bfd6c52022-06-29 17:10:26 +010061)
62
Anton Komlev4bfd6c52022-06-29 17:10:26 +010063############################ Partition Defs ####################################
64
65target_link_libraries(tfm_partitions
66 INTERFACE
67 tfm_app_rot_partition_example
68)
69
Xinyu Zhang91204132023-06-19 19:08:43 +080070target_compile_definitions(tfm_config
Anton Komlev4bfd6c52022-06-29 17:10:26 +010071 INTERFACE
72 TFM_PARTITION_EXAMPLE
73)