-
Notifications
You must be signed in to change notification settings - Fork 8.3k
stm32: xspi: Allow flash driver usage in RAM_LOAD mode #99729
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?
stm32: xspi: Allow flash driver usage in RAM_LOAD mode #99729
Conversation
|
The following west manifest projects have changed revision in this Pull Request:
Additional metadata changed:
⛔ DNM label due to: 1 project with PR revision and 1 project with metadata changes Note: This message is automatically posted and updated by the Manifest GitHub Action. |
95dfb79 to
7eedd31
Compare
Instantiate a `soc-nv-flash` compatible node to allow using XSPI flash driver as a real flash controller on NOR device. Signed-off-by: Erwan Gouriou <[email protected]>
Current driver protections prevent to initialize driver when run as from an external application running from ext flash. Aim is to avoid performing full driver initialization of the NOR flash controller the application is read from. But this problem is actually only valid when application is running in XIP mode (read in memory mapped mode at run time). In ram load mode, since there is no direct activity from the application on the NOR device, nothing prevents the ext flash driver to be used fully. Hence, we should allow the controller initialization to happen, with some adjustments. Mostly, what we need is to: - skip the hal init - abort memory mapping afterwards to let the jedec reading happen. Remove conditions around `stm32_xspi_is_memorymap()` and `stm32_xspi_abort()` which can finally be useful in various cases. Signed-off-by: Erwan Gouriou <[email protected]>
Point upstream mcuboot PR fixing stm32n6 fsbl variant configuration Signed-off-by: Erwan Gouriou <[email protected]>
7eedd31 to
5bab295
Compare
|
| } | ||
|
|
||
| #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) |
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.
Could you add inner parentheses to prevent from confusion?
| #if defined(CONFIG_STM32_MEMMAP) || defined(CONFIG_STM32_APP_IN_EXT_FLASH) && defined(CONFIG_XIP) | |
| #if defined(CONFIG_STM32_MEMMAP) || (defined(CONFIG_STM32_APP_IN_EXT_FLASH) && defined(CONFIG_XIP)) |
Could you update the #endif counter part?
| } | ||
|
|
||
| #ifdef CONFIG_STM32_APP_IN_EXT_FLASH | ||
| #if defined(CONFIG_STM32_APP_IN_EXT_FLASH) && defined(CONFIG_XIP) |
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.
Could you update the #endif counter part?
| /* If needed by the application, it will be re-enabled just after */ | ||
| ret = stm32_xspi_abort(dev); | ||
| if (ret != 0) { | ||
| LOG_ERR("Failed to abort memory-mapped access before init"); |
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.
Is it safe to continue the function execution? It seems to me this should return with an error code.



Currently, STM32 XSPI flash driver initialization aborts if application is run from external flash.
Though, constraints are actually different if:
Fix XSPI driver to allow flash operations in RAM LOAD.
Make necessary changes on N6 DK to be able to make use of it.
Once approved, it will have to be extended to O/QSPI drivers.
Then, we should also make sure this work using MSPI drivers.
Edit: Depends on mcu-tools/mcuboot#2547