mbed-os/tools/psa
Alexander Zilberkant 8c5ba9154d Update PSA code generator
Unify TF-M and Mbed-SPM code generators:
 - Unify SPM initialization logic:
   - All partitions are registered at once
   - Test partitions are guarded by #ifndef
   - Introduce single template list
 - Beatify template files and add "Autogen-do not modify" notice
Prepare for integration with mbed-os build system:
 - Generate all the files in a single place
Simplify tools/psa/release.py script
2019-04-30 14:10:23 +03:00
..
templates Update PSA code generator 2019-04-30 14:10:23 +03:00
tfm Update PSA code generator 2019-04-30 14:10:23 +03:00
README.md Refactor PSA code generators 2019-04-10 14:15:28 +03:00
__init__.py Update PSA code generator 2019-04-30 14:10:23 +03:00
generate_partition_code.py Update PSA code generator 2019-04-30 14:10:23 +03:00
mbed_spm_tfm_common.py Update PSA code generator 2019-04-30 14:10:23 +03:00
partition_description_schema.json Consolidating tools/tfm and tools/spm into tools/psa 2019-02-19 15:19:06 +02:00
release.py Update PSA code generator 2019-04-30 14:10:23 +03:00
spm_template_file_list.json Update PSA code generator 2019-04-30 14:10:23 +03:00

README.md

PSA tools

This document describes the following scripts:

  • __init__.py
  • generate_partition_code.py
  • mbed_spm_tfm_common.py
  • release.py

__init__.py

This file holds common functions dedicated to help SiP with their post-build logic.

  • find_secure_image - Scans a Resource object to find the correct binary of the secure image to merge with the non-secure build.

Code generation scripts

Mbed OS holds two implementations of PSA:

  • MBED_SPM - Implementation for dual-core v7 targets.
  • TF-M - Implementation for v8 targets.

Each implementation requires a set of auto-generated files describing the secure partitions:

  • generate_partition_code.py - Generate files for both implementations.
  • mbed_spm_tfm_common.py - Holds common functions for both.

Secure image generation

release.py is the script assigned with compiling the secure images:

usage: release.py [-h] [-m MCU] [-d] [-q] [-l] [--commit] [--skip-tests]
                  [-x ...]

optional arguments:
  -h, --help           show this help message and exit
  -m MCU, --mcu MCU    build for the given MCU
  -d, --debug          set build profile to debug
  -q, --quiet          No Build log will be printed
  -l, --list           Print supported PSA secure targets
  --commit             create a git commit for each platform
  --skip-tests         skip the test build phase
  -x ..., --extra ...  additional build parameters
  • When MCU is not specified, the script compiles all the images for all the targets.
  • When -d/--debug is not specified, the script compiles the images using the release profile.
  • When --commit is not specified, the script will not commit the images to git.
  • A user can specify additional commands that will be passed on to the build commands (Ex. -D for compilation defines).

This script should be run in following scenarios:

  • Release.
  • Update to files originating in the secure side.
  • Drivers update.
  • PSA updates.