mcuboot icon indicating copy to clipboard operation
mcuboot copied to clipboard

mcuboot supports the stm32 external octo-flash in XiP

Open FRASTM opened this issue 1 year ago • 2 comments

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.

The MCUBOOT is required to validate the image which is supposed to be in the external flash memory. With

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

The mcuboot is built, linked and stored for the stm32 internal flash. The stm32 internal flash must declare the

		boot_partition: partition@0 {
			label = "mcuboot";
			reg = <0x00000000 DT_SIZE_K(64)>;
		};

Image slot 0 is located in the external NOR flash to be executed in XiP.

FRASTM avatar Jan 25 '24 10:01 FRASTM

Requires the ../zephyr/drivers/flash/flash_stm32_ospi.c to support the XiP as in https://github.com/zephyrproject-rtos/zephyr/pull/61082

$ west build -p always -b b_u585_iot02a -d build_mcuboot ../bootloader/mcuboot/boot/zephyr $ west flash -d build_mcuboot --> flash the build_mcuboot/zephyr/zephyr.bin at address 0x8000000

*** Booting Zephyr OS build zephyr-v3.5.0-5257-g667a0df780a5 ***
I: Starting Direct-XIP bootloader
I: Primary   slot: version=0.0.0+0
I: Secondary slot: version=0.0.0+0
I: Image 0 loaded from the primary slot
I: Bootloader chainload address offset: 0x0
I: Jumping to the image slot
*** Booting Zephyr OS build zephyr-v3.5.0-5257-g667a0df780a5 ***
Hello World from XIP! b_u585i_iot02a

assuming there is a valid image at Primary slot in the external NOR flash. AT least one valid image is required in the external NOR flash.

FRASTM avatar Jan 25 '24 10:01 FRASTM

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. This is also possible with stm32h750b_dk which has a DUAL quad-spi flash @0x90000000

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

and

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

`$ west flash -d build_mcuboot`
*** Booting Zephyr OS build zephyr-v3.5.0-5257-g667a0df780a5 ***
I: Starting Direct-XIP bootloader
I: Primary   slot: version=0.0.0+0
I: Secondary slot: version=0.0.0+0
I: Image 0 loaded from the primary slot
I: Bootloader chainload address offset: 0x0
I: Jumping to the image slot
*** Booting Zephyr OS build zephyr-v3.5.0-5257-g667a0df780a5 ***
Hello World from XIP! stm32h750b_dk

FRASTM avatar Jan 25 '24 10:01 FRASTM