Add example_partition from tf-m-tools

Signed-off-by: Anton Komlev <anton.komlev@arm.com>
Change-Id: I29baec63c1ea8e06457b92a6277fc5f2fa9ec335
diff --git a/examples/example_partition/CMakeLists.txt b/examples/example_partition/CMakeLists.txt
new file mode 100644
index 0000000..0aabff2
--- /dev/null
+++ b/examples/example_partition/CMakeLists.txt
@@ -0,0 +1,74 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2020-2021, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+if (NOT TFM_PARTITION_EXAMPLE)
+    return()
+endif()
+
+cmake_minimum_required(VERSION 3.15)
+cmake_policy(SET CMP0079 NEW)
+
+# The name of the target is required to be of the pattern
+# tfm_app_rot_partition_x or tfm_psa_rot_partition_x, as it affects how the
+# linker script will lay the partition in memory.
+add_library(tfm_app_rot_partition_example STATIC)
+
+# Add the source files generated by parse tools when building. The intermedia
+# file defines the partition stack. The load info file includes the static data
+# of the partition.
+target_sources(tfm_app_rot_partition_example
+    PRIVATE
+        tfm_example_partition.c
+        $<$<BOOL:${TFM_PSA_API}>:
+            ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/example_partition/auto_generated/intermedia_tfm_example_partition.c>
+)
+target_sources(tfm_partitions
+    INTERFACE
+        $<$<BOOL:${TFM_PSA_API}>:
+            ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/example_partition/auto_generated/load_info_tfm_example_partition.c>
+)
+
+target_include_directories(tfm_app_rot_partition_example
+    PRIVATE
+        $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
+    PUBLIC
+        ${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/example_partition
+)
+
+target_link_libraries(tfm_app_rot_partition_example
+    PRIVATE
+        tfm_secure_api
+        psa_interface
+        platform_s
+        tfm_sprt
+)
+
+############################ Secure API ########################################
+
+target_sources(tfm_secure_api
+    INTERFACE
+        ${CMAKE_CURRENT_SOURCE_DIR}/tfm_example_partition_secure_api.c
+)
+
+# The veneers give warnings about not being properly declared so they get hidden
+# to not overshadow _real_ warnings.
+set_source_files_properties(tfm_example_partition_secure_api.c
+    PROPERTIES
+        COMPILE_FLAGS -Wno-implicit-function-declaration
+)
+
+############################ Partition Defs ####################################
+
+target_link_libraries(tfm_partitions
+    INTERFACE
+        tfm_app_rot_partition_example
+)
+
+target_compile_definitions(tfm_partition_defs
+    INTERFACE
+        TFM_PARTITION_EXAMPLE
+)