blob: 20c6aa9ac0209b7c3812bf3a2ef29d872dc62312 [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
Kevin Peng6256bf52023-08-29 11:20:59 +080038# Add dependency to the manifest_tool
39add_dependencies(tfm_app_rot_partition_example manifest_tool)
40
Anton Komlev4bfd6c52022-06-29 17:10:26 +010041target_include_directories(tfm_app_rot_partition_example
42 PRIVATE
Kevin Penga9ec66f2022-07-05 15:21:16 +080043 ${CMAKE_CURRENT_SOURCE_DIR}
Anton Komlev4bfd6c52022-06-29 17:10:26 +010044 PUBLIC
Kevin Penga9ec66f2022-07-05 15:21:16 +080045 ${CMAKE_BINARY_DIR}/generated/example_partition
Anton Komlev4bfd6c52022-06-29 17:10:26 +010046)
47
48target_link_libraries(tfm_app_rot_partition_example
49 PRIVATE
Anton Komlev4bfd6c52022-06-29 17:10:26 +010050 tfm_sprt
51)
52
53############################ Secure API ########################################
54
Kevin Penga9ec66f2022-07-05 15:21:16 +080055target_sources(tfm_sprt
Anton Komlev4bfd6c52022-06-29 17:10:26 +010056 INTERFACE
Kevin Penga9ec66f2022-07-05 15:21:16 +080057 ${CMAKE_CURRENT_SOURCE_DIR}/tfm_example_partition_api.c
58)
59
60target_include_directories(tfm_sprt
61 PUBLIC
62 .
Anton Komlev4bfd6c52022-06-29 17:10:26 +010063)
64
Anton Komlev4bfd6c52022-06-29 17:10:26 +010065############################ Partition Defs ####################################
66
67target_link_libraries(tfm_partitions
68 INTERFACE
69 tfm_app_rot_partition_example
70)
71
Xinyu Zhang91204132023-06-19 19:08:43 +080072target_compile_definitions(tfm_config
Anton Komlev4bfd6c52022-06-29 17:10:26 +010073 INTERFACE
74 TFM_PARTITION_EXAMPLE
75)