diff --git a/arch/xtensa/src/esp32s2/Kconfig b/arch/xtensa/src/esp32s2/Kconfig index d1f83ed6602..628d5179ff8 100644 --- a/arch/xtensa/src/esp32s2/Kconfig +++ b/arch/xtensa/src/esp32s2/Kconfig @@ -1403,7 +1403,7 @@ endchoice config ESP32S2_MCUBOOT_VERSION string "MCUboot version" - default "b206b99b1555ca15f790a3287e57dc98ef3df2ac" + default "20f98e0a975c24864872e0df5701eb1082e9c957" depends on ESP32S2_APP_FORMAT_MCUBOOT config ESP32S2_APP_MCUBOOT_HEADER_SIZE diff --git a/boards/xtensa/esp32s2/common/scripts/esp32s2_sections.ld b/boards/xtensa/esp32s2/common/scripts/esp32s2_sections.ld index 130fa80587f..8c5643675f8 100644 --- a/boards/xtensa/esp32s2/common/scripts/esp32s2_sections.ld +++ b/boards/xtensa/esp32s2/common/scripts/esp32s2_sections.ld @@ -31,6 +31,11 @@ SECTIONS #ifdef CONFIG_ESP32S2_APP_FORMAT_MCUBOOT .metadata : { + /* The following metadata refers to the to MCUboot's struct + * esp_image_load_header defined at the following commit: + * https://github.com/mcu-tools/mcuboot/blob/cd22b693da426826e0255f8ee5b18d7360d9bc8f/boot/espressif/hal/include/esp_mcuboot_image.h + */ + /* Magic for load header */ LONG(0xace637d3) @@ -58,6 +63,46 @@ SECTIONS LONG(ADDR(.dram0.data)) LONG(LOADADDR(.dram0.data)) LONG(SIZEOF(.dram0.data)) + + /* RTC_IRAM metadata: + * - Destination address (VMA) for RTC_IRAM region + * - Flash offset (LMA) for start of RTC_IRAM region + * - Size of RTC_IRAM region + */ + + LONG(ADDR(.rtc.text)) + LONG(LOADADDR(.rtc.text)) + LONG(SIZEOF(.rtc.text)) + + /* RTC_DRAM metadata: + * - Destination address (VMA) for RTC_DRAM region + * - Flash offset (LMA) for start of RTC_DRAM region + * - Size of RTC_DRAM region + */ + + LONG(ADDR(.rtc.data)) + LONG(LOADADDR(.rtc.data)) + LONG(SIZEOF(.rtc.data)) + + /* IROM metadata: + * - Destination address (VMA) for IROM region + * - Flash offset (LMA) for start of IROM region + * - Size of IROM region + */ + + LONG(ADDR(.flash.text)) + LONG(LOADADDR(.flash.text)) + LONG(SIZEOF(.flash.text)) + + /* DROM metadata: + * - Destination address (VMA) for DROM region + * - Flash offset (LMA) for start of DROM region + * - Size of DROM region + */ + + LONG(ADDR(.flash.rodata)) + LONG(LOADADDR(.flash.rodata)) + LONG(LOADADDR(.flash.rodata) + SIZEOF(.flash.rodata) - LOADADDR(.flash.rodata)) } >metadata #endif diff --git a/boards/xtensa/esp32s2/common/scripts/flat_memory.ld b/boards/xtensa/esp32s2/common/scripts/flat_memory.ld index 579f24c2f9c..7568ecfdf06 100644 --- a/boards/xtensa/esp32s2/common/scripts/flat_memory.ld +++ b/boards/xtensa/esp32s2/common/scripts/flat_memory.ld @@ -71,7 +71,7 @@ MEMORY * signing of firmware image. */ - metadata (RX) : org = CONFIG_ESP32S2_APP_MCUBOOT_HEADER_SIZE, len = 0x20 + metadata (RX) : org = CONFIG_ESP32S2_APP_MCUBOOT_HEADER_SIZE, len = 0x60 ROM (RX) : org = ORIGIN(metadata) + LENGTH(metadata), len = FLASH_SIZE - ORIGIN(ROM) #elif defined (CONFIG_ESPRESSIF_SIMPLE_BOOT)