-
Notifications
You must be signed in to change notification settings - Fork 7.8k
drivers: flash: stm32 xspi flash read with memcopy when executing #93762
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
base: main
Are you sure you want to change the base?
Conversation
run the samples/sysbuild/with_mcuboot/ on the stm32h573i_dk with --sysbuild and mcuboot shell : CONFIG_SHELL=y
(with a second image downloaded on slot1_partition) |
same change to apply to the
when reading with the CONFIG_STM32_APP_IN_EXT_FLASH set |
@@ -1186,29 +1186,32 @@ static int flash_stm32_xspi_read(const struct device *dev, off_t addr, | |||
return 0; | |||
} | |||
|
|||
#ifdef CONFIG_STM32_MEMMAP | |||
#if defined(CONFIG_STM32_MEMMAP) || defined(CONFIG_STM32_APP_IN_EXT_FLASH) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#if defined(CONFIG_STM32_MEMMAP) || defined(CONFIG_STM32_APP_IN_EXT_FLASH) | |
#if defined(CONFIG_STM32_MEMMAP) || (defined(CONFIG_STM32_APP_IN_EXT_FLASH) && defined(CONFIG_XIP)) |
This is needed in my opinion, since the app image can be stored in ext flash but then be executed in RAM (after being copied there by MCUboot). In that case, we are not sure if the Flash is still MemMapped, because the app can exit Memmap mode and use a storage partition in external Flash for ex. Does this make sense?
set_config_bool(${ZCMAKE_APPLICATION} CONFIG_XIP n) |
But maybe CONFIG_XIP is not the appropriate flag to check, since it is not disabled in SINGLE_APP_RAM_LOAD mode for ex.
elseif(SB_CONFIG_MCUBOOT_MODE_SINGLE_APP_RAM_LOAD) |
I'm no longer sure of the exact semantics of Zephyr XiP at this point, I think it just means "app is executed where it was last loaded, RAM, Flash, PSRAM...by either flashloader or bootloader" or something close to this.
@nordicjm Any thoughts on this? what am I getting wrong?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
waiting for @nordicjm comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will perhaps need to check for MCUboot modes instead, to know if Memmap mode is still required after the image has started executing, see #85254 (comment)
It appears that XiP semantics in Zephyr needs real clarification in the docs & Kconfig help text, especially in relationship to the usage of a bootloader that can move the app image around, and Zephyr Code Relocation as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to be honest I think the comment about single loader is wrong, it is executing from RAM, it should have XIP set to n, XIP means running from flash, the help text is clear on that:
help
This option allows the kernel to operate with its text and read-only
sections residing in ROM (or similar read-only memory). Not all boards
support this option so it must be used with care; you must also
supply a linker command file when building your image. Enabling this
option increases both the code and data footprint of the image.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
XIP means running from flash, the help text is clear on that
But is the help text still accurate today, compared to when XiP was first introduced?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
XIP means running from flash, the help text is clear on that
But is the help text still accurate today, compared to when XiP was first introduced?
yes, you are still running from read only media (one could argue that you could erase the flash sector you are running meaning it's not read only but that's not going to go well)
e9722b4
to
7583708
Compare
When the application is executed in external flash, the read operation cannot be in indirect mode but with memcopy. Note that writing or erasing the external flash being executed is not possible during the execution. Signed-off-by: Francois Ramu <[email protected]>
|
When the application is executed in external flash, the read operation cannot be in indirect mode but with memcopy.
When executing in external flash, the CONFIG_STM32_APP_IN_EXT_FLASH is set, the application knows the external flash reading is done with memcopy.
Note that writing or erasing the external flash being executed is not possible during the execution on the external flash.
Fixes #92883