Skip to content
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

mcuboot supports the stm32 external octo-flash in XiP #112

Closed
wants to merge 2 commits into from

Conversation

FRASTM
Copy link

@FRASTM FRASTM commented Jan 23, 2024

Prepare the boot/zephyr/flash_map_extended.c to support the stm32 MemoryMapped mode where the application is XiP from a external octo/quad flash memory
This is done by setting the CONFIG_STM32_MEMMAP flag which configures the octo/quad flash stm32 driver in MemoryMapped mode
Then the application which is built/linked/stored in slot1_partition of the external ospi-nor-flash/qspi-nor-flash NOR flash is identified by the MCU boot, loaded and executed on the external NOR.

With CONFIG_STM32_MEMMAP flag get NOR flash 32 bytes header
Read the NOR flash to get header of the image.
The FLASH_DEVICE is now the external NOR defined by
the board device tree to be the first qspi/ospi instance
(not necessarily zephyr, flash-controller)

Signed-off-by: Francois Ramu <francois.ramu@st.com>
Define the stm32 disco board configuration to set
the STM32 XIP mode that will enable the
MemoryMapped mode.
See Kconfig of the stm32 soc.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
@FRASTM
Copy link
Author

FRASTM commented Jan 23, 2024

Requires the ../zephyr/drivers/flash/flash_stm32_ospi.c to support the XiP as in zephyrproject-rtos/zephyr#61082
slot0 is kept in mcu internal flash0 memory and blank
slot1 is a partition of the external mx25lm51245: ospi-nor-flash
$ west build -p always -b b_u585i_iot02a -d build_mcuboot ../bootloader/mcuboot/boot/zephyr
$ west flash -d build_mcuboot
mcu boot is executed at address 0x8000000

*** Booting Zephyr OS build zephyr-v3.5.0-3956-ga00f7751d278 ***                
I: Starting Direct-XIP bootloader                                               
I: Image 0 Primary slot: Image not found                                        
I: Secondary slot: version=0.0.0+0                                              
I: Image 0 loaded from the secondary slot                                       
I: Bootloader chainload address offset: 0x0                                     
I: Jumping to the image slot                                                    
I: NOR init'd in MemMapped mode            

@FRASTM
Copy link
Author

FRASTM commented Jan 23, 2024

when building the mcu boot there is no slot for image (no image, only a mcuboot) flashing at boot_partition of the flash0
The way to build the mcuboot for stm32 internal flash @ 0x8000000 is with

	chosen {
		zephyr,flash = &flash0;
		zephyr,code-partition = &boot_partition;
	};

and

$ west build  -p always -b b_u585i_iot02a  -d build_mcuboot ../bootloader/mcuboot/boot/zephyr
$ west flash -d build_mcuboot

@nordicjm
Copy link
Collaborator

This is a mirror repository, it does not accept PRs. PRs must be posted upstream to https://github.com/mcu-tools/mcuboot

@FRASTM FRASTM closed this Jan 25, 2024
@FRASTM
Copy link
Author

FRASTM commented Jan 25, 2024

refer to mcu-tools#1891

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants