Skip to content

Commit c4129d0

Browse files
committed
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 <[email protected]>
1 parent 07222c1 commit c4129d0

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

boot/zephyr/flash_map_extended.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,14 @@ BOOT_LOG_MODULE_DECLARE(mcuboot);
2424
/* MEMORY MAPPED for XiP on external NOR flash takes the sspi-nor or ospi-nor or qspi-nor device */
2525
#define FLASH_DEVICE_ID SPI_FLASH_0_ID
2626
#if DT_NODE_HAS_STATUS(DT_INST(0, st_stm32_xspi_nor), okay)
27-
#define DT_DRV_COMPAT st_stm32_xspi_nor
2827
#define FLASH_DEVICE_NODE DT_INST(0, st_stm32_xspi_nor)
29-
#define FLASH_DEVICE_BASE DT_REG_ADDR_BY_IDX(DT_INST_PARENT(0), 1)
28+
#define FLASH_DEVICE_BASE DT_REG_ADDR_BY_IDX(DT_PARENT(FLASH_DEVICE_NODE),1)
3029
#elif DT_NODE_HAS_STATUS(DT_INST(0, st_stm32_ospi_nor), okay)
3130
#define FLASH_DEVICE_NODE DT_INST(0, st_stm32_ospi_nor)
32-
#define FLASH_DEVICE_BASE DT_REG_ADDR(DT_INST(0, st_stm32_ospi_nor))
31+
#define FLASH_DEVICE_BASE DT_REG_ADDR_BY_IDX(DT_PARENT(FLASH_DEVICE_NODE),1)
3332
#elif DT_NODE_HAS_STATUS(DT_INST(0, st_stm32_qspi_nor), okay)
3433
#define FLASH_DEVICE_NODE DT_INST(0, st_stm32_qspi_nor)
35-
#define FLASH_DEVICE_BASE DT_REG_ADDR(DT_INST(0, st_stm32_qspi_nor))
34+
#define FLASH_DEVICE_BASE DT_REG_ADDR_BY_IDX(DT_PARENT(FLASH_DEVICE_NODE),1)
3635
#else
3736
#error "FLASH_DEVICE_NODE could not be determined"
3837
#endif

0 commit comments

Comments
 (0)