Skip to content

Conversation

tpambor
Copy link
Contributor

@tpambor tpambor commented Oct 16, 2025

Commit 5d0306c of #88579 moved the slot0_partition, slot1_partition, scratch_partition from the internal flash to the external OSPI NOR flash. At the same time, the nor partition on the external NOR flash was deleted. This breaks all applications that rely on the slot0_partition, slot1_partition, scratch_partition to be on internal flash as well as all applications that use the nor partition on external flash with the stm32h573i_dk board.

To avoid breaking existing projects and maintain compatibility with previous versions of Zephyr, this PR restores the default flash layout (without scratch partition) and introduces a new board variant ext_flash_app for applications stored in external flash. This approach allows users to opt-in to the new flash layout without affecting existing projects.

A similar to what is proposed for the STM32H750B-DK in #97037.

Fixes #97423.

@erwango
Copy link
Member

erwango commented Oct 16, 2025

@tpambor Thanks for this, but don't you miss to add an overlay in mcuboot repo to provide the right zephyr,flash and zephyr,flash-controller ? (Dependency that I'd like to get rid of but mandatory today for current version of #97037)

@tpambor
Copy link
Contributor Author

tpambor commented Oct 16, 2025

@tpambor Thanks for this, but don't you miss to add an overlay in mcuboot repo to provide the right zephyr,flash and zephyr,flash-controller ? (Dependency that I'd like to get rid of but mandatory today for current version of #97037)

You are right, I missed that, currently it places mcuboot in external flash, so a overlay is necessary for mcuboot.

	/* node '/chosen' defined in zephyr/dts/common/skeleton.dtsi:13 */
	chosen {
...
		zephyr,flash = &ext_flash;                 /* in zephyr/boards/st/stm32h573i_dk/stm32h573i_dk_stm32h573xx_ext_flash_app.dts:15 */
		zephyr,flash-controller = &ext_flash_ctrl; /* in zephyr/boards/st/stm32h573i_dk/stm32h573i_dk_stm32h573xx_ext_flash_app.dts:16 */
		zephyr,code-partition = &boot_partition;   /* in bootloader/mcuboot/boot/zephyr/app.overlay:3 */
	};

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 overall looks good to me and is more consistent regarding the board initial layout.

For commit "boards: st: stm32h573i_dk: Add board variant for app in external flash":
Would it be worth to add an entry in the board doc to mention the new variant?

For commit "mgmt: hawkbit: Replace overlay with new board variant":
Could you prefix the commit message header line with samples: ?

@tpambor tpambor force-pushed the stm32h573-flash-layout branch from 152ff6c to 96a7604 Compare October 16, 2025 12:13
@github-actions
Copy link

github-actions bot commented Oct 16, 2025

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

Name Old Revision New Revision Diff

All manifest checks OK

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

maass-hamburg
maass-hamburg previously approved these changes Oct 22, 2025
@maass-hamburg
Copy link
Member

@tpambor rebase needed

@tpambor tpambor dismissed stale reviews from maass-hamburg and JarmouniA via fe64c9b October 23, 2025 08:52
@tpambor tpambor force-pushed the stm32h573-flash-layout branch from 51fb7c3 to fe64c9b Compare October 23, 2025 08:52
@tpambor
Copy link
Contributor Author

tpambor commented Oct 23, 2025

Rebased and conflicts fixed

@tpambor tpambor requested a review from JarmouniA October 23, 2025 08:54
maass-hamburg
maass-hamburg previously approved these changes Oct 23, 2025
JarmouniA
JarmouniA previously approved these changes Oct 23, 2025
erwango
erwango previously approved these changes Oct 23, 2025
@kartben
Copy link
Contributor

kartben commented Oct 23, 2025

@tpambor you need to please rebase

…flash

Use the zephyr,flash-controller node and the respective compatible
'st,stm32-xspi-nor' to detect if the device is running from external
flash, instead of assuming that the parent node of the flash is the
SPI controller. This fixes an issue when soc-nv-flash is used as the
zephyr,flash node.

Signed-off-by: Tim Pambor <[email protected]>
Restore old internal flash layout as default and make app in external
flash a new board variant

Switch mcuboot to use swap mode and remove the no longer required
scratch partitions from the internal and external flash layout.

Introduce a 'soc-nv-flash' node in the stm32h573i_dk board DTS file
to define the external flash memory parameters used for MCUBoot
integration. This way BOOT_MAX_IMG_SECTORS_AUTO can be used to
automatically calculate the maximum number of image sectors based
on the actual external flash configuration.

Signed-off-by: Tim Pambor <[email protected]>
Replace overlay for stm32h573i_dk with new board variant designed to
run from external flash.

Signed-off-by: Tim Pambor <[email protected]>
Replace overlay for stm32h573i_dk with new board variant designed to
run in external flash. Keep stm32h573i_dk as it also can run mcuboot.

Signed-off-by: Tim Pambor <[email protected]>
Add stm32h573i_dk and the ext_flash_app board to the allowed boards
for the mcuboot tests.

Signed-off-by: Tim Pambor <[email protected]>
@tpambor tpambor dismissed stale reviews from erwango, JarmouniA, and maass-hamburg via 14c5ca7 October 23, 2025 16:09
@tpambor tpambor force-pushed the stm32h573-flash-layout branch from fe64c9b to 14c5ca7 Compare October 23, 2025 16:09
@tpambor
Copy link
Contributor Author

tpambor commented Oct 23, 2025

@kartben @erwango @JarmouniA Rebased and conflict fixed

@sonarqubecloud
Copy link

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flash partitions layout changed for stm32h573i_dk

8 participants