220 Commits

Author SHA1 Message Date
Robert Robinson
cf6e4178e9 modules: tf-m: nordic: Add support for nRF7120 TF-M
This commit adds initial support for non secure nRF7120 targets in
zephyr.

There are important limitations, such as:
- The hardware Crypto accelerator is not supported and thus the non
  secure target is NOT secure for production applications in upstream
  Zephyr.
- The BL2 is not supported, so no DFU is supported with this support

Signed-off-by: Robert Robinson <robert.robinson@nordicsemi.no>
2026-01-14 13:02:59 -06:00
Guido Roncarolo
6cf47cae57 modules: tf-m: add MCNX947 in cmake and kconfig
Added MCNX947 support in trusted-firmware-m
module Cmake and Kconfig. Cmake is cleaned,
removed unused variables.

Signed-off-by: Guido Roncarolo <guido.roncarolo@nxp.com>
2025-12-17 10:56:59 +02:00
Tim Pambor
7a9b4d3a5c boards: st: stm32h573i_dk: Add TF-M non-secure app support
Add support for building Trusted Firmware-M (TF-M) non-secure
applications for the STM32H573I-DK board.

Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
2025-12-12 09:57:40 -05:00
Georgios Vasilakis
2338a37ff2 modules: tf-m: Add syscall header dependency for TF-M
Zephyr generates the system call headers using CMake custom
targets and various scripts. Some platforms, like the Nordic onces,
reuse some files located in Zephyr inside the TF-M build as well.
Because of this the generated Zephyr headers needs to exist before
TF-M starts the build process in order to succeed.

This adds a dependency to make sure TF-M starts building after the
Zephyr custom command which generates the system call headers is
executed.

Signed-off-by: Georgios Vasilakis <georgios.vasilakis@nordicsemi.no>
2025-12-09 09:26:24 +01:00
Jordan Yates
6fe6a8bbb4 modules: tfm: don't pad unconfirmed image
If the image is not confirmed, there is no need to pad the entire flash
slot with empty data. This reduces the size of
`tfm_s_zephyr_ns.signed.bin` (the file actually sent for an OTA upgrade)
from 100% of the slot size down to the size of the application.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-12-08 06:13:58 -05:00
Nikodem Kastelik
ad1e5ac253 nordic: update and align to nrfx 4.0.1
New nrfx release contains major rework of nrfx drivers
instantiation making it easier to integrate with dts nodes.
Now, nrfx driver instances can no longer be `const`
because they contain driver runtime state.
Additionally, all nrfx drivers return `errno` error codes
instead of deprecated `nrfx_err_t`.

Signed-off-by: Nikodem Kastelik <nikodem.kastelik@nordicsemi.no>
2025-11-27 14:45:17 +01:00
Jordan Yates
9366e4a48e modules: tfm: disable SECURE_UART when TFM_LOG_LEVEL_SILENCE
Explicitly disable the SECURE_UART TFM define when
`CONFIG_TFM_LOG_LEVEL_SILENCE=y`. The secure UART is only enabled by
default on nRF platforms to match the current TF-M defaults.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-11-17 09:22:58 -05:00
Jordan Yates
74a23eacd5 modules: tf-m: generate tfm_merged.bin from tfm_merged.hex
Since `tfm_merged.bin` now contains BL2, it can only be used for the
same purposes as `tfm_merged.hex` (intial firmware loading). Therefore
it should be using the confirmed images that `tfm_merged.hex` does.

