Skip to content

STM32N6: Add XSPI Flash memory map support #88790

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

Merged
merged 2 commits into from
Apr 30, 2025

Conversation

gautierg-st
Copy link
Collaborator

Add the support of the XSPI Flash memory map support for STM32N6

@@ -8,10 +8,9 @@

config STM32_MEMMAP
bool "NOR Flash in MemoryMapped for XiP"
depends on XIP && \
Copy link
Collaborator

Choose a reason for hiding this comment

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

XiP should be removed from description & the help below as well.

Remove XIP dependency for enabling memory mapping for Q/O/XSPI NOR Flash.
It is not necessary and is preventing configuring an external Flash in
memmap mode if there is no internal Flash (like on STM32N6)

Signed-off-by: Guillaume Gautier <[email protected]>
Add memory-mapped support for STM32N6 XSPI Flash driver.

Signed-off-by: Guillaume Gautier <[email protected]>
@gautierg-st gautierg-st force-pushed the n6_xspi_flash_memmap branch from 86a9bfd to c3f0200 Compare April 22, 2025 06:40
@@ -7,13 +7,12 @@
# SPDX-License-Identifier: Apache-2.0

config STM32_MEMMAP
bool "NOR Flash in MemoryMapped for XiP"
depends on XIP && \
Copy link
Collaborator

Choose a reason for hiding this comment

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

As a consequence of this, all instances of if(CONFIG_STM32_MEMMAP) in board.cmake files (https://github.com/search?q=repo%3Azephyrproject-rtos%2Fzephyr+path%3A%2F%5Eboards%5C%2Fst%5C%2F%2F+if+%28CONFIG_STM32_MEMMAP%29&type=code) should be changed to if(CONFIG_XIP AND CONFIG_BOOTLOADER_MCUBOOT) in a follow-up PR.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure,
when building the samples/application_development/code_relocation for stm32h573i_dk, for example, the CONFIG_STM32_MEMMAP is set, the CONFIG_XIP is set but CONFIG_BOOTLOADER_MCUBOOT is not
(not build with mcuboot sysbuild)
However we need to flash the zephyr.hex with the external loader of the stm32CubeProgrammer
--> CONFIG_STM32_MEMMAP is not always equal to CONFIG_XIP & CONFIG_BOOTLOADER_MCUBOOT

Copy link
Collaborator

Choose a reason for hiding this comment

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

However, we can see that CONFIG_XIP AND CONFIG_BOOTLOADER_MCUBOOT is for selecting the external loader when flashing the samples/sysbuild/with_mcuboot
I would recommend for the board.cmake :
if(CONFIG_STM32_MEMMAP OR (CONFIG_XIP AND CONFIG_BOOTLOADER_MCUBOOT))

Copy link
Collaborator

Choose a reason for hiding this comment

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

when building the samples/application_development/code_relocation for stm32h573i_dk, for example, the CONFIG_STM32_MEMMAP is set, the CONFIG_XIP is set but CONFIG_BOOTLOADER_MCUBOOT is not
(not build with mcuboot sysbuild)
However we need to flash the zephyr.hex with the external loader of the stm32CubeProgrammer

You are right, I mistakenly thought that the external loader is not needed when using Zephyr Code Relocation with external Flash XiP.

I would recommend for the board.cmake :
if(CONFIG_STM32_MEMMAP OR (CONFIG_XIP AND CONFIG_BOOTLOADER_MCUBOOT))

I think it should be:
if(CONFIG_XIP AND (CONFIG_STM32_MEMMAP OR CONFIG_BOOTLOADER_MCUBOOT))

CONFIG_STM32_MEMMAP alone does not mean we are necessarily going to eXecute in Place code in external Flash (that should be downloaded there by external loader).

@kartben kartben merged commit a5f9793 into zephyrproject-rtos:main Apr 30, 2025
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants