Example: Update example partition
To fix some docs and cmake issues
Change-Id: I13b486da854651839ce6ca19c8d0362ac72b02dc
Signed-off-by: Raef Coles <raef.coles@arm.com>
diff --git a/example_partition/CMakeLists.txt b/example_partition/CMakeLists.txt
index a39a69b..5fd777a 100644
--- a/example_partition/CMakeLists.txt
+++ b/example_partition/CMakeLists.txt
@@ -1,5 +1,5 @@
#-------------------------------------------------------------------------------
-# Copyright (c) 2020, Arm Limited. All rights reserved.
+# Copyright (c) 2020-2021, Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -12,20 +12,23 @@
cmake_minimum_required(VERSION 3.15)
cmake_policy(SET CMP0079 NEW)
-add_library(tfm_partition_example STATIC)
+# 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)
-target_sources(tfm_partition_example
+target_sources(tfm_app_rot_partition_example
PRIVATE
tfm_example_partition.c
)
-target_include_directories(tfm_partition_example
+target_include_directories(tfm_app_rot_partition_example
PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
${CMAKE_BINARY_DIR}/generated/secure_fw/partitions/example_partition
)
-target_link_libraries(tfm_partition_example
+target_link_libraries(tfm_app_rot_partition_example
PRIVATE
tfm_secure_api
psa_interface
@@ -35,7 +38,7 @@
############################ Secure API ########################################
target_sources(tfm_secure_api
- PRIVATE
+ INTERFACE
${CMAKE_CURRENT_SOURCE_DIR}/tfm_example_partition_secure_api.c
)
@@ -50,7 +53,7 @@
target_link_libraries(tfm_partitions
INTERFACE
- tfm_partition_example
+ tfm_app_rot_partition_example
)
target_compile_definitions(tfm_partition_defs
diff --git a/example_partition/tfm_example_partition.yaml b/example_partition/tfm_example_partition.yaml
index c9a230e..26be598 100644
--- a/example_partition/tfm_example_partition.yaml
+++ b/example_partition/tfm_example_partition.yaml
@@ -1,5 +1,5 @@
#-------------------------------------------------------------------------------
-# Copyright (c) 2020, Arm Limited. All rights reserved.
+# Copyright (c) 2020-2021, Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -21,7 +21,9 @@
"services": [
{
"name": "TFM_EXAMPLE_SERVICE",
- "sid": "0x0000F120",
+ # SIDs must be unique, ones that are currently in use are documented in
+ # tfm_secure_partition_addition.rst on line 184
+ "sid": "0x00001000",
"non_secure_clients": true,
"version": 1,
"version_policy": "STRICT"
diff --git a/example_partition/tfm_example_partition_readme.rst b/example_partition/tfm_example_partition_readme.rst
index 47aca5c..571161a 100644
--- a/example_partition/tfm_example_partition_readme.rst
+++ b/example_partition/tfm_example_partition_readme.rst
@@ -10,7 +10,16 @@
********************************
#. Copy the ``example_partition`` directory to the ``secure_fw/partitions``
directory of the TF-M repo.
-#. Add the following entry to ``tools/tfm_manifest_list.yaml``::
+
+#. Add the partition to the TF-M CMake by inserting
+ ``add_subdirectory(partitions/example_partition)`` in
+ ``secure_fw/CMakeLists.txt``, in the block below the line
+ ``add_subdirectory(partitions/lib/sprt)``.
+
+#. Add the following entry to ``tools/tfm_manifest_list.yaml``. The ``pid``
+ field must be unique (currently used partition ids are documented in
+ tfm_secure_partition_addition.rst on line 150), or can omitted which will
+ allocate one automatically. ::
{
"name": "TF-M Example Partition",
@@ -20,10 +29,10 @@
"conditional": "TFM_PARTITION_EXAMPLE",
"version_major": 0,
"version_minor": 1,
- "pid": 270,
+ "pid": 356,
"linker_pattern": {
"library_list": [
- "*tfm_partition_example.*"
+ "*tfm_*partition_example.*"
]
}
}
@@ -33,4 +42,4 @@
--------------
-*Copyright (c) 2020, Arm Limited. All rights reserved.*
+*Copyright (c) 2020-2021, Arm Limited. All rights reserved.*