blob: 87e46b35eb56313b789723911b4ff4891705eb62 [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
47 tfm_secure_api
48 psa_interface
Anton Komlev4bfd6c52022-06-29 17:10:26 +010049 tfm_sprt
50)
51
52############################ Secure API ########################################
53
Kevin Penga9ec66f2022-07-05 15:21:16 +080054target_sources(tfm_sprt
Anton Komlev4bfd6c52022-06-29 17:10:26 +010055 INTERFACE
Kevin Penga9ec66f2022-07-05 15:21:16 +080056 ${CMAKE_CURRENT_SOURCE_DIR}/tfm_example_partition_api.c
57)
58
59target_include_directories(tfm_sprt
60 PUBLIC
61 .
Anton Komlev4bfd6c52022-06-29 17:10:26 +010062)
63
64# The veneers give warnings about not being properly declared so they get hidden
65# to not overshadow _real_ warnings.
Kevin Penga9ec66f2022-07-05 15:21:16 +080066set_source_files_properties(tfm_example_partition_api.c
Anton Komlev4bfd6c52022-06-29 17:10:26 +010067 PROPERTIES
68 COMPILE_FLAGS -Wno-implicit-function-declaration
69)
70
71############################ Partition Defs ####################################
72
73target_link_libraries(tfm_partitions
74 INTERFACE
75 tfm_app_rot_partition_example
76)
77
78target_compile_definitions(tfm_partition_defs
79 INTERFACE
80 TFM_PARTITION_EXAMPLE
81)