Since the only difference between the two files with that change is now
the output format, we can directly generate `tfm_merged.bin` from
`tfm_merged.hex` with `objcopy` instead of going through `mergehex.py`.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-11-07 19:23:26 +02:00
Jordan Yates
db339e46b5 modules: tf-m: generate tfm_s_zephyr_ns_signed.bin
Generate a binary version of `tfm_s_zephyr_ns_signed.hex` with objcopy.
This file is valid for performing OTA upgrades, unlike `tfm_merged.bin`,
which contains BL2.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-11-07 19:23:26 +02:00
Jordan Yates
15e8305ce9 modules: tf-m: remove S_NS_CONFIRMED_HEX_FILE
`S_NS_CONFIRMED_HEX_FILE` was never generating a confirmed file, just
the same file contents as `S_NS_HEX_FILE`. Since no logic needs a
confirmed merge of `tfm_s.hex` and `zephyr.hex`, just remove the logic
instead of fixing it.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-11-07 19:23:26 +02:00
Jordan Yates
2219a875b2 modules: tf-m: fix CMake formatting
Fix formatting errors that cause CI to complain.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-11-07 19:23:26 +02:00
Anas Nashif
303af992e5 style: fix 'if (' usage in cmake files
Replace with 'if(' and 'else(' per the cmake style guidelines.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-10-29 11:44:13 +02:00
BUDKE Gerson Fernando
bbc73af78f trusted-firmware-m: Generate tfm_merged.bin
When CONFIG_TFM_MCUBOOT_IMAGE_NUMBER is 1, all images are merged.
Currently, there is no tfm_merged.bin file for use in FOTA. This
adds file generation to fulfill that requirement.

Signed-off-by: BUDKE Gerson Fernando <gerson.budke@leica-geosystems.com>
2025-10-24 13:27:24 -04:00
BUDKE Gerson Fernando
d1534c5395 trusted-firmware-m: Prepare to generate tfm_merged.bin
When CONFIG_TFM_MCUBOOT_IMAGE_NUMBER is 1, the process to create the
final tfm_merged.bin file is more complex. This prepares the content
to introduce the generation of tfm_merged.bin for use in FOTA
applications.

Signed-off-by: BUDKE Gerson Fernando <gerson.budke@leica-geosystems.com>
2025-10-24 13:27:24 -04:00
BUDKE Gerson Fernando
7fe5574fa2 trusted-firmware-m: Use cmake_parse_arguments in tfm_sign
Use cmake_parse_arguments() for more idiomatic code. This makes the
code more readable and easier to extend with new options.

Signed-off-by: BUDKE Gerson Fernando <gerson.budke@leica-geosystems.com>
2025-10-24 13:27:24 -04:00
BUDKE Gerson Fernando
5b4cd27f55 trusted-firmware-m: Create multi image bin files
A fundamental use of Trusted Firmware-M is to provide security for
IoT applications, where firmware upgrades (FOTA) are almost always
mandatory. The current file signing process does not produce the
necessary binaries for multi-image S/NS FWU, since hex images are
not suitable for this use case. This introduces the missing signed
binary files for use by the FWU partition. The changes were tested
in multi-image FWU scenarios, and support for single-image scenarios
can be easily added in the future.

Signed-off-by: BUDKE Gerson Fernando <gerson.budke@leica-geosystems.com>
2025-10-24 13:27:24 -04:00
BUDKE Gerson Fernando
69f277cdcb trusted-firmware-m: Make hex files variables explicit
Make variables that define output files explicitly include 'HEX' in the
name. This refactoring step allows for the introduction of BIN file
generation.

Signed-off-by: BUDKE Gerson Fernando <gerson.budke@leica-geosystems.com>
2025-10-24 13:27:24 -04:00
BUDKE Gerson Fernando
6cee10c5b9 trusted-firmware-m: Set --confirm when signing
The current behavior when signing an image adds --pad but does not
confirm the image. This appears to be a mistake, as the user should
inspect the image status in the Firmware Upgrade software. If an image
is not --confirmed, the FSM cannot infer the correct states. This sets
the image as confirmed to resolve the issue.

Signed-off-by: BUDKE Gerson Fernando <gerson.budke@leica-geosystems.com>
2025-10-24 13:27:24 -04:00
BUDKE Gerson Fernando
b21ea79784 trusted-firmware-m: Define header and trailer options
The current behavior when signing an image is to always set --pad and
--pad-header for all images unless TFM_USE_NS_APP is set. This does not
allow for easy creation of signed images for FOTA applications. Rewrite
the PAD parameter as HEADER and TRAILER to simplify the setup of more
signing options.

Another important reason for this change is that the NS image, when
signed without --pad, runs on the hardware but does not perform the
MCUboot test, and the FWU never upgrades the image. This fixes the NS
image signing process to correctly support TF-M FWU using the PSA API
functions.

Signed-off-by: BUDKE Gerson Fernando <gerson.budke@leica-geosystems.com>
2025-10-24 13:27:24 -04:00
BUDKE Gerson Fernando
99a2e4931e trusted-firmware-m: Set --max-sectors when signing
The --max-sectors option helps catch problems with flash overlap when
merging images. If there is a misalignment in flash partitions, the
merge process usually fails. This uses information from Zephyr flash
partitions and the flash controller to automatically determine the
max sectors value and apply it when signing an image.

Signed-off-by: BUDKE Gerson Fernando <gerson.budke@leica-geosystems.com>
2025-10-24 13:27:24 -04:00
BUDKE Gerson Fernando
debb59830b trusted-firmware-m: Set --align when signing
The current version of TF-M script that sign MCUboot image uses a
default alignment of 1. This value varies between flash devices
and not all accept the default 1. This improve the script picking
the write-block-size property from the current flash controller
and pass as the --align parameter when signing an image.

Note: This solution works out-of-box for the vast majority of
devices in the Zephyr tree and an exception will throw when
a device is not supported.

Signed-off-by: BUDKE Gerson Fernando <gerson.budke@leica-geosystems.com>
2025-10-24 13:27:24 -04:00
BUDKE Gerson Fernando
2697953876 modules: tf-m: Kconfig.tfm: Update TFM_BOARD
Reorder TFM_BOARD entries by vendor name for improved clarity.

Signed-off-by: BUDKE Gerson Fernando <gerson.budke@leica-geosystems.com>
2025-10-24 13:27:24 -04:00
Jamie McCrae
298a35b714 modules: tf-m: Remove some download Kconfigs
Removes two Kconfig which seemed to indicate downloading of a
project would happen automatically, which does not abide by how
to get additional module code in Zephyr. Due to TF-M always setting
these to "DOWNLOAD" in the repo, they are set even if the modules
do not exist so that they do not download e.g. in CI. Unfortunately
it seems that the qcbor one cannot be removed at this time due to
being needed in some applications and is not apache licensed,
though instructions should be provided to users instead describing
how to add it to a module manifest instead, in a later task

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-10-24 09:00:59 -07:00
Tahsin Mutlugun
9625f00929 boards: adi: Add MAX32658EVKIT secure and nonsecure boards
Adds MAX32658EVKIT board with secure and nonsecure variants.

Signed-off-by: Tahsin Mutlugun <Tahsin.Mutlugun@analog.com>
2025-10-21 12:25:13 -04:00
Dag Erik Gjørvad
de402cb465 boards: nordic: Add initial support for nRF54LM20A/ns
Add board files for nRF54LM20A/ns.
Update existing nRF54LM20A board files to support this.

Signed-off-by: Dag Erik Gjørvad <dag.erik.gjorvad@nordicsemi.no>
2025-10-21 17:24:11 +03:00
Etienne Carriere
f4b9e5f68e modules: trusted-firmware-m: Add STM32_FLASH_LAYOUT_BEGIN_OFFSET
Add TF-M directive STM32_FLASH_LAYOUT_BEGIN_OFFSET needed to specify
the gap needed by external boot stage resources at flash beginning.
The offset tells STM32 TF-M firmware the base offset in the flash
where the several TF-M and non-secure image areas shall be located.

The CMake directive was introduced mainline TF-M commit [1] and merged
in Zephyr TF-M repository [2].

Link: fc035b874e [1]
Link: 954dc80541 [2]
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
2025-10-15 15:38:33 +03:00
Etienne Carriere
0218849c48 modules: trusted-firmware-m: Declare stm32wba65i support
Declare stm32wba65i-dk1 and nucleo_wba65ri boards support in TF-M.
Both comply with TF-M integration of platform stm/stm32wba65i-dk.

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
2025-10-15 15:38:33 +03:00
Sudan Landge
826742fca2 boards: mps4: Enable non-secure variant support
Zephyr's TF-M has been aligned with upstream TF-M v2.2.0, which adds
support for Corstone-320 (CS320). The previous commit also updates TF-M
to fix compiler warnings seen with MPS4. So, with this update, enable
build and execution of non-secure variants of MPS4-based boards.

Signed-off-by: Sudan Landge <sudan.landge@arm.com>
2025-10-14 12:53:38 +03:00
Jamie McCrae
db8f991c77 kconfig: Use $(...) instead of ${...} for getting variables
Updates this to comply with the Zephyr Kconfig recommendations

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-08-20 12:05:41 +02:00
Michele Sardo
7bc1756396 modules: trusted-firmware-m: Update in interface implementation
Following changes to arch/arm/core/cortex_m/fpu.c,
the dependency on CONFIG_FPU_SHARING is moved into this file.

Signed-off-by: Michele Sardo <michele.sardo@st.com>
2025-07-19 13:45:07 -04:00
Flavio Ceolin
ca7d99a249 tf-m: build: Treat warnings as errors
Starting in TF-M 2.2.0 there is a build option to treat warnings as
errors. Lets use it.

Signed-off-by: Flavio Ceolin <flavio@hubblenetwork.com>
2025-07-16 16:39:04 -05:00
Pisit Sawangvonganan
a163f9db61 kconfig: fix typo in (arch, boards, kernel, modules, samples, share)
Utilize a code spell-checking tool to scan for and correct spelling errors
in `Kconfig` files within the `arch`, `boards`, `kernel`, `modules`,
`samples`, and `share` directory.
Additionally, incorporates a fix recommended by the reviewer.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2025-07-01 10:58:54 -10:00
Sudan Landge
97c501f0f3 modules: ethos_u: arm: update for MPS4
Update support for MPS4 which has default 256 MACs as per FVP.

Signed-off-by: Sudan Landge <sudan.landge@arm.com>
2025-06-09 14:35:12 -07:00
Torsten Rasmussen
2d5a81035a cmake: add tfm / tfa image information to build info
Support for list of images in build info was added with commit
4061311da3 and is used by sysbuild.

Zephyr itself also uses CMake's External Project feature when including
TF-M or TF-A in a Zephyr build.

Populate build info with TF-M / TF-A information when said image is
included in the build.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2025-06-06 08:42:11 +02:00
Sadik Ozer
7898a5141c soc: adi: Do not download hal_adi for TF-M build
Set HAL_ADI_PATH to TF-M uses hal_adi that comes with zephyr.

Signed-off-by: Sadik Ozer <sadik.ozer@analog.com>
2025-05-21 08:01:25 +02:00
Sadik Ozer
ccb3588003 boards: Add MAX32657EVKit NS board
This commit enables max32657 NS board support

To build:
- west build -b max32657evkit/max32657/ns -p

Signed-off-by: Sadik Ozer <sadik.ozer@analog.com>
2025-05-21 08:01:25 +02:00
Sudan Landge
c4235fa489 modules: CMSIS_6: fix path and use it for TF-M
What is the change?
Fix the path for module CMSIS_6 and use CMSIS_6 module for TF-M.

Why do we need this change?

After Zephyr updated TF-M to v2.1.0,
bb037d4469842c96f5872b271490aceb0734d965 added a local copy of CMSIS_6
to stop Zephyr's TF-M from downloading the CMSIS_6 from upstream.
The correct way would be to have CMSIS_6 as a module in Zephyr (which
we have now) and pass the path of this module to TF-M.
A fork of the upstream CMSIS_6 was added to Zephyr however,
the path in west.yml makes it a lib and not a module.
Fixing the path generates the ZEPHYR_CMSIS_6_MODULE_DIR symbol which
can now be used to pass to TF-M and the copy in TF-M would no longer be
required.

