blob: ac3f4c38d2a2a0eace95a977e30630185c4048ce [file] [log] [blame]
Kevin Penga9ec66f2022-07-05 15:21:16 +08001######################
2TF-M Example Partition
3######################
4The TF-M example partition is a simple Secure Partition implementation provided
5to aid development of new Secure Partitions.
6
7It is an Application RoT, SFN model Secure Partition and implements an
8connection-based RoT Service.
9
10Please refer to `PSA Firmware Framework 1.0`_
11and `Firmware Framework for M 1.1 Extensions`_
12for details of the attributes of Secure Partitions.
13
14Please refer to `Adding Secure Partition`_
15for more details of adding a new Secure Partition to TF-M.
16
17**************
18File structure
19**************
20
21.. code-block:: bash
22
23 .
24 ├── CMakeLists.txt
25 ├── README.rst
26 ├── tfm_example_manifest_list.yaml
27 ├── tfm_example_partition_api.c
28 ├── tfm_example_partition_api.h
29 ├── tfm_example_partition.c
30 └── tfm_example_partition.yaml
31
32- ``CMakeLists.txt``
33
34 The CMake file for building this example Secure Partitions.
35 It is specific to the TF-M build system.
36
37- ``README.rst``
38
39 This document.
40
41- ``tfm_example_partition.yaml``
42
43 The manifest of this Secure Partition.
44
45- ``tfm_example_manifest_list.yaml``
46
47 The manifest list that describes the Secure Partition manifest of this Secure
48 Partition. See `TF-M Manifest List`_ for details of manifest lists.
49
50- ``tfm_example_partition.c``
51
52 The core implementation of this Secure Partition.
53
54- ``tfm_example_partition_api.c``
55
56 The APIs for accessing the RoT Services provided by this Secure Partition.
57
58- ``tfm_example_partition_api.h``
59
60 The header file that declares the RoT Services APIs.
61
62************
63How to Build
64************
65It is recommended to build this example Secure Partition via out-of-tree build.
66It can minimize the changes to TF-M source code for building and testing the
67example.
68
69To build, append the following extra build configurations to the CMake build
70commands.
71
72- ``-DTFM_PARTITION_EXAMPLE``
73
74 This is the configuration switch to enable or disable building this example.
75 Set to ``ON`` to enable or ``OFF`` to disable.
76
77- ``-DTFM_EXTRA_PARTITION_PATHS``
78
79 Set it to the absolute path of this directory.
80
81- ``-DTFM_EXTRA_MANIFEST_LIST_FILES``
82
83 Set it to the absolute path of the manifest list mentioned above -
84 ``tfm_example_manifest_list.yaml``.
85
86Refer to `Out-of-tree Secure Partition build`_ for more details.
87
88***********
89How to Test
90***********
91To test the RoT Services, you need to build the APIs and call the service APIs
92somewhere.
93
94If you want to add comprehensive tests using the TF-M test framework, please
95refer to `Adding TF-M Regression Test Suite`_.
96
97Testing in NSPE
98===============
99Any NSPE can be used to test the example RoT services.
100If you are using the tf-m-tests repo as NSPE, you can:
101
102- Add the ``tfm_example_partition_api.c`` to ``tfm_ns_api`` CMake library.
103- Add the current directory in the include directory of ``tfm_ns_api``.
104- Call the services APIs in the ``test_app`` function.
105
106Testing in SPE
107==============
108
109Testing in SPE is to test requesting the RoT Services in any Secure Partition.
110
111- Add the example services to the ``dependencies`` attribute in the target
112 Secure Partition's manifest.
113- Call the services APIs somewhere in the Secure Partition, for example, in the
114 entry function.
115
116Note that the API source file has already been added in the ``CMakeLists.txt``.
117There are no extra steps to build the APIs for testing in SPE.
118
119**********
120References
121**********
122
123| `PSA Firmware Framework 1.0`_
124| `Firmware Framework for M 1.1 Extensions`_
125| `Adding Secure Partition`_
126| `TF-M Manifest List`_
127| `Out-of-tree Secure Partition build`_
128| `Adding TF-M Regression Test Suite`_
129
130.. _PSA Firmware Framework 1.0:
131 https://developer.arm.com/-/media/Files/pdf/PlatformSecurityArchitecture/Architect/DEN0063-PSA_Firmware_Framework-1.0.0-2.pdf?revision=2d1429fa-4b5b-461a-a60e-4ef3d8f7f4b4
132
133.. _Firmware Framework for M 1.1 Extensions:
134 https://documentation-service.arm.com/static/600067c09b9c2d1bb22cd1c5?token=
135
136.. _Adding Secure Partition:
Elena Uziunaite3ad0ecc2023-10-27 15:15:35 +0100137 https://trustedfirmware-m.readthedocs.io/en/latest/integration_guide/services/tfm_secure_partition_addition.html
Kevin Penga9ec66f2022-07-05 15:21:16 +0800138
139.. _TF-M Manifest List:
Elena Uziunaite3ad0ecc2023-10-27 15:15:35 +0100140 https://trustedfirmware-m.readthedocs.io/en/latest/integration_guide/services/tfm_manifest_tool_user_guide.html#manifest-list
Kevin Penga9ec66f2022-07-05 15:21:16 +0800141
142.. _Out-of-tree Secure Partition build:
Elena Uziunaite3ad0ecc2023-10-27 15:15:35 +0100143 https://trustedfirmware-m.readthedocs.io/en/latest/integration_guide/services/tfm_secure_partition_addition.html#out-of-tree-secure-partition-build
Kevin Penga9ec66f2022-07-05 15:21:16 +0800144
145.. _Adding TF-M Regression Test Suite:
146 https://git.trustedfirmware.org/TF-M/tf-m-tests.git/tree/docs/tfm_test_suites_addition.rst
147
148--------------
149
150*Copyright (c) 2020-2022, Arm Limited. All rights reserved.*