Skip to content

soc: stm32n6: Support running zephyr as a chainloaded application #91941

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

erwango
Copy link
Member

@erwango erwango commented Jun 20, 2025

Set of required adaptations to allow running the zephyr image following a bootloader (mcuboot for now).

Introduce a new board variant, fsbl which replaces previous default variant.
Default variant now stands for the chain-loaded application.

Could be used with sysbuild:
west build -b stm32n6570_dk --sysbuild <your sample> -DSB_CONFIG_BOOTLOADER_MCUBOOT=y (XIP)
Add -DSB_CONFIG_MCUBOOT_MODE_RAM_LOAD=y to use RAMLOADED mode.

Requires mcu-tools/mcuboot#2348

Copy link

github-actions bot commented Jun 20, 2025

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

Name Old Revision New Revision Diff
hal_stm32 zephyrproject-rtos/hal_stm32@468e5ad zephyrproject-rtos/hal_stm32@2aa7906 zephyrproject-rtos/hal_stm32@468e5ad4..2aa79063

All manifest checks OK

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

@github-actions github-actions bot added manifest manifest-hal_stm32 DNM (manifest) This PR should not be merged (controlled by action-manifest) labels Jun 20, 2025
@github-actions github-actions bot removed the DNM (manifest) This PR should not be merged (controlled by action-manifest) label Jun 24, 2025
gautierg-st
gautierg-st previously approved these changes Jun 25, 2025
erwango added 3 commits June 25, 2025 16:16
Add a new /fsbl variant which replaces the default variant and typically
fits for development or bootloader (MCUBoot typical target). Image
is limited to 511KB.

Default variant now stands for the real application which is supposed
to be loaded by the bootloader. It runs from axisram1 and could be both
XIP or RAMLOADED. Image has access to the whole AXISRAM1 and 2 (2MB).

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
Offset is 400 for a good reason (yet to be defined).

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
This signature is only valid for FSBL images.
MCUBooot will sign images by itself.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
erwango added 5 commits June 25, 2025 16:16
- Provide external flash partition
- Define external flash and flash controller
- Defined flashing address depending on image (FSBL/Chainloaded)

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
Point to hal_stm32 change allowing to start chainloaded app (_s
profile).

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
Make axisram2 which is used in fsbl mode available as well to
chainloaded application in order not to loose 1M of RAM

In order to avoid conflicts with bootloader, verify that code + ro data
of the loaded application won't go further than bootloader start address.
This is done with a linker assert.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
Due to a BootROM clock switching issue, XSPI1 should use HCLK otherwise
app won't restart on reset.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
Add a sysbuild configuration to specify that mcuboot uses fsbl variant.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
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.

4 participants