From ff674e21409f97278e80606f45978e6cac541056 Mon Sep 17 00:00:00 2001 From: Francois Ramu Date: Fri, 1 Sep 2023 10:20:40 +0200 Subject: [PATCH 1/3] boot: zephyr: defines FLASH device for 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 given by the parent of the "st,stm32-xspi-nor" node, which is the "st,stm32-xspi" compatible same for qspi/ospi instances of stm32 devices. Signed-off-by: Francois Ramu --- boot/zephyr/flash_map_extended.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/boot/zephyr/flash_map_extended.c b/boot/zephyr/flash_map_extended.c index 6acf76f462..c5afb632bc 100644 --- a/boot/zephyr/flash_map_extended.c +++ b/boot/zephyr/flash_map_extended.c @@ -28,11 +28,13 @@ BOOT_LOG_MODULE_DECLARE(mcuboot); #define FLASH_DEVICE_NODE DT_INST(0, st_stm32_xspi_nor) #define FLASH_DEVICE_BASE DT_REG_ADDR_BY_IDX(DT_INST_PARENT(0), 1) #elif DT_NODE_HAS_STATUS(DT_INST(0, st_stm32_ospi_nor), okay) +#define DT_DRV_COMPAT st_stm32_ospi_nor #define FLASH_DEVICE_NODE DT_INST(0, st_stm32_ospi_nor) -#define FLASH_DEVICE_BASE DT_REG_ADDR(DT_INST(0, st_stm32_ospi_nor)) +#define FLASH_DEVICE_BASE DT_REG_ADDR_BY_IDX(DT_INST_PARENT(0), 1) #elif DT_NODE_HAS_STATUS(DT_INST(0, st_stm32_qspi_nor), okay) +#define DT_DRV_COMPAT st_stm32_qspi_nor #define FLASH_DEVICE_NODE DT_INST(0, st_stm32_qspi_nor) -#define FLASH_DEVICE_BASE DT_REG_ADDR(DT_INST(0, st_stm32_qspi_nor)) +#define FLASH_DEVICE_BASE DT_REG_ADDR_BY_IDX(DT_INST_PARENT(0), 1) #else #error "FLASH_DEVICE_NODE could not be determined" #endif From 5ba7da10333457ae4094652aab6204318d56dc15 Mon Sep 17 00:00:00 2001 From: Francois Ramu Date: Wed, 2 Jul 2025 10:19:39 +0200 Subject: [PATCH 2/3] boot: zephyr: boards config of the stm32h7rs target boards Define the stm32h7s7 board configuration to set the STM32 XIP mode that will enable the MemoryMapped mode. Gives larger sector size for the external NOR flash See Kconfig of the stm32 soc. Choose the mcu_boot partition where to build ../bootloader/mcuboot/boot/zephyr Signed-off-by: Francois Ramu --- boot/zephyr/boards/nucleo_h7s3l8.conf | 4 ++++ boot/zephyr/boards/stm32h7s78_dk.conf | 4 ++++ 2 files changed, 8 insertions(+) create mode 100644 boot/zephyr/boards/nucleo_h7s3l8.conf create mode 100644 boot/zephyr/boards/stm32h7s78_dk.conf diff --git a/boot/zephyr/boards/nucleo_h7s3l8.conf b/boot/zephyr/boards/nucleo_h7s3l8.conf new file mode 100644 index 0000000000..93013ed9a1 --- /dev/null +++ b/boot/zephyr/boards/nucleo_h7s3l8.conf @@ -0,0 +1,4 @@ +CONFIG_BOOT_DIRECT_XIP=y +CONFIG_STM32_MEMMAP=y +CONFIG_BOOT_MAX_IMG_SECTORS_AUTO=n +CONFIG_BOOT_MAX_IMG_SECTORS=4096 diff --git a/boot/zephyr/boards/stm32h7s78_dk.conf b/boot/zephyr/boards/stm32h7s78_dk.conf new file mode 100644 index 0000000000..93013ed9a1 --- /dev/null +++ b/boot/zephyr/boards/stm32h7s78_dk.conf @@ -0,0 +1,4 @@ +CONFIG_BOOT_DIRECT_XIP=y +CONFIG_STM32_MEMMAP=y +CONFIG_BOOT_MAX_IMG_SECTORS_AUTO=n +CONFIG_BOOT_MAX_IMG_SECTORS=4096 From 319c8e87cc3b668e275ed40c5ab3e32929f78ea3 Mon Sep 17 00:00:00 2001 From: Francois Ramu Date: Tue, 8 Apr 2025 17:42:59 +0200 Subject: [PATCH 3/3] boot: zephyr: boards config of the stm32h573 disco kit Define the stm32h573 board configuration to set the STM32 XIP mode that will enable the MemoryMapped mode. Gives larger sector size for the external NOR flash See Kconfig of the stm32 soc. Choose the mcu_boot partition where to build ../bootloader/mcuboot/boot/zephyr The zephyr, chosen zephyr,flash = &flash0; is in the board dts. The zephyr,code-partition = &boot_partition; is given by the app.overlay Signed-off-by: Francois Ramu --- boot/zephyr/boards/stm32h573i_dk.conf | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 boot/zephyr/boards/stm32h573i_dk.conf diff --git a/boot/zephyr/boards/stm32h573i_dk.conf b/boot/zephyr/boards/stm32h573i_dk.conf new file mode 100644 index 0000000000..93013ed9a1 --- /dev/null +++ b/boot/zephyr/boards/stm32h573i_dk.conf @@ -0,0 +1,4 @@ +CONFIG_BOOT_DIRECT_XIP=y +CONFIG_STM32_MEMMAP=y +CONFIG_BOOT_MAX_IMG_SECTORS_AUTO=n +CONFIG_BOOT_MAX_IMG_SECTORS=4096