Signed-off-by: Sudan Landge <sudan.landge@arm.com>
2025-05-14 09:11:32 +02:00
Georgios Vasilakis
0151535b8f boards: nordic: Add initial support for nRF54L10 with TF-M
This adds the nrf54l15dk/nrf54l10/cpuapp/ns board variant to
Zephyr. It allows to build applications for this target.

This is an initial support for the non secure target which allows
building and running tfm_ipc and config_build.

This is NOT full support of the non secure target in upstream
Zephyr.

There are important limitations, such as:
  - The hardware Crypto accelerator is not supported and thus the non
    secur target is NOT secure for production applications in upstream
    Zephyr.
  - The BL2 is not supported, so no DFU is supported with this support

Most of the code changes here are taken from nRF Connect SDK
in order to avoid having noups there.

Signed-off-by: Georgios Vasilakis <georgios.vasilakis@nordicsemi.no>
2025-04-14 20:05:17 +02:00
Georgios Vasilakis
0c11af915d modules: TF-M: nordic: Update header for the NRF54L series
Update the header to include a generic header for the NRF54L
series and not a specific one for the NRF54L15.

Signed-off-by: Georgios Vasilakis <georgios.vasilakis@nordicsemi.no>
2025-04-14 20:05:17 +02:00
Georgios Vasilakis
47c71e35ee boards: Add non-secure target for nrf54L15dk
This adds the nrf54l15dk/nrf54l15/cpuapp/ns board variant to
Zephyr. It allows to build applications for this target.

This is an initial support for the non secure target which allows
building and running tfm_ipc and config_build.

This is NOT full support of the non secure target in upstream
Zephyr.

There are important limitations, such as:
- The hardware Crypto accelerator is not supported and thus the non
  secur target is NOT secure for production applicatiions in upstream
  Zephyr.
- The BL2 is not supported, so no DFU is supported with this support

Most of the code chagnes here are taken from nRF Connect SDK
in order to avoid having noups there.

Signed-off-by: Georgios Vasilakis <georgios.vasilakis@nordicsemi.no>
2025-04-08 01:51:18 +02:00
Sadik Ozer
478ced8149 modules: trusted-firmware-m: Use bl2_signed.bin image
If CONFIG_TFM_BL1 config has been enabled
bl2_signed.bin/hex image will be be generated during build tf-m
these binaries shall be used while generating tfm_merged.hex

Signed-off-by: Sadik Ozer <sadik.ozer@analog.com>
2025-03-26 21:55:50 +01:00
Sadik Ozer
dd71a2d2db modules: trusted-firmware-m: Define BL1 flags
Define BL1 and sign key for BL2 configs and pass them to the TF-M
This will allow to trigger BL1 over zephyr and specify BL2 sign key

Signed-off-by: Sadik Ozer <sadik.ozer@analog.com>
2025-03-26 21:55:50 +01:00
Sudan Landge
06847b5801 modules: tf-m: fix Ethos-U Cmake warnings
This is to fix the below compiler warning from TF-M builds
   that don't use the Ethos-U driver.
```
CMake Warning:
  Manually-specified variables were not used by the project:

    ETHOS_DRIVER_PATH
```

Signed-off-by: Sudan Landge <sudan.landge@arm.com>
2025-03-17 16:25:12 +01:00
Sudan Landge
9b0623e63a modules: avoid fetching external repo in TF-M
What is changed?
 - Use the updated TF-M that is compatible with the Zephyr's
   latest Ethos-U driver repo.
 - Change the default behavior of TF-M builds to use Ethos driver
   locally fetched by Zephyr, using west update, instead of
   downloading it from external repo.

Why is this change required?
 - This is to be inline with Zephyr's rules to not fetch code from
   external repo.

Fixes #81656

Signed-off-by: Sudan Landge <sudan.landge@arm.com>
2025-01-24 19:16:08 +01:00
Stephanos Ioannidis
be25c94f22 modules: trusted-firmware-m: Remove 'xtools' toolchain support
This commit removes the TF-M support for the `xtools` toolchain variant,
which has been deprecated since Zephyr v3.3.0 and now removed.

