You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add documentation for more TF-M-related configurations:
* TF-M version supported
* Support for TF-M bootloader and two image slots
* post binary hooks
Combine documentation for dual-core and Armv8-M targets, as the
steps are basically identical. This reduces maintenance required
and improves readability.
@@ -16,7 +16,7 @@ Before reading this document, please read [porting a custom board](../porting/po
16
16
To help create PSA targets, we have added a few generic targets to `targets/targets.json`:
17
17
18
18
*`PSA_Target`: Root level PSA target.
19
-
*`PSA_V7_M`: Single v7-M generic PSA target, which doesn't employ hardware isolation between the NSPE and the SPE. PSA secure service emulation enables PSA API compatibility.
19
+
*`PSA_V7_M`: Single v7-M generic PSA target, which doesn't employ hardware isolation between the NSPE and the SPE, so TF-M is not supported. PSA secure service emulation enables PSA API compatibility.
20
20
*`PSA_DUAL_CORE`: Dual-core generic PSA target. A dual-core PSA target has at least two cores that are either Armv7-M or Armv6-M. One core will be used for the SPE and another for the NSPE. Hardware isolation between the cores enables PSA compliance. On dual-core targets, TF-M
21
21
runs on the SPE and provides PSA services, and Mbed OS runs on the NSPE.
22
22
*`PSA_V8_M`: Armv8-M generic PSA target, which employs hardware to isolate the NSPE from the SPE. TF-M runs on the SPE and provides PSA services, and Mbed OS runs on the NSPE.
@@ -39,10 +39,10 @@ Example of a single-core Armv7-M PSA target's inheritance:
39
39
}
40
40
```
41
41
42
-
### Adding single-core PSA targets
42
+
### Adding single-core (non-TF-M) PSA targets
43
43
44
44
Mbed OS's PSA service emulation provides PSA compatibility for single-core PSA
45
-
targets.
45
+
targets which do not support TF-M.
46
46
47
47
The following example shows a PSA-enabled single-core target, `K64F`:
48
48
@@ -163,16 +163,20 @@ In this case, you must add the following additional attributes:
163
163
]
164
164
```
165
165
166
-
### Adding dual-core PSA targets
166
+
### Adding TF-M (dual-core or Armv8-M) PSA targets
167
167
168
-
A target can be categorized as a dual-core target if it has at least two cores that are either Armv7-M or Armv6-M. On dual-core PSA targets, TF-M runs on the SPE and provides PSA services.
168
+
An Mbed OS (NSPE) target that supports TF-M must contain the following attributes (in addition to other target attributes defined in [porting a custom board](../porting/porting-a-custom-board.html)and [porting targets](../porting/porting-the-hal-apis.html)):
169
169
170
-
An Mbed OS (NSPE) target must contain the following attributes (in addition to other target attributes defined in [porting a custom board](../porting/porting-a-custom-board.html) and [porting targets](../porting/porting-the-hal-apis.html)):
171
-
172
-
*`inherits`: PSA generic target `PSA_DUAL_CORE`, unless the target has to inherit
170
+
*`inherits`: PSA generic target `PSA_DUAL_CORE` or `PSA_V8_M`, unless the target has to inherit
173
171
from one of its family targets.
172
+
*`extra_labels`: `TARGET_`[label] paths to enable.
173
+
*`TFM_LATEST`: If the latest release of TF-M is supported by the target.
174
+
*`TFM_V`[major]`_`[minor]: If a legacy release of TF-M is supported by the target.
175
+
*`macros_add`: C/C++ macros that are globally set during compilation.
176
+
*`BL2`: If the TF-M bootloader is supported by the target.
177
+
*`MCUBOOT_IMAGE_NUMBER=2`: If the secure and non-secure images are in two separate bootloader slots.
174
178
*`tfm_target_name`: Target name in TF-M.
175
-
*`tfm_bootloader_supported`: If TF-M bootloader is supported by the target.
179
+
*`tfm_bootloader_supported`: If the TF-M bootloader is supported by the target.
@@ -183,108 +187,11 @@ An Mbed OS (NSPE) target must contain the following attributes (in addition to o
183
187
The supported values are `ARMCLANG` and `GNUARM`.
184
188
*`tfm_delivery_dir`: The directory to which TF-M binaries will be copied.
185
189
*`TFM_OUTPUT_EXT`: Optional attribute that indicates the output extension of the TF-M secure binary.
190
+
*`post_binary_hook`:
191
+
*`function`: The target's post binary hook ([class].[method]) in `tools/targets/__init__.py` for image signing, required if the TF-M bootloader support is supported.
192
+
*`secure_image_filename`: The file name of the TF-M secure binary, to be signed by the post binary hook.
186
193
187
-
The following example shows a PSA enabled dual-core target, `PSoC64`:
Please note the config options `macros_add`, `extra_labels_add` and `device_has_remove`. To add or remove `macros`, `extra_labels` or target capabilities, a PSA target definition must use
248
-
[macros/extra_labels/device_has]`_add` or [macros/extra_labels/device_has]`_remove` (not `macros`, `extra_labels` or `device_has`).
249
-
250
-
To add or remove a feature, use `feature_`[add/remove].
251
-
252
-
By default, a TF-M build generates a `bin` file. If the target requires a `hex` file, you need to add the attribute `"TFM_OUTPUT_EXT": "hex"` to the target definition. The build script will convert `bin` to `hex`, then copy the `hex` to `tfm_delivery_dir`.
253
-
254
-
This dual-core PSA target doesn't inherit from `PSA_DUAL_CORE` because it has to inherit from one of its family targets. Hence, we have added additional attributes:
255
-
256
-
```json
257
-
"features_add": [
258
-
"PSA"
259
-
],
260
-
"extra_labels_add": [
261
-
"TFM",
262
-
"TFM_DUALCPU"
263
-
]
264
-
```
265
-
266
-
If a dual-core PSA target can inherit from `PSA_DUAL_CORE`, then there is no need to add these additional attributes.
267
-
268
-
### Adding Armv8-M PSA targets
269
-
270
-
An Mbed OS (NSPE) target must contain the following attributes (in addition to other target attributes defined in [porting a custom board](../porting/porting-a-custom-board.html)
271
-
and [porting targets](../porting/porting-the-hal-apis.html)):
272
-
273
-
*`inherits`: PSA generic target `PSA_V8_M`, unless the target has to inherit from
274
-
one of its family targets.
275
-
*`tfm_target_name`: Target name in TF-M.
276
-
*`tfm_bootloader_supported`: If TF-M bootloader is supported by the target.
*`tfm_delivery_dir`: The directory to which TF-M binary will be copied.
287
-
*`TFM_OUTPUT_EXT`: Optional attribute that indicates the output extension of the TF-M secure binary.
194
+
**Note**: When `inherits` is used, some of attributes are set by the PSA generic target.
288
195
289
196
The following example shows a PSA-enabled Armv8-M PSA target, `ARM_MUSCA_A1`:
290
197
@@ -345,17 +252,19 @@ To add or remove a feature, use `feature_`[add/remove].
345
252
346
253
By default, a TF-M build generates a `bin` file. If the target requires a `hex` file, you need to add the attribute `"TFM_OUTPUT_EXT": "hex"` to the target definition. The build script will convert `bin` to `hex`, then copy the `hex` to `tfm_delivery_dir`. You must also update `secure_image_filename` to match the new file extension.
347
254
348
-
If an Armv8-M PSA target cannot inherit from `PSA_V8_M` because it has to inherit from one of its family targets, you must add the following attributes:
255
+
If a PSA target cannot inherit from `PSA_V8_M`or `PSA_DUAL_CORE`because it has to inherit from one of its family targets, you must declare PSA and TF-M attributes manually. For example,
349
256
350
257
```json
351
258
"features_add": [
352
259
"PSA"
353
260
],
354
261
"extra_labels_add": [
355
262
"TFM",
263
+
"TFM_LATEST",
356
264
"TFM_V8M"
357
265
]
358
266
```
267
+
(Please adjust the TF-M version and target architecture accordingly.)
0 commit comments