Skip to content

Conversation

@erwango
Copy link
Member

@erwango erwango commented Oct 21, 2025

Based on #97037

Similarly to what is done for stm32h750_dk board in #97037, introduce a ext_flash_app board variant aiming at being chainloaded by MCUBoot.
Requires mcuboot counter part (mcu-tools/mcuboot#2510) to allow MCUBoot to run on internal flash.

Doc not provided, waiting for #97037 to be merged.
@JarmouniA, in a fisrst step, I plan to redirect doc to stm32h750_dk to avoid redundant doc in each board.

@github-actions
Copy link

github-actions bot commented Oct 21, 2025

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

Name Old Revision New Revision Diff
mcuboot zephyrproject-rtos/mcuboot@b192716 (main) zephyrproject-rtos/mcuboot@96576b3 (upstream-sync) zephyrproject-rtos/[email protected]

All manifest checks OK

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

compatible = "soc-nv-flash";
reg = <0x0 DT_SIZE_M(128)>;
write-block-size = <1>;
erase-block-size = <DT_SIZE_K(128)>;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
erase-block-size = <DT_SIZE_K(128)>;
erase-block-size = <DT_SIZE_K(4)>;

lowest as possible, see #97037 (comment)

Comment on lines 14 to 16
choice MCUBOOT_MODE
default MCUBOOT_MODE_DIRECT_XIP
endchoice
Copy link
Member

Choose a reason for hiding this comment

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

also use MCUBOOT_MODE_SWAP_USING_OFFSET like in #97037 ?

Copy link
Member Author

@erwango erwango Oct 23, 2025

Choose a reason for hiding this comment

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

For some reason, MCUBOOT_MODE_SWAP_USING_OFFSET prevents building mcuboot image as it has an impact on following parameters (build/stm32h7s78_dk/stm32h7s7xx/ext_app_flash/mcubootCMakeCache.txt)

//Estimated MCUboot image trailer size
mcuboot_image_footer_size:INTERNAL=32808
//Estimated MCUboot update image trailer size
mcuboot_image_upgrade_footer_size:INTERNAL=32768

vs (SINGLE_APP_MODE & DIRECT_XIP)

//Estimated MCUboot image trailer size
mcuboot_image_footer_size:INTERNAL=88
//Estimated MCUboot update image trailer size
mcuboot_image_upgrade_footer_size:INTERNAL=48

As a consequence, this doesn't fit available RAM anymore.
Note that it is the same on stm32h750_dk because it can afford it:

Memory region         Used Size  Region Size  %age Used
           FLASH:       34568 B       128 KB     26.37%
             RAM:      138304 B       512 KB     26.38%

but also trailers size are lower:

//Estimated MCUboot image trailer size
mcuboot_image_footer_size:INTERNAL=16424
//Estimated MCUboot update image trailer size
mcuboot_image_upgrade_footer_size:INTERNAL=16384

(Anyway, in any case, this wouldn't fit on stm32h7s78_dk which has only 128k of RAM)

I'll go for SINGLE_APP_MODE for now, but there is probably something to investigate here.

Copy link
Member

Choose a reason for hiding this comment

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

The ammount of sectors in slot0 and slot1 has a direct influence in mcuboot size, as it uses that for the size of an array. would propably work, if we make the flash driver respect the value from the dt prop erase-block-size, so it can be used to increase it.

Copy link
Member

Choose a reason for hiding this comment

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

but that's for later

Copy link
Contributor

@JarmouniA JarmouniA left a comment

Choose a reason for hiding this comment

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

There are other MCUboot tests the board can be added to (see the H750B-DK PR).

reg = <0x70000000 DT_SIZE_M(64)>;
zephyr,memory-region = "EXTMEM";
/* The ATTR_MPU_EXTMEM attribut causing a MPU FAULT */
zephyr,memory-attr = <DT_MEM_ARM(ATTR_MPU_IO)>;
Copy link
Contributor

@JarmouniA JarmouniA Oct 23, 2025

Choose a reason for hiding this comment

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

Can you test samples/modules/lvgl/demos? On H750B-DK, it didn't work with MPU_IO (but worked with MPU_FLASH). On H573I-DK it did work (& with MPU_FLASH the board didn't boot), not sure why yet.

Copy link
Member Author

Choose a reason for hiding this comment

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

Display related features are not working yet when executed from external flash. Probably due to STM32_LTDC_FB_USE_SHARED_MULTI_HEAP, had no time to investigate this (likely related to use of multiple XSPI instances used in //)

Is everyone fine to put this as a notable issue that can still be investigated and fixed in RC ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Display related features are not working yet

Weird, even samples/drivers/display?

Non-blocking, but could you try with MPU_FLASH attribute?

Copy link
Contributor

Choose a reason for hiding this comment

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

Is everyone fine to put this as a notable issue that can still be investigated and fixed in RC ?

Makes sense.

Copy link
Contributor

Choose a reason for hiding this comment

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

MPU_FLASH should be the correct configuration, as MPU_IO does not allow unaligned memory access. Would be interesting to find out, why the H573I-DK didn't boot with that configuration.
I fixed getting mem faults on the nucleo_h7s3l8 by setting the ext_flash to MPU_FLASH - see #99505 point 6

@erwango erwango force-pushed the dev_h7dk_ext_app_flash branch from 4c675de to 0669808 Compare October 24, 2025 09:53
@github-actions github-actions bot removed the DNM (manifest) This PR should not be merged (controlled by action-manifest) label Oct 24, 2025
Add ext_flash_app variant to stm32h7s78_dk to allow building
application running on ext flash.

Largely based on A.Jarmouni's work to enable the same on stm32h750_dk
in PR 97037.

Signed-off-by: Erwan Gouriou <[email protected]>
…iant

Now that ext_flash_app variant is available, it should be used for
mcuboot related apps on this board.

Signed-off-by: Erwan Gouriou <[email protected]>
Add debug using stlink gdbserver as an alternative to pyocd.

Signed-off-by: Erwan Gouriou <[email protected]>
Actual available internal RAM size was wrong, fix it.

Signed-off-by: Erwan Gouriou <[email protected]>
@erwango erwango force-pushed the dev_h7dk_ext_app_flash branch from 0669808 to 1e20348 Compare October 24, 2025 12:01
@maass-hamburg maass-hamburg added this to the v4.3.0 milestone Oct 24, 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

@sonarqubecloud
Copy link

@maass-hamburg maass-hamburg assigned erwango and unassigned tejlmand Oct 24, 2025
@erwango erwango assigned etienne-lms and unassigned erwango Oct 24, 2025
@cfriedt cfriedt merged commit e532f6a into zephyrproject-rtos:main Oct 24, 2025
29 checks passed
TD-JBL added a commit to JB-Lighting/zephyr that referenced this pull request Nov 19, 2025
Add ext_flash_app variant to nucleo_h7s3l8 to allow building
applications running on ext flash.

Based on Erwan Gouriou's work on stm32h7s78_dk in PR zephyrproject-rtos#97992
(which is based on A.Jarmouni's work on stm32h750_dk in PR 97037).

Signed-off-by: Thomas Decker <[email protected]>
TD-JBL added a commit to JB-Lighting/zephyr that referenced this pull request Nov 21, 2025
Add ext_flash_app variant to nucleo_h7s3l8 to allow building
applications running on ext flash.

Based on Erwan Gouriou's work on stm32h7s78_dk in PR zephyrproject-rtos#97992
(which is based on A.Jarmouni's work on stm32h750_dk in PR 97037).

Signed-off-by: Thomas Decker <[email protected]>
TD-JBL added a commit to JB-Lighting/zephyr that referenced this pull request Nov 24, 2025
Add ext_flash_app variant to nucleo_h7s3l8 to allow building
applications running on ext flash.

Based on Erwan Gouriou's work on stm32h7s78_dk in PR zephyrproject-rtos#97992
(which is based on A.Jarmouni's work on stm32h750_dk in PR 97037).

Signed-off-by: Thomas Decker <[email protected]>
TD-JBL added a commit to JB-Lighting/zephyr that referenced this pull request Nov 24, 2025
Add ext_flash_app variant to nucleo_h7s3l8 to allow building
applications running on ext flash.

Based on Erwan Gouriou's work on stm32h7s78_dk in PR zephyrproject-rtos#97992
(which is based on A.Jarmouni's work on stm32h750_dk in PR 97037).

Signed-off-by: Thomas Decker <[email protected]>
TD-JBL added a commit to JB-Lighting/zephyr that referenced this pull request Nov 24, 2025
Add ext_flash_app variant to nucleo_h7s3l8 to allow building
applications running on ext flash.

Based on Erwan Gouriou's work on stm32h7s78_dk in PR zephyrproject-rtos#97992
(which is based on A.Jarmouni's work on stm32h750_dk in PR 97037).

Signed-off-by: Thomas Decker <[email protected]>
TD-JBL added a commit to JB-Lighting/zephyr that referenced this pull request Nov 24, 2025
Add ext_flash_app variant to nucleo_h7s3l8 to allow building
applications running on ext flash.

Based on Erwan Gouriou's work on stm32h7s78_dk in PR zephyrproject-rtos#97992
(which is based on A.Jarmouni's work on stm32h750_dk in PR 97037).

Signed-off-by: Thomas Decker <[email protected]>
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.

9 participants