Skip to content

Conversation

nandojve
Copy link
Member

This patches are necessary to make STM32U5Axxx works with TF-M.

Tested with

west build -p -b b_u585i_iot02a/stm32u585xx/ns samples/tfm_integration/tfm_ipc
./build/tfm/api_ns/regression.sh
west flash

press reset button

[INF] BANK 1 secure flash [0, 75] : OB [0, 127]
[ERR] Unexpected value for secure flash protection: set wmsec1
[INF] BANK 2 secure flash [127, 0] : OB [0, 127]
[INF] BANK 1 flash write protection [10, 21] : OB [127, 0]
[ERR] Unexpected value for write protection : set wrp1
[INF] BANK 1 secure user flash [8, 20] : OB [0, 0]
[ERR] Unexpected value for secure user flash protection : set hdp1
[INF] BANK 1 secure flash [0, 75] : OB [8, 75]
[ERR] Unexpected value for secure flash protection: set wmsec1
[INF] Starting bootloader
[WRN] This device was provisioned with dummy keys. This device is NOT SECURE
[INF] Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
[INF] Scratch: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
[INF] Boot source: primary slot
[INF] Image index: 1, Swap type: none
[INF] Primary image: magic=bad, swap_type=0x1, copy_done=0x3, image_ok=0x3
[INF] Scratch: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
[INF] Boot source: none
[INF] Image index: 0, Swap type: none
[INF] Bootloader chainload address offset: 0x38000
[INF] Image version: v0.0.0
[INF] Jumping to the first image slot
Booting TF-M v2.2.0+gdf04cce18
[WRN] This device was provisioned with dummy keys. This device is NOT SECURE
[Sec Thread] Secure image initializing!
Creating an empty ITS flash layout.
Creating an empty PS flash layout.
[INF][PS] Encryption alg: 0x5500200
[INF][Crypto] Init HW accelerator...
[INF][Crypto] Init HW accelerator... complete.
*** Booting Zephyr OS build v4.2.0-301-g3d4020728bce ***
TF-M IPC on b_u585i_iot02a
The version of the PSA Framework API is 257.
The PSA Crypto service minor version is 1.
Generating 256 bytes of random data:
EC 3D 3E B7 C1 02 14 10 6A 23 93 9F A7 80 BF CC 
CF E0 0A 62 71 B5 A2 38 3D 17 78 CE DA 9F 1D A6 
18 C4 E7 5B 86 AD 86 F5 A7 B2 3B A0 89 F8 A5 56 
94 E6 E3 6B 37 18 02 B7 AB B8 F9 78 BA 4A 63 D2 
B2 F7 A2 71 66 70 14 35 15 33 B0 86 B8 55 78 C9 
BD FB 63 9A FD 50 55 61 9E 5E 76 05 C6 16 83 0D 
3B 51 AE E6 93 2B 99 D9 77 1D F0 0D 0B E0 2B B6 
D7 0B 17 E8 9B 59 2C 07 60 2A 58 EA 28 AF A6 A6 
67 FB E7 C1 D2 A5 A8 A8 DE 6B 03 20 49 35 DE 8A 
D0 A4 47 DB 7F 40 70 D8 FC 5D 80 28 4C F2 03 09 
C9 BB 64 9E D8 FE 0B A1 0F B7 93 B7 3F 74 56 99 
DF 64 31 B9 05 22 26 FA 3C 1E BE 21 45 50 1B A5 
FE 3D D0 24 C5 28 5A D7 44 75 B5 A3 09 6A D1 BD 
47 ED AA D1 F7 68 F3 13 95 62 B2 73 4F 89 F4 54 
8D BC E6 99 D4 73 CE 95 9C 9B 22 DA 96 EC F0 12 
92 FE A9 A7 C3 52 D9 04 0C 21 7B 1E 5C 22 3E B3 

@zephyrbot zephyrbot added the size: XS A PR changing only a single line of code label Jul 22, 2025
Copy link

github-actions bot commented Jul 22, 2025

The following west manifest projects have changed revision in this Pull Request:

Name Old Revision New Revision Diff
trusted-firmware-m zephyrproject-rtos/trusted-firmware-m@cc80026 (main) zephyrproject-rtos/trusted-firmware-m#145 zephyrproject-rtos/trusted-firmware-m#145/files

DNM label due to: 1 project with PR revision

Note: This message is automatically posted and updated by the Manifest GitHub Action.

@github-actions github-actions bot added manifest manifest-trusted-firmware-m DNM (manifest) This PR should not be merged (controlled by action-manifest) labels Jul 22, 2025
@nandojve nandojve added the backport v4.2-branch Request backport to the v4.2-branch label Jul 22, 2025
@nandojve nandojve force-pushed the tfm/add_bump_u5a_patches branch from de1ec72 to f4b0642 Compare August 13, 2025 16:03
@zephyrbot zephyrbot added the platform: STM32 ST Micro STM32 label Aug 13, 2025
@nandojve nandojve added this to the v4.3.0 milestone Aug 13, 2025
Copy link
Contributor

@etienne-lms etienne-lms left a comment

Choose a reason for hiding this comment

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

Look good with some comments.

Commit message for "boards: st: b_u585i_iot02a: ns: Redesign flash partitions" should emphasis that the new layout is synced with TF-M flash layout (possibly with a Zephyr/TF-M P-R reference).

Since b_u585i_iot02a board flash layout is changed, a firmware update (e.g. FOTA) will not be able to upgrade a Zephyr v4.2.0 (or older) system to a v4.3.0 (or later) version. Terefore I think it would be nice there are a few words about it in the migration guide file (doc/releases/migration-guide-4.3.rst).

@nandojve nandojve force-pushed the tfm/add_bump_u5a_patches branch 2 times, most recently from 45668a5 to accb6cb Compare August 18, 2025 13:55
@zephyrbot zephyrbot added Release Notes To be mentioned in the release notes area: Flash labels Aug 18, 2025
@nandojve nandojve requested a review from etienne-lms August 18, 2025 14:02
@nandojve
Copy link
Member Author

Hi @etienne-lms ,

All tests are passing now.

@nandojve
Copy link
Member Author

Hi @etienne-lms ,

I was wondering if you had time to check latest changes.

Copy link
Contributor

@etienne-lms etienne-lms left a comment

Choose a reason for hiding this comment

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

Sorry for the late feedback. It would be nice these STM32 TF-M updates land in Zephyr.

Commit "boards: st: b_u585i_iot02a: ns: Redesign flash partitions" removes file
tests/drivers/flash/common/boards/b_u585i_iot02a_stm32u585xx_ns.overlay. Looking at it, I think it's fine: the overlay file was no really needed. Indeed I successfully ran this test on a b_u585i_iot02a board with your patches applied.
I think it would be better to have a short line about that in the commit message so that it's clear the file was intentionally removed and the test is still functional.

A few Minor comments.

I wonder if this commit should also integrate west.yml update, so that all commits in Zephyr Git history are functional, but it's maybe not really required so fine as-is if maintainers are Ok.

@nandojve nandojve force-pushed the tfm/add_bump_u5a_patches branch 2 times, most recently from 36001bb to 5c80544 Compare August 21, 2025 17:00
@nandojve nandojve requested a review from etienne-lms August 21, 2025 17:00
@nandojve
Copy link
Member Author

@etienne-lms ,

I wonder if this commit should also integrate west.yml update, so that all commits in Zephyr Git history are functional, but it's maybe not really required so fine as-is if maintainers are Ok.

You are right, I miss that! I reorder the commits to fix that.

  • fix last comments
  • rebase

etienne-lms
etienne-lms previously approved these changes Aug 22, 2025
Copy link
Contributor

@etienne-lms etienne-lms left a comment

