blob: b423b877bc812c114bf81bbe8d11011929da2d88 [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
Elena Uziunaite676a1462023-11-14 16:58:45 +000014Please refer to :doc:`Adding Secure Partition <TF-M:integration_guide/services/tfm_secure_partition_addition>`
Kevin Penga9ec66f2022-07-05 15:21:16 +080015for more details of adding a new Secure Partition to TF-M.
16
Elena Uziunaite676a1462023-11-14 16:58:45 +000017.. file-structure:
18
Kevin Penga9ec66f2022-07-05 15:21:16 +080019**************
20File structure
21**************
22
23.. code-block:: bash
24
25 .
26 ├── CMakeLists.txt
27 ├── README.rst
28 ├── tfm_example_manifest_list.yaml
29 ├── tfm_example_partition_api.c
30 ├── tfm_example_partition_api.h
31 ├── tfm_example_partition.c
32 └── tfm_example_partition.yaml
33
34- ``CMakeLists.txt``
35
36 The CMake file for building this example Secure Partitions.
37 It is specific to the TF-M build system.
38
39- ``README.rst``
40
41 This document.
42
43- ``tfm_example_partition.yaml``
44
45 The manifest of this Secure Partition.
46
47- ``tfm_example_manifest_list.yaml``
48
49 The manifest list that describes the Secure Partition manifest of this Secure
50 Partition. See `TF-M Manifest List`_ for details of manifest lists.
51
52- ``tfm_example_partition.c``
53
54 The core implementation of this Secure Partition.
55
56- ``tfm_example_partition_api.c``
57
58 The APIs for accessing the RoT Services provided by this Secure Partition.
59
60- ``tfm_example_partition_api.h``
61
62 The header file that declares the RoT Services APIs.
63
64************
65How to Build
66************
67It is recommended to build this example Secure Partition via out-of-tree build.
68It can minimize the changes to TF-M source code for building and testing the
69example.
70
71To build, append the following extra build configurations to the CMake build
72commands.
73
74- ``-DTFM_PARTITION_EXAMPLE``
75
76 This is the configuration switch to enable or disable building this example.
77 Set to ``ON`` to enable or ``OFF`` to disable.
78
79- ``-DTFM_EXTRA_PARTITION_PATHS``
80
81 Set it to the absolute path of this directory.
82
83- ``-DTFM_EXTRA_MANIFEST_LIST_FILES``
84
85 Set it to the absolute path of the manifest list mentioned above -
86 ``tfm_example_manifest_list.yaml``.
87
88Refer to `Out-of-tree Secure Partition build`_ for more details.
89
90***********
91How to Test
92***********
93To test the RoT Services, you need to build the APIs and call the service APIs
94somewhere.
95
96If you want to add comprehensive tests using the TF-M test framework, please
Elena Uziunaite676a1462023-11-14 16:58:45 +000097refer to :doc:`Adding TF-M Regression Test Suite <TF-M-Tests:tfm_test_suites_addition>`.
Kevin Penga9ec66f2022-07-05 15:21:16 +080098
99Testing in NSPE
100===============
101Any NSPE can be used to test the example RoT services.
102If you are using the tf-m-tests repo as NSPE, you can:
103
104- Add the ``tfm_example_partition_api.c`` to ``tfm_ns_api`` CMake library.
105- Add the current directory in the include directory of ``tfm_ns_api``.
106- Call the services APIs in the ``test_app`` function.
107
108Testing in SPE
109==============
110
111Testing in SPE is to test requesting the RoT Services in any Secure Partition.
112
113- Add the example services to the ``dependencies`` attribute in the target
114 Secure Partition's manifest.
115- Call the services APIs somewhere in the Secure Partition, for example, in the
116 entry function.
117
118Note that the API source file has already been added in the ``CMakeLists.txt``.
119There are no extra steps to build the APIs for testing in SPE.
120
121**********
122References
123**********
124
125| `PSA Firmware Framework 1.0`_
126| `Firmware Framework for M 1.1 Extensions`_
Kevin Penga9ec66f2022-07-05 15:21:16 +0800127| `TF-M Manifest List`_
128| `Out-of-tree Secure Partition build`_
Kevin Penga9ec66f2022-07-05 15:21:16 +0800129
130.. _PSA Firmware Framework 1.0:
Elena Uziunaite676a1462023-11-14 16:58:45 +0000131 https://developer.arm.com/documentation/den0063/latest/
Kevin Penga9ec66f2022-07-05 15:21:16 +0800132
133.. _Firmware Framework for M 1.1 Extensions:
Elena Uziunaite676a1462023-11-14 16:58:45 +0000134 https://developer.arm.com/documentation/aes0039/latest/
Kevin Penga9ec66f2022-07-05 15:21:16 +0800135
136.. _TF-M Manifest List:
Elena Uziunaite3ad0ecc2023-10-27 15:15:35 +0100137 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 +0800138
139.. _Out-of-tree Secure Partition build:
Elena Uziunaite3ad0ecc2023-10-27 15:15:35 +0100140 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 +0800141
Kevin Penga9ec66f2022-07-05 15:21:16 +0800142--------------
143
144*Copyright (c) 2020-2022, Arm Limited. All rights reserved.*