|
1 | 1 | # PSA tools
|
2 | 2 |
|
3 |
| -This document describes the following scripts: |
| 3 | +## Code generation script |
4 | 4 |
|
5 |
| -* \_\_init\_\_.py |
6 |
| -* generate_partition_code.py |
7 |
| -* mbed_spm_tfm_common.py |
8 |
| -* release.py |
| 5 | +Mbed-OS contains two implementations of PSA Firmware Framework: |
9 | 6 |
|
10 |
| -## \_\_init\_\_.py |
11 |
| - |
12 |
| -This file holds common functions dedicated to help SiP with their post-build logic. |
| 7 | +* Mbed-SPM - Implementation for dual-core v7 targets. |
| 8 | +* TF-M - Implementation for v8 targets. |
13 | 9 |
|
14 |
| -* find_secure_image - Scans a Resource object to find the correct binary of the secure image to merge with the non-secure build. |
| 10 | +Both PSA Firmware Framework implementation impose the following requirements: |
15 | 11 |
|
16 |
| -## Code generation scripts |
| 12 | +* PSA manifests must be valid according to the JSON schema file provided by PSA FF spec. |
| 13 | +* There are no conflicts between various PSA manifests (duplicate SIDs and PIDs, dependencies, etc.) |
| 14 | +* Secure partition initialization code to be present at mbed-os core compile time. |
17 | 15 |
|
18 |
| -Mbed OS holds two implementations of PSA: |
| 16 | +To satisfy the requirement listed above, Mbed-OS build system invokes `generate_partition_code.py` script |
| 17 | +during the build process for PSA targets. |
19 | 18 |
|
20 |
| -* MBED_SPM - Implementation for dual-core v7 targets. |
21 |
| -* TF-M - Implementation for v8 targets. |
| 19 | +PSA code generation step has the following effects: |
| 20 | +* Scan the whole source tree for PSA manifest files, including application (in case invoked from application directory) and all the `TESTS` directories. |
| 21 | +* All found PSA manifest files get parsed and validated. |
| 22 | +* Source and header files for initializing SPM are generated. Test related partitions and SIDs are disabled by default by `#ifndef` guards. |
| 23 | + To enable them following defines must be passed to build command (typically done automatically via [release.py](#secure-image-generation)): |
| 24 | + * `-DUSE_PSA_TEST_PARTITIONS` |
| 25 | + * `-DUSE_<name>` where `<name>` corresponds to the name in PSA manifest file (`"name"` property). |
22 | 26 |
|
23 |
| -Each implementation requires a set of auto-generated files describing the secure partitions: |
| 27 | +## Secure image generation |
24 | 28 |
|
25 |
| -* `generate_partition_code.py` - Generate files for both implementations. |
26 |
| -* `mbed_spm_tfm_common.py` - Holds common functions for both. |
| 29 | +`release.py` is the script assigned with compiling the default secure images. |
27 | 30 |
|
28 |
| -## Secure image generation |
| 31 | +For an application with custom secure portions, the secure image should be generated by invoking `mbed-cli` directly. |
29 | 32 |
|
30 |
| -`release.py` is the script assigned with compiling the secure images: |
| 33 | +> **Note**: when building targets utilizing TF-M PSA implementations, add the following arguments to a build command for the secure image: |
| 34 | + `--app-config <mbed-os-root>/tools/psa/tfm/mbed_app.json` |
31 | 35 |
|
32 |
| -``` |
| 36 | +### Usage |
| 37 | +```text |
33 | 38 | usage: release.py [-h] [-m MCU] [-d] [-q] [-l] [--commit] [--skip-tests]
|
34 | 39 | [-x ...]
|
35 | 40 |
|
|
0 commit comments