blob: 5fd777a28e7d25d19684b1f8f827d6753c0306c4 [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
Raef Colesb8c93e32021-06-03 10:10:45 +010020target_sources(tfm_app_rot_partition_example
Boris Deletic08f48962020-10-28 12:42:58 +000021 PRIVATE
22 tfm_example_partition.c
23)
24
Raef Colesb8c93e32021-06-03 10:10:45 +010025target_include_directories(tfm_app_rot_partition_example
Boris Deletic08f48962020-10-28 12:42:58 +000026 PRIVATE
27 $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
28 ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/example_partition
29)
30
Raef Colesb8c93e32021-06-03 10:10:45 +010031target_link_libraries(tfm_app_rot_partition_example
Boris Deletic08f48962020-10-28 12:42:58 +000032 PRIVATE
33 tfm_secure_api
34 psa_interface
35 platform_s
36)
37
38############################ Secure API ########################################
39
40target_sources(tfm_secure_api
Raef Colesb8c93e32021-06-03 10:10:45 +010041 INTERFACE
Boris Deletic08f48962020-10-28 12:42:58 +000042 ${CMAKE_CURRENT_SOURCE_DIR}/tfm_example_partition_secure_api.c
43)
44
45# The veneers give warnings about not being properly declared so they get hidden
46# to not overshadow _real_ warnings.
47set_source_files_properties(tfm_example_partition_secure_api.c
48 PROPERTIES
49 COMPILE_FLAGS -Wno-implicit-function-declaration
50)
51
52############################ Partition Defs ####################################
53
54target_link_libraries(tfm_partitions
55 INTERFACE
Raef Colesb8c93e32021-06-03 10:10:45 +010056 tfm_app_rot_partition_example
Boris Deletic08f48962020-10-28 12:42:58 +000057)
58
59target_compile_definitions(tfm_partition_defs
60 INTERFACE
61 TFM_PARTITION_EXAMPLE
62)