diff --git a/boot/zephyr/boards/b_u585i_iot02a.conf b/boot/zephyr/boards/b_u585i_iot02a.conf new file mode 100644 index 0000000000..7a89dffe67 --- /dev/null +++ b/boot/zephyr/boards/b_u585i_iot02a.conf @@ -0,0 +1,2 @@ +CONFIG_BOOT_DIRECT_XIP=y +CONFIG_STM32_MEMMAP=y diff --git a/boot/zephyr/boards/stm32f469i_disco.conf b/boot/zephyr/boards/stm32f469i_disco.conf new file mode 100644 index 0000000000..7a89dffe67 --- /dev/null +++ b/boot/zephyr/boards/stm32f469i_disco.conf @@ -0,0 +1,2 @@ +CONFIG_BOOT_DIRECT_XIP=y +CONFIG_STM32_MEMMAP=y diff --git a/boot/zephyr/boards/stm32f746g_disco.conf b/boot/zephyr/boards/stm32f746g_disco.conf new file mode 100644 index 0000000000..7a89dffe67 --- /dev/null +++ b/boot/zephyr/boards/stm32f746g_disco.conf @@ -0,0 +1,2 @@ +CONFIG_BOOT_DIRECT_XIP=y +CONFIG_STM32_MEMMAP=y diff --git a/boot/zephyr/boards/stm32f746g_disco.overlay b/boot/zephyr/boards/stm32f746g_disco.overlay new file mode 100644 index 0000000000..6f9d1c1919 --- /dev/null +++ b/boot/zephyr/boards/stm32f746g_disco.overlay @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2023 STMicroelectronics + * + * SPDX-License-Identifier: Apache-2.0 + */ +/delete-node/ &slot1_partition; + +/ { + chosen { + zephyr,code-partition = &slot1_partition; + }; +}; diff --git a/boot/zephyr/boards/stm32h735g_disco.conf b/boot/zephyr/boards/stm32h735g_disco.conf new file mode 100644 index 0000000000..7a89dffe67 --- /dev/null +++ b/boot/zephyr/boards/stm32h735g_disco.conf @@ -0,0 +1,2 @@ +CONFIG_BOOT_DIRECT_XIP=y +CONFIG_STM32_MEMMAP=y diff --git a/boot/zephyr/boards/stm32h735g_disco.overlay b/boot/zephyr/boards/stm32h735g_disco.overlay new file mode 100644 index 0000000000..c6590f1402 --- /dev/null +++ b/boot/zephyr/boards/stm32h735g_disco.overlay @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2023 STMicroelectronics + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* mapp the slot1 partition in the external NOR */ +/delete-node/ &slot1_partition; + +/ { + chosen { + zephyr,code-partition = &slot1_partition; + }; +}; + +&mx25lm51245 { + partitions { + /* put image at offset 0 in slot1 */ + slot1_partition:partition@0 { + label = "nor"; + reg = <0x00000000 DT_SIZE_M(4)>; + }; + }; +}; diff --git a/boot/zephyr/boards/stm32h747i_disco_m7.conf b/boot/zephyr/boards/stm32h747i_disco_m7.conf new file mode 100644 index 0000000000..7a89dffe67 --- /dev/null +++ b/boot/zephyr/boards/stm32h747i_disco_m7.conf @@ -0,0 +1,2 @@ +CONFIG_BOOT_DIRECT_XIP=y +CONFIG_STM32_MEMMAP=y diff --git a/boot/zephyr/boards/stm32h747i_disco_m7.overlay b/boot/zephyr/boards/stm32h747i_disco_m7.overlay new file mode 100644 index 0000000000..5965e5c24b --- /dev/null +++ b/boot/zephyr/boards/stm32h747i_disco_m7.overlay @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2023 STMicroelectronics + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* mapp the slot1 partition in the external NOR */ +/delete-node/ &slot1_partition; + +/ { + chosen { + zephyr,code-partition = &slot1_partition; + }; +}; + +&mt25ql512ab1 { + partitions { + /* put image at offset 0 in slot1 */ + slot1_partition:partition@0 { + label = "nor"; + reg = <0x00000000 DT_SIZE_M(4)>; + }; + }; +}; diff --git a/boot/zephyr/boards/stm32h7b3i_dk.conf b/boot/zephyr/boards/stm32h7b3i_dk.conf new file mode 100644 index 0000000000..7a89dffe67 --- /dev/null +++ b/boot/zephyr/boards/stm32h7b3i_dk.conf @@ -0,0 +1,2 @@ +CONFIG_BOOT_DIRECT_XIP=y +CONFIG_STM32_MEMMAP=y diff --git a/boot/zephyr/boards/stm32h7b3i_dk.overlay b/boot/zephyr/boards/stm32h7b3i_dk.overlay new file mode 100644 index 0000000000..c6590f1402 --- /dev/null +++ b/boot/zephyr/boards/stm32h7b3i_dk.overlay @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2023 STMicroelectronics + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* mapp the slot1 partition in the external NOR */ +/delete-node/ &slot1_partition; + +/ { + chosen { + zephyr,code-partition = &slot1_partition; + }; +}; + +&mx25lm51245 { + partitions { + /* put image at offset 0 in slot1 */ + slot1_partition:partition@0 { + label = "nor"; + reg = <0x00000000 DT_SIZE_M(4)>; + }; + }; +}; diff --git a/boot/zephyr/boards/stm32l496g_disco.conf b/boot/zephyr/boards/stm32l496g_disco.conf new file mode 100644 index 0000000000..7a89dffe67 --- /dev/null +++ b/boot/zephyr/boards/stm32l496g_disco.conf @@ -0,0 +1,2 @@ +CONFIG_BOOT_DIRECT_XIP=y +CONFIG_STM32_MEMMAP=y diff --git a/boot/zephyr/boards/stm32l496g_disco.overlay b/boot/zephyr/boards/stm32l496g_disco.overlay new file mode 100644 index 0000000000..c6590f1402 --- /dev/null +++ b/boot/zephyr/boards/stm32l496g_disco.overlay @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2023 STMicroelectronics + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* mapp the slot1 partition in the external NOR */ +/delete-node/ &slot1_partition; + +/ { + chosen { + zephyr,code-partition = &slot1_partition; + }; +}; + +&mx25lm51245 { + partitions { + /* put image at offset 0 in slot1 */ + slot1_partition:partition@0 { + label = "nor"; + reg = <0x00000000 DT_SIZE_M(4)>; + }; + }; +}; diff --git a/boot/zephyr/flash_map_extended.c b/boot/zephyr/flash_map_extended.c index 64e80085c6..6d28cb92ce 100644 --- a/boot/zephyr/flash_map_extended.c +++ b/boot/zephyr/flash_map_extended.c @@ -18,7 +18,20 @@ BOOT_LOG_MODULE_DECLARE(mcuboot); -#if (!defined(CONFIG_XTENSA) && DT_HAS_CHOSEN(zephyr_flash_controller)) +#if defined(CONFIG_STM32_MEMMAP) +/* MEMORY MAPPED for XiP on external NOR flash takes the ospi-nor or qspi-nor device */ +#define FLASH_DEVICE_ID SPI_FLASH_0_ID +#if DT_NODE_HAS_STATUS(DT_INST(0, st_stm32_ospi_nor), okay) +#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)) +#elif DT_NODE_HAS_STATUS(DT_INST(0, st_stm32_qspi_nor), okay) +#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)) +#else +#error "FLASH_DEVICE_NODE could not be determined" +#endif + +#elif (!defined(CONFIG_XTENSA) && DT_HAS_CHOSEN(zephyr_flash_controller)) #define FLASH_DEVICE_ID SOC_FLASH_0_ID #define FLASH_DEVICE_BASE CONFIG_FLASH_BASE_ADDRESS #define FLASH_DEVICE_NODE DT_CHOSEN(zephyr_flash_controller)