Kevin Peng | a9ec66f | 2022-07-05 15:21:16 +0800 | [diff] [blame] | 1 | ###################### |
| 2 | TF-M Example Partition |
| 3 | ###################### |
| 4 | The TF-M example partition is a simple Secure Partition implementation provided |
| 5 | to aid development of new Secure Partitions. |
| 6 | |
| 7 | It is an Application RoT, SFN model Secure Partition and implements an |
| 8 | connection-based RoT Service. |
| 9 | |
| 10 | Please refer to `PSA Firmware Framework 1.0`_ |
| 11 | and `Firmware Framework for M 1.1 Extensions`_ |
| 12 | for details of the attributes of Secure Partitions. |
| 13 | |
Elena Uziunaite | 676a146 | 2023-11-14 16:58:45 +0000 | [diff] [blame] | 14 | Please refer to :doc:`Adding Secure Partition <TF-M:integration_guide/services/tfm_secure_partition_addition>` |
Kevin Peng | a9ec66f | 2022-07-05 15:21:16 +0800 | [diff] [blame] | 15 | for more details of adding a new Secure Partition to TF-M. |
| 16 | |
Elena Uziunaite | 676a146 | 2023-11-14 16:58:45 +0000 | [diff] [blame] | 17 | .. file-structure: |
| 18 | |
Kevin Peng | a9ec66f | 2022-07-05 15:21:16 +0800 | [diff] [blame] | 19 | ************** |
| 20 | File 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 | ************ |
| 65 | How to Build |
| 66 | ************ |
| 67 | It is recommended to build this example Secure Partition via out-of-tree build. |
| 68 | It can minimize the changes to TF-M source code for building and testing the |
| 69 | example. |
| 70 | |
| 71 | To build, append the following extra build configurations to the CMake build |
| 72 | commands. |
| 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 | |
| 88 | Refer to `Out-of-tree Secure Partition build`_ for more details. |
| 89 | |
| 90 | *********** |
| 91 | How to Test |
| 92 | *********** |
| 93 | To test the RoT Services, you need to build the APIs and call the service APIs |
| 94 | somewhere. |
| 95 | |
| 96 | If you want to add comprehensive tests using the TF-M test framework, please |
Elena Uziunaite | 676a146 | 2023-11-14 16:58:45 +0000 | [diff] [blame] | 97 | refer to :doc:`Adding TF-M Regression Test Suite <TF-M-Tests:tfm_test_suites_addition>`. |
Kevin Peng | a9ec66f | 2022-07-05 15:21:16 +0800 | [diff] [blame] | 98 | |
| 99 | Testing in NSPE |
| 100 | =============== |
| 101 | Any NSPE can be used to test the example RoT services. |
| 102 | If 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 | |
| 108 | Testing in SPE |
| 109 | ============== |
| 110 | |
| 111 | Testing 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 | |
| 118 | Note that the API source file has already been added in the ``CMakeLists.txt``. |
| 119 | There are no extra steps to build the APIs for testing in SPE. |
| 120 | |
| 121 | ********** |
| 122 | References |
| 123 | ********** |
| 124 | |
| 125 | | `PSA Firmware Framework 1.0`_ |
| 126 | | `Firmware Framework for M 1.1 Extensions`_ |
Kevin Peng | a9ec66f | 2022-07-05 15:21:16 +0800 | [diff] [blame] | 127 | | `TF-M Manifest List`_ |
| 128 | | `Out-of-tree Secure Partition build`_ |
Kevin Peng | a9ec66f | 2022-07-05 15:21:16 +0800 | [diff] [blame] | 129 | |
| 130 | .. _PSA Firmware Framework 1.0: |
Elena Uziunaite | 676a146 | 2023-11-14 16:58:45 +0000 | [diff] [blame] | 131 | https://developer.arm.com/documentation/den0063/latest/ |
Kevin Peng | a9ec66f | 2022-07-05 15:21:16 +0800 | [diff] [blame] | 132 | |
| 133 | .. _Firmware Framework for M 1.1 Extensions: |
Elena Uziunaite | 676a146 | 2023-11-14 16:58:45 +0000 | [diff] [blame] | 134 | https://developer.arm.com/documentation/aes0039/latest/ |
Kevin Peng | a9ec66f | 2022-07-05 15:21:16 +0800 | [diff] [blame] | 135 | |
| 136 | .. _TF-M Manifest List: |
Elena Uziunaite | 3ad0ecc | 2023-10-27 15:15:35 +0100 | [diff] [blame] | 137 | https://trustedfirmware-m.readthedocs.io/en/latest/integration_guide/services/tfm_manifest_tool_user_guide.html#manifest-list |
Kevin Peng | a9ec66f | 2022-07-05 15:21:16 +0800 | [diff] [blame] | 138 | |
| 139 | .. _Out-of-tree Secure Partition build: |
Elena Uziunaite | 3ad0ecc | 2023-10-27 15:15:35 +0100 | [diff] [blame] | 140 | https://trustedfirmware-m.readthedocs.io/en/latest/integration_guide/services/tfm_secure_partition_addition.html#out-of-tree-secure-partition-build |
Kevin Peng | a9ec66f | 2022-07-05 15:21:16 +0800 | [diff] [blame] | 141 | |
Kevin Peng | a9ec66f | 2022-07-05 15:21:16 +0800 | [diff] [blame] | 142 | -------------- |
| 143 | |
| 144 | *Copyright (c) 2020-2022, Arm Limited. All rights reserved.* |