Note that `zephyr` toolchain variant must be used instead of `xtools` when
building with Zephyr SDK.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2025-01-17 10:50:07 +01:00
Sudan Landge
caa7226157 boards: mps3: Add support for corstone310/an555
What is changed?
 - Added a new mps3 board an555 for the soc corstone310.
   The qualifier to build/run application with board mps3/an555 is
   `mps3/corstone310/an555` for secure and
   `mps3/corstone310/an555/ns` for non-secure.
 - Added FVP variant to enable FVP testing with corstone310
   and it uses the ARM FVP `FVP_Corstone_SSE-310`.
   The qualifier to build/run application with FVP is
   `mps3/corstone310/an555fvp` for secure and
   `mps3/corstone310/an555fvp/ns` for non-secure.

Why do we need this change?
 - This enables FVP support and testing for corstone310.
 - A separate FVP variant was added for AN555 because, the TFM board
   used for non-secure variant differs for FPGA and FVP.
   TFM board `arm/mps3/corstone310/an555` should be used when testing
   AN555 with FVP and `arm/mps3/corstone310/fvp` should be used when
   testing with AN555 FPGA.

Signed-off-by: Sudan Landge <sudan.landge@arm.com>
2024-10-26 03:58:05 +01:00
Sudan Landge
3092d96e5b boards: mps3: Add support for corstone300/an552
What is changed?
 - Added a new mps3 board an552 for the soc corstone300.
   The qualifier to build/run application with board mps3/an552 is
   `mps3/corstone300/an552` for secure and
   `mps3/corstone300/an552/ns` for non-secure.
 - Added FVP variant to enable FVP testing with corstone300
   and it uses the ARM FVP `FVP_Corstone_SSE-300_Ethos-U55`.
   The qualifier to build/run application with FVP is
   `mps3/corstone300/fvp` for secure and
   `mps3/corstone300/fvp/ns` for non-secure.
 - Note: the qualifier to build/run application with board mps3/an547
   is now changed to
   `mps3/corstone300/an547` for secure and
   `mps3/corstone300/an547/ns` for non-secure.

How is it changed?
 - Moved common code from mps3/an547 to corstone300.
 - Renamed soc for an547 to corstone300 and added
   a new soc corstone300/an552.

Why do we need this change?
 - This enables FVP support and testing for corstone300.
 - SOC/qualifier for mps3/an547 was renamed to reduce code redundancy
 - A separate FVP variant was added for AN552 because, the TFM board
   used for non-secure variant differs for FPGA and FVP.
   TFM board `arm/mps3/corstone300/fvp` should be used when testing
   AN552 with FVP and `arm/mps3/corstone300/an552` should be used when
   testing with AN552 FPGA.

Signed-off-by: Sudan Landge <sudan.landge@arm.com>
2024-10-26 03:58:05 +01:00
Jordan Yates
f31439991d modules: tfm: interface: handle ISR context
Don't attempt to take a mutex if operating from inside an ISR. The only
expected use-case where this should occur is when attempting to reboot
via `tfm_platform_system_reset` from an exception handler.

Fixes #79687.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-10-15 19:08:24 +01:00
Jordan Yates
8354fc5c3c modules: tfm: default version numbers from VERSION
Populate the TFM application version numbers from the application
`VERSION` file if it exists.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-10-04 22:51:04 +01:00
Jordan Yates
cd03667a5d modules: tfm: split security counter from version
By default, TFM enables hardware rollback protection, which requires a
security counter to be embedded in the image trailer. The default
behaviour of constructing this counter from the image version breaks the
TFM `boot_nv_security_counter_update` implementation once the version
number is greater than `0.0.1024`. As such, explicitly specify the
desired security counter value. As per the MCUboot docs, this does not
need to be incremented on every firmware update.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-09-26 03:34:42 -04:00