Skip to content

Conversation

@LDong-Arm
Copy link
Contributor

@LDong-Arm LDong-Arm commented Apr 23, 2021

Preceding PR: ARMmbed/mbed-os#14582

This PR integrates TF-M v1.3.0 with Mbed OS.

  • Starting from this version, we use unmodified TF-M from git.trustedfirmware.org rather than the ARMmbed fork. The fetching is changed accordingly:
    • Use trusted-firmware-m's own version control
    • Clean up version tracking of trusted-firmware-m
    • Build TF-M v1.3.0 release
  • Changes related to the build itself:
    • Update the list of files to import from TF-M
    • Disable __stdout from libplatform_ns
    • TF-M IRQ API now removed for the IPC model
    • Enable the PSA IPC test suite on Musca S1
  • General improvements, not required for the integration
    • Handle switching of git remote
    • Remove unused headers
    • Travis: Use mbed-tools deploy
  • To be removed after the preceding PR is merged

See individual commits for details.

@LDong-Arm LDong-Arm force-pushed the TF-Mv1.3-integration branch 4 times, most recently from 95090da to 59daeeb Compare April 23, 2021 16:56
_copy_tfm_ns_files(cmake_build_dir, tgt[0])

if args.commit:
_commit_changes(MBED_TF_M_PATH)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What commit message does this make? Did we need to add this here? Should we remove the other call to _commit_changes(MBED_TF_M_PATH) to avoid two commits when one combined one is best?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are indeed two commits. Instead of a unified "Upgrade TF-M for such and such platform", we have a point in history where the binary and the supporting files are out of sync. Also, there are " in the commit messages themselves...

ec76f07b91e7 (HEAD) "Updated directory platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_LATEST"
ddb94b8ee8ae "Updated secure binaries for [('ARM_MUSCA_B1', 'GNUARM')]"

@Patater Patater force-pushed the TF-Mv1.3-integration branch from 59daeeb to 06e2bde Compare April 28, 2021 09:50
@Patater
Copy link
Contributor

Patater commented Apr 28, 2021

Rebase on latest master

@Patater
Copy link
Contributor

Patater commented Apr 28, 2021

Updated to address review comments

@Patater Patater requested a review from rwalton-arm April 28, 2021 16:21
@Patater Patater force-pushed the TF-Mv1.3-integration branch from c79282e to 4799167 Compare April 28, 2021 16:51
@Patater
Copy link
Contributor

Patater commented Apr 28, 2021

Fixed black style in each commit.

@Patater Patater force-pushed the TF-Mv1.3-integration branch from 4799167 to 4267835 Compare April 28, 2021 16:57
@Patater
Copy link
Contributor

Patater commented Apr 28, 2021

Fixed black style in each commit, using a newer black version.

@Patater Patater force-pushed the TF-Mv1.3-integration branch from 4267835 to edca942 Compare April 28, 2021 16:58
Patater and others added 13 commits April 29, 2021 09:39
The "stable" image is pretty old and doesn't include mbed-tools. Upgrade
always using the latest image.
Use black, version 21.4b2, to ensure consistent code style in our Python
scripts.
Refactor build_tfm.py and psa_builder.py to make it obvious to
mexperienced Python programmers where the os.path functions have come
from, and to remove ambiguity from code that calls os.path.join() and
str.join().
We used to fetch tf-m-tests and psa-arch-tests with our scripts, in
order to use ARMmbed forks of those repositories that contain Mbed
modifications. Having recently switched to unmodified versions from
git.trustedfirmware.org, we should stop fetching dependencies
ourselves and let trusted-firmware-m's build system do that, with the
following advantages:
* trusted-firmware-m tracks fixed versions of dependencies that have
  been tested. The latest development of individual repositories do
  not always work together.
* trusted-firmware-m's build system automatically applies patches
  (if available) to fetched dependencies.

We do not get those benefits if we passed prefetched dependencies,
because by design trusted-firmware-m's build system does not version
control user-provided dependency. This is reasonable and allows
testing of local changes, but does not suit our main use case.
As we have switched to use trusted-firmware-m's own version control of
dependencies, our script only needs to track trusted-firmware-m now.

This commit
* removes the URLs and revisions of tf-m-tests and psa-arch-tests
* removes entries for ARMmbed repositories
* renames entries:
    * mbed-tfm -> released-tfm
    * upstream-tfm -> latest-tfm

Notes:
* The `dependencies` structure is not necessary as only fetch from one
  URL, but we keep it just in case we use our own forks again in the
  future.
* released-tfm now tracks TF-Mv1.3.0, as the continuous integration
  branch containing this commit does not work with TF-Mv1.2.0.
When a repository already exists locally, `psa_builder.py` fetches
the existing remote by name. If no remote with the given name exists,
fetching would fail. This commit fixes the issue by adding a remote
as needed.
We've updated to fetch TF-M v1.3.0 now, and some file locations have
changed. Update the paths to the files we import.
TF-M redirects output to serial by declaring its own `FILE __stdout`
and disables the toolchain's default version of this symbol using
the flag `-nostdlib`. But stdlib is enabled and required by Mbed OS,
so we need to disable the one from TF-M's libplatform_ns to avoid
symbol duplication.
The following commit in trusted-firmware-m

    b774fecd SPM: Remove *TFM* IRQ APIs for IPC Model

means that we need to disable IRQ tests in the regression suite.
Use TEST_ASSERT_EQUAL_UINT32() to get better feedback from Greentea when
running the PSA Compliance Test Suite.
Support for the PSA IPC test suite has been added for Musca S1
recently. This commit
* enables the PSA IPC test suite for Musca S1
* adds IPC test log for Musca S1 used by the Greentea test framework
for output comparison
* updates README.md
Now the `--commit` option of `build_tfm.py` not only commits
`VERSION.txt` and target binaries like before, but also imported
PSA API files.
Use the most recently released version of TF-M, rather than the tip of
the `master` branch. At the present time, this effectively means TF-M
v1.3.0.
A number of headers were historically needed for building tests but
not needed for the current version of TF-M anymore. This PR cleans
them up.

Note: `platform_base_address.h` and `tfm_peripherals_def.h` are still
needed but always copied during the build process, so there is no need
to track them with git.
The latest `mbed-tools deploy` automatically uses the shallowest clone
possible. It has the advantage of fetching the version in mbed-os.lib,
compared to a hardcoded `git clone` in `.travis.yml` which fetches the
latest `master` branch of Mbed OS.
@Patater Patater force-pushed the TF-Mv1.3-integration branch from edca942 to a7a5a4a Compare April 29, 2021 10:05
@Patater
Copy link
Contributor

Patater commented Apr 29, 2021

Updated with black again, using black . -l 79 to match CI.

@Patater Patater force-pushed the TF-Mv1.3-integration branch 2 times, most recently from 5b5f274 to 7c0f760 Compare April 30, 2021 11:16
@Patater
Copy link
Contributor

Patater commented Apr 30, 2021

The preceding Mbed OS PR has been merged now. Remove the TEMPORARY commit that points to Lingkai's Mbed OS branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants