stm32h5 run application in external flash memory XIP#88579
stm32h5 run application in external flash memory XIP#88579aescolar merged 7 commits intozephyrproject-rtos:mainfrom
Conversation
|
west build -b stm32h573i_dk samples/application_development/code_relocation_nocopy/ |
|
with a special sample dedicated to st boards for XiP requires mcu-tools/mcuboot#2154
|
0eed22a to
0a25f40
Compare
|
Define larger partition in the external NOR flash (consequently adjusting the SECTOR size for the mcu boot) |
c3998c8 to
d0126b3
Compare
|
CI failure "invalid length for memory region EXTFLASH" given by the samples/application_development/code_relocation_nocopy/linker_arm_nocopy.ld map giving : EXTFLASH 0x0000000090000000 0xffffffffffffffff xr Build operation displays wrong extflash too: compared to when It looks like the DT_INST_REG_SIZE does not exist for the st,stm32-xspi-nor compat (DT_INST_REG_ADDR exists) --> see issue #88404 |
|
See #88392 for a fix. |
9bb0775 to
9d2579a
Compare
16878f8 to
048cb76
Compare
|
set the DNM mabel until the #88646 is merged |
5d3b191 to
b496f43
Compare
|
Adding the commit to retrieve the CONFIG_FLASH_BASE_ADDRESS from the DTS by the soc/st/stm32/Kconfig.defconfig |
0103ad5 to
4b2bea0
Compare
|
set the DNM mabel until the #88051 is merged |
3a614c3 to
80ed1b1
Compare
etienne-lms
left a comment
There was a problem hiding this comment.
For consistency, I would suggest to squash 2 commits and reorder some:
- Commit "soc: stm32: symbol for application XiP from xspi external memory";
- A single commit that squashes:
commit "drivers: clock: stm32H5 clock control of the PLL in MemoryMapped mode"
and commit "drivers: clock control of stm32 devices CONFIG external xspi flash"; - Commit "drivers: flash: stm32 xspi flash driver skip init when executing in place"
- Commit "boards: arm: stm32h573 disco kit move partition to ext flash"
- Commit "samples: sysbuild: with mcu_boot on the stm32h573i_dk"
- Commit "Revert "samples: mgmt: hawkbit: force BOOT_MAX_IMG_SECTORS for stm32h573i_dk""
IIUC commit "drivers: clock control for stm32h5 driver implements control_get_status" can be placed anywhere in this series.
For commit "Revert "samples: mgmt: hawkbit: force BOOT_MAX_IMG_SECTORS for stm32h573i_dk"", I think it would be nice to add a few words in the commit message to exaplin why it's reverted. By the way, S-o-b tag is missing in that commit message.
| */ | ||
| / { | ||
| chosen { | ||
| zephyr,flash = &mx25lm51245; |
There was a problem hiding this comment.
maybe it would be better to use the gparent of the chosen zephyr,code-partition if USE_DT_CODE_PARTITION is enabled in general, as having this overlay needed when using a image with mcuboot.
Changes like:
diff --git a/soc/st/stm32/Kconfig.defconfig b/soc/st/stm32/Kconfig.defconfig
index aafb321151a..8544215e390 100644
--- a/soc/st/stm32/Kconfig.defconfig
+++ b/soc/st/stm32/Kconfig.defconfig
@@ -33,6 +33,13 @@ DT_CHOSEN_FLASH_NODE := $(dt_chosen_path,$(DT_CHOSEN_Z_FLASH))
DT_CHOSEN_FLASH_PARENT := $(dt_node_parent,$(DT_CHOSEN_FLASH_NODE))
DT_FLASH_PARENT_IS_XSPI := $(dt_node_has_compat,$(DT_CHOSEN_FLASH_PARENT),$(DT_COMPAT_XSPI))
+DT_CHOSEN_Z_CODE_PARTITION := zephyr,code-partition
+
+DT_CHOSEN_Z_CODE_PARTITION_NODE := $(dt_chosen_path,$(DT_CHOSEN_Z_CODE_PARTITION))
+DT_CHOSEN_Z_CODE_PARTITION_FLASH_NODE := $(dt_node_parent,$(dt_node_parent, $(DT_CHOSEN_Z_CODE_PARTITION_NODE)))
+DT_CHOSEN_Z_CODE_PARTITION_FLASH_PARENT := $(dt_node_parent,$(DT_CHOSEN_Z_CODE_PARTITION_FLASH_NODE))
+DT_CHOSEN_Z_CODE_PARTITION_FLASH_PARENT_IS_XSPI := $(dt_node_has_compat,$(DT_CHOSEN_Z_CODE_PARTITION_FLASH_PARENT),$(DT_COMPAT_XSPI))
+
config SYS_CLOCK_HW_CYCLES_PER_SEC
default "$(DT_STM32_RCC_CLOCK_FREQ)" if "$(dt_nodelabel_enabled,rcc)"
@@ -81,6 +88,10 @@ config BUILD_WITH_TFM
default y if TRUSTED_EXECUTION_NONSECURE
config FLASH_BASE_ADDRESS
+ default $(dt_node_reg_addr_hex,$(DT_CHOSEN_Z_CODE_PARTITION_FLASH_PARENT),1) \
+ if $(DT_CHOSEN_Z_CODE_PARTITION_FLASH_PARENT_IS_XSPI) && USE_DT_CODE_PARTITION
+ default $(dt_node_reg_addr_hex,$(DT_CHOSEN_Z_CODE_PARTITION_FLASH_NODE),1) \
+ if USE_DT_CODE_PARTITION
default $(dt_node_reg_addr_hex,$(DT_CHOSEN_FLASH_PARENT),1) \
if $(DT_FLASH_PARENT_IS_XSPI)
default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_FLASH))
There was a problem hiding this comment.
yes, but I am not sure this is the purpose of this PR fixing the issue for the 4.2.0 release
Add a STM32_APP_IN_EXT_FLASH to determine that an application is eXecuting in Place on an external xspi flash. That will control the clock init of this external xspi controller. Signed-off-by: Francois Ramu <francois.ramu@st.com>
|
re-ordering commits as suggested |
maass-hamburg
left a comment
There was a problem hiding this comment.
the overlay file is also needed for the hawkbit sample
do you mean adding a samples/subsys/mgmt/hawkbit/boards/stm32h573i_dk.overlay |
yes |
|
with the samples/subsys/mgmt/hawkbit/boards/stm32h573i_dk.overlay included |
done |
There was a problem hiding this comment.
Non-blocking comments:
- Nitpicking in commit message for commit "drivers: clock: stm32H5 clock control of the PLL in MemoryMapped mode".
-Do not disable the pll clock if it source the xspi and if the external
+Do not disable the PLL clock if it sources the XSIP and if the external
flash is executing in Place. After mcuboot reset, the code is executed
on the external flash, through the xspi.
-The CONFIG_STM32_APP_IN_EXT_FLASH tis set and will avoid re-config
+The CONFIG_STM32_APP_IN_EXT_FLASH is set and will avoid re-config
-of the pll which is sourcing the xspi peripheral. When excuting in Place
+of the PLL which is sourcing the XSPI peripheral. When executing in Place
-on this external NOR It must not disable its own clock source (PLL).
+on this external NOR, it must not disable its own clock source (PLL).Or simplify:
Do not disable the PLL clock if it sources the XSIP and if the external
flash is executing in Place. CONFIG_STM32_APP_IN_EXT_FLASH
provides this information.
- In commit "drivers: flash: stm32 xspi flash driver skip init when executing in place",
the below sentence in the commit message is no more true since the previous commit implements that API function:
... (stm32h5 has no clock_control_get_status API)
-
For commit "Revert "samples: mgmt: hawkbit: force BOOT_MAX_IMG_SECTORS for stm32h573i_dk""
This commit does more than reverting a commit. IMHO the commit message header line should not be "Revert "samples: mgmt: ...". -
Nitpicking on some commit message body: some terminal dots
.are missing at end of sentences, see commits
"drivers: flash: stm32 xspi flash driver skip init when executing in place",
"boards: arm: stm32h573 disco kit move partition to ext flash" and
"samples: sysbuild: with mcu_boot on the stm32h573i_dk".
Do not disable the PLL clock if it sources the XSPI and if the external flash is executing in Place. After mcuboot reset, the code is executed on the external flash, through the xspi. The CONFIG_STM32_APP_IN_EXT_FLASH is set and will avoid re-config of the PLL which is sourcing the XSPI peripheral. When eXecuting in Place on this external NOR, it must not disable its own clock source (PLL). Signed-off-by: Francois Ramu <francois.ramu@st.com>
Add the control_get_status API function to the stm32h5 clock_control driver Signed-off-by: Francois Ramu <francois.ramu@st.com>
…lace The flash_stm32_xspi driver should not initialize the xspi, if this one is being use to execute in Place : the init is skipped. This mode is identified with the CONFIG_STM32_APP_IN_EXT_FLASH. Checking the memory mapped mode bit is possible when the xspi peripheral clock is not off (stm32h5 has no clock_control_get_status API) Signed-off-by: Francois Ramu <francois.ramu@st.com>
Add the XSPI 2 which is an octoSPI connection to a octo NOR flash mx25lm51245 on the stm32h573i_dk disco kit. Define the partition on the 64MBytes space of the external flash. Use the STM32Cube programmer to flash with the corresponding external loader for XiP mode. Removing usb_device will avoid test feature for that board. Signed-off-by: Francois Ramu <francois.ramu@st.com>
Run the sample to execute in place on the external flash of the stm32h573 disco kit. with_boot is build and linked for the external flash. Download the mcuboot zephyr.bin in internal memory. Download the with_mcuboot zephyr.signed.bin in external memory. Signed-off-by: Francois Ramu <francois.ramu@st.com>
Reverts commit 5700ffe. Not required anymore as the CONFIG_BOOT_MAX_IMG_SECTORS is fixed by the mcuboot at 4096. Add the corresponding overlay file. Signed-off-by: Francois Ramu <francois.ramu@st.com>
|
changes in some commit msg as recommended by @etienne-lms |
|
| bool | ||
| help | ||
| Allows the SoC clock driver to correctly initialize the | ||
| Q/O/XSPI controller clocks when the application is residing |
There was a problem hiding this comment.
So far, it only deals with XSPI. Q/O SPI will have to be updated to take it into account.



the stm32h5 disco kit board can run an application in external flash
Requires the #88646 which removes the warning in the DTC
With this PR it enable the memorymapped mode on the external flash memory so that XIP is possible on the external NOR octoflash
Two samples are running in XIP on the external flash
samples/application_development/code_relocation_nocopy/
samples/boards/st/hello_world_xip/ built with mcu boot mcu-tools/mcuboot#2323
Fixes #87531
This PR completes the #88051 for the stm32h5 serie