Choose a reason for hiding this comment

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

LGTM. Let's wait zephyrproject-rtos/trusted-firmware-m#145 is merged.

Comment on lines 34 to 35
This is a breaking change in firmware upgrade (FOTA) will not be able to upgrade an older
Zephyr image.
Copy link
Contributor

Choose a reason for hiding this comment

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

This sentence is not clear?

Copy link
Member Author

Choose a reason for hiding this comment

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

I drop this sentence.

Copy link
Contributor

Choose a reason for hiding this comment

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

The rest looks good now, but I would keep some words to make it clear that this is a breaking change for FOTA.

Copy link
Contributor

@etienne-lms etienne-lms Aug 26, 2025

Choose a reason for hiding this comment

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

Ideally some hints on how to bring back support would be nice, but I guess it would likely be too long to really fit in the porting guidelines. Maybe should we create a Github issue and put some description here that could be referenced in this porting guide?

(edited) Maybe this could be added later, this P-R could only add few words like: "This change currently prevents upgrade from older Zephyr release images to Zephyr 4.3 release images."

Copy link
Member Author

Choose a reason for hiding this comment

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

I added @etienne-lms words + more details in the TF-M migration/release notes. Possible in #94875 we need to point to some new docs about OTP and #94470 should be in the release notes.

The S and NS shares the extermal NOR memory. This extracts the external
NOR partition definitions from b_u585i_iot02a-common.dtsi and move to
b_u585i_iot02a.dts to allow NS software defined their own external
partition layout.

Signed-off-by: BUDKE Gerson Fernando <[email protected]>
@nandojve nandojve force-pushed the tfm/add_bump_u5a_patches branch from d595d99 to 6aadae9 Compare August 29, 2025 06:07
This brings many tf-m patches related to stm32 SoCs. It sync stm32 with
the vendor mainline patches and add all the necessary pieces to allow
STM32U5Axxx SoC work with TF-M.

The patch list can be checked in:

 zephyrproject-rtos/trusted-firmware-m#145

In addition, redesign the b_u585i_iot02a flash partitions. The current
b_u585i_iot02a NS flash layout difficult the development of large
applications. Since there is an external NOR memory which is already
supported by tf-m, this proposes a layout reconfiguration which allows
bigger bootloader, S and NS software. With this redesign the overlay
in the tests can be safely removed. This new layout is synced with
TF-M 2.1.1 mainline, see:

https://review.trustedfirmware.org/c/TF-M/trusted-firmware-m/+/41126

The bootloader BL2 now will fetch FOTA content from the external memory.

Signed-off-by: BUDKE Gerson Fernando <[email protected]>
Copy link

@nandojve nandojve requested a review from etienne-lms August 29, 2025 07:03
@nandojve
Copy link
Member Author

nandojve commented Sep 1, 2025

Hi @tomi-font , @etienne-lms ,

Could you help me to identify what is missing ?

Copy link
Contributor

@etienne-lms etienne-lms left a comment

Choose a reason for hiding this comment

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

The main missing part is to wait zephyrproject-rtos/trusted-firmware-m#145 is merged so you can update this P-R with the relevant TF-M Git SHA1 reference in west.yml.

@@ -29,6 +29,11 @@ Kernel
Boards
******

* b_u585i_iot02a/ns: The flash layout was changed to be in sync with the upstream TF-M 2.2.1 board
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* b_u585i_iot02a/ns: The flash layout was changed to be in sync with the upstream TF-M 2.2.1 board
* ``b_u585i_iot02a//ns``: The flash layout was changed to be in sync with the upstream TF-M 2.2.1 board

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Flash backport v4.2-branch Request backport to the v4.2-branch DNM (manifest) This PR should not be merged (controlled by action-manifest) manifest manifest-trusted-firmware-m platform: STM32 ST Micro STM32 Release Notes To be mentioned in the release notes size: XS A PR changing only a single line of code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants