-
Notifications
You must be signed in to change notification settings - Fork 7.3k
stm32h7rs run application in external flash memory XIP #88052
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/application_development/code_relocation_nocopy/
(Be sure to erase internal and external memory partitions and to download the zephyr.hex file) |
With the samples/boards/st/hello_world_xip/ the goal is to place the mcuboot in the internalm flash memory and to jump to a zephyr application executed in the external flash
|
c96a37b
to
576fead
Compare
|
||
status = "okay"; | ||
|
||
mx25uw25645: xspi-nor-flash@70000000 { |
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.
Minor naming issue, but on the STM32H7S78-DK, it's actually a mx66uw1g45g
You had this in the first place, but then changed it in 94d4c78 ?
00e30e7
to
bcc9c4c
Compare
Hello @FRASTM I just tested this PR with the STM32H7S78-DK. First of all, I had to make these changes to have something that builds & flash properly: diff --git a/samples/boards/st/hello_world_xip/boards/stm32h7s78_dk.overlay b/samples/boards/st/hello_world_xip/boards/stm32h7s78_dk.overlay
index 700cb5f56d5..5357426313d 100644
--- a/samples/boards/st/hello_world_xip/boards/stm32h7s78_dk.overlay
+++ b/samples/boards/st/hello_world_xip/boards/stm32h7s78_dk.overlay
@@ -13,6 +13,11 @@
zephyr,flash = &mx66uw1g45;
zephyr,code-partition = &slot0_partition;
};
+
+ aliases {
+ led1 = &green_led;
+ led2 = &orange_led;
+ };
};
&mx66uw1g45 { I am building with the following command: west build -b stm32h7s78_dk zephyr/samples/boards/st/hello_world_xip/ --sysbuild -- \
-DSB_CONFIG_BOOTLOADER_MCUBOOT=y \
-Dhello_world_xip_CONFIG_FLASH=y -Dhello_world_xip_CONFIG_STM32_MEMMAP=y \
-Dmcuboot_CONFIG_LOG=y -Dmcuboot_CONFIG_LOG_DEFAULT_LEVEL=3 I am getting this log on the console:
From what I understand, the message |
I've added the following pll2 configuration (same as the pll1 above): diff --git a/boards/st/stm32h7s78_dk/stm32h7s78_dk.dts b/boards/st/stm32h7s78_dk/stm32h7s78_dk.dts
index d42b89d1629..b51d53e2ed2 100644
--- a/boards/st/stm32h7s78_dk/stm32h7s78_dk.dts
+++ b/boards/st/stm32h7s78_dk/stm32h7s78_dk.dts
@@ -88,6 +90,19 @@
status = "okay";
};
+/* PLL2 for clocking the xspi peripheral */
+&pll2 {
+ clocks = <&clk_hse>;
+ div-m = <12>;
+ mul-n = <250>;
+ div-p = <2>;
+ div-q = <2>;
+ div-r = <2>;
+ div-s = <2>;
+ div-t = <2>;
+ status = "okay";
+};
+
&rcc {
clocks = <&pll>;
clock-frequency = <DT_FREQ_M(250)>;
I don't know if that's a valid configuration at all, but now I am getting this log:
|
cfd1bdf
to
19360c8
Compare
tags: introduction | ||
sysbuild: true | ||
extra_args: | ||
- SB_CONFIG_BOOTLOADER_MCUBOOT=y |
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.
This should be put in a sysbuild.conf
file.
- b_u585i_iot02a | ||
platform_allow: | ||
- nucleo_h7s3l8 | ||
- stm32h7s78_dk |
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.
please add STM32H750B-DK 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.
yes, as soon as this is tested,
--> coming soon
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.
The stm32h750b_dk has quadspi NOR, that will be handled by another PR
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.
CONFIG_FLASH & CONFIG_STM32_MEMMAP need to be enabled.
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.
Not here, the xspi flash is configured in MemMapped from the mcuboot point of view
There is no need for configuring the MEMMAP from this hello_world_xip application POV : this application is not supposed to access the xspi for its own purpose, the external flash is "reserved" for executing the application
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.
Maybe, I'm not sure (kernel/app rodata for exp is in external Flash, so isn't MemMapped mode needed to be able to read it?). But in any casewest flash
won't be able to put the app image in external Flash if CONFIG_STM32_MEMMAP
is not enabled, because of if(CONFIG_STM32_MEMMAP)
in board.cmake
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.
That's the case with the samples/application_development/code_relocation_nocopy :
CONFIG_STM32_MEMMAP is set and west flash is downloading from board.cmake instruction at the right memory addresses
For the samples/boards/st/hello_world_xip, Up to now I download with stm32cubeprogrammer GUI
the build/mcuboot/zephyr/zephyr.bin at internal flash address 0x8000000
the build/hello_world_xip/zephyr/zephyr.signed.bin at external flash address 0x70000000 (or 0x90000000)
cc29174
to
30803be
Compare
6b39614
to
7e13c81
Compare
Based on the #88579 |
4f1cbbf
to
309c2eb
Compare
set the DNM label until the #88051 is merged |
This commit is retrieving the config FLASH_BASE_ADDRESS from the XSPI node of the stm32 device dtsi <reg> property of the "st,stm32-xspi" node. For example the CONFIG_FLASH_BASE_ADDRESS is 0x90000000 and application is linked for that address. Size is given by the size property of the "st,stm32-xspi-nor" node. Signed-off-by: Francois Ramu <[email protected]>
9e423f9
to
6dfd6d0
Compare
Add the clock domain configuration for the xspi nodes Where the DTS defines main clock and peripheral clock sel plus a XSPIM clock Signed-off-by: Francois Ramu <[email protected]>
Add the support of the stm32h7rs serie to the drivers/flash/flash_stm32_xspi driver. The stm32h7rs has no delayblock Signed-off-by: Francois Ramu <[email protected]>
Add the definitions of the PLL2 and PLL3 outputs for the stm32H7RS mcus and the HCLK5 which is clock source for the XSPI instance. Signed-off-by: Francois Ramu <[email protected]>
Defines the the xspi peripheral of the stm32h7rs serie Requires the corresponding memory area of the MPU. Signed-off-by: Francois Ramu <[email protected]>
Add the XSPI 2 which is an octoSPI connection to a octo NOR flash MX25UW25645GXDI00 (256 Mbits, 1.8 V, 200 MHz, DTR, rww) on the nucleo_h7s3l8 board. Signed-off-by: Francois Ramu <[email protected]>
Add the XSPI 2 which is an octoSPI connection to a octo NOR flash mx66uw1g45 on the stm32h7s78_dk disco kit Signed-off-by: Francois Ramu <[email protected]>
Adding the configuration to run
I realized, that west flash is possible if the stm32cubeprogrammer runner selects the external loader with the following condition CONFIG_XIP AND CONFIG_BOOTLOADER_MCUBOOT
When the samples/application_development/code_relocation_nocopy/ is built, the CONFIG_BOOTLOADER_MCUBOOT is not defined, but CONFIG_STM32_MEMMAP is. Should both be kept ?
|
Add the memory attributes to XiP in MemoryMapped mode on the external octo-flash of the nucleo_h7s3l8 board. Use the STM32Cube programmer to flash with the corresponding external loader for XiP mode. Signed-off-by: Francois Ramu <[email protected]>
Add the memory attributes to XiP in MemoryMapped mode on the external octo-flash of the stm32h7s78_dk board. Use the STM32Cube programmer to flash with the corresponding external loader for XiP mode. Signed-off-by: Francois Ramu <[email protected]>
Samples to execute code in external memory in Memory mapped mode on the stm32h7s3l8 nucleo or stm32h7s78 disco kit Signed-off-by: Francois Ramu <[email protected]>
Run the sample to execute in place on the external flash of the stm32h7s78_dk or nucleo_h7s3l8 boards. 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 <[email protected]>
|
|
the stm32h7rs nucleo or disco kit boards can run an application in external flash
The internal flash memory is limited to 64KB which is enough for mcuboot but might be too small for some zephyr applications
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
This PR completes the #88051
with samples to run application in external NOR memory on stm32h7rs target boards