arch/xtensa: update MCUBoot and virtual E-Fuse offset

Updates MCUBoot version and default address for virtual E-Fuse, depending
if MCUBoot is enabled.

Signed-off-by: Filipe Cavalcanti <filipe.cavalcanti@espressif.com>
This commit is contained in:
Filipe Cavalcanti
2025-09-03 09:34:09 -03:00
committed by Xiang Xiao
parent f9111e8946
commit df6e5384fe
12 changed files with 89 additions and 20 deletions
+13 -11
View File
@@ -53,7 +53,7 @@ config ESPRESSIF_EFUSE_VIRTUAL
depends on ESPRESSIF_EFUSE
default n
---help---
Enable virtual efuse support to simulate eFuse operations in RAM, changes will be reverted each reboot
Enable virtual efuse support to simulate eFuse operations in RAM, changes will be reverted each reboot.
config ESPRESSIF_EFUSE_VIRTUAL_KEEP_IN_FLASH
bool "Keep E-Fuses in flash"
@@ -67,23 +67,25 @@ config ESPRESSIF_EFUSE_VIRTUAL_KEEP_IN_FLASH
This mode is useful when need to keep changes after reboot (testing secure_boot,
flash_encryption or using MCUBoot + encryption).
if ESPRESSIF_EFUSE_VIRTUAL_KEEP_IN_FLASH
if ESPRESSIF_EFUSE_VIRTUAL_KEEP_IN_FLASH || ESPRESSIF_BOOTLOADER_MCUBOOT
menu "Virtual E-Fuse Options"
config ESPRESSIF_EFUSE_VIRTUAL_KEEP_IN_FLASH_OFFSET
hex "E-Fuses offset in flash"
depends on ESPRESSIF_EFUSE_VIRTUAL_KEEP_IN_FLASH
default 0x250000
hex "Virtual E-Fuses offset in flash"
default 0x10000 if ESPRESSIF_BOOTLOADER_MCUBOOT
default 0x250000 if !ESPRESSIF_BOOTLOADER_MCUBOOT
---help---
Offset in flash where the E-Fuses will be stored when using the "E-Fuses size to keep in flash" option.
config ESPRESSIF_EFUSE_VIRTUAL_KEEP_IN_FLASH_SIZE
hex "E-Fuses size to keep in flash"
depends on ESPRESSIF_EFUSE_VIRTUAL_KEEP_IN_FLASH
hex "Virtual E-Fuses size to keep in flash"
default 0x2000
---help---
Size of E-Fuse region to keep in flash.
endif # ESPRESSIF_EFUSE_VIRTUAL_KEEP_IN_FLASH
endmenu # Virtual E-Fuse Options
endif # ESPRESSIF_EFUSE_VIRTUAL_KEEP_IN_FLASH || ESPRESSIF_BOOTLOADER_MCUBOOT
config ESPRESSIF_TEMP
bool "Internal Temperature Sensor"
@@ -1123,7 +1125,7 @@ comment "Application Image OTA Update support"
config ESPRESSIF_OTA_PRIMARY_SLOT_OFFSET
hex "Application image primary slot offset"
default 0x10000
default 0x20000
config ESPRESSIF_OTA_PRIMARY_SLOT_DEVPATH
string "Application image primary slot device path"
@@ -1131,7 +1133,7 @@ config ESPRESSIF_OTA_PRIMARY_SLOT_DEVPATH
config ESPRESSIF_OTA_SECONDARY_SLOT_OFFSET
hex "Application image secondary slot offset"
default 0x110000
default 0x120000
config ESPRESSIF_OTA_SECONDARY_SLOT_DEVPATH
string "Application image secondary slot device path"
@@ -1143,7 +1145,7 @@ config ESPRESSIF_OTA_SLOT_SIZE
config ESPRESSIF_OTA_SCRATCH_OFFSET
hex "Scratch partition offset"
default 0x210000
default 0x220000
config ESPRESSIF_OTA_SCRATCH_SIZE
hex "Scratch partition size"
+8
View File
@@ -125,6 +125,14 @@ ifeq ($(CONFIG_ESP32_APP_FORMAT_MCUBOOT),y)
$(call cfg_en,CONFIG_IDF_TARGET_ARCH_XTENSA) \
$(call cfg_val,CONFIG_BOOTLOADER_LOG_LEVEL,3) \
} >> $(BOOTLOADER_CONFIG)
ifeq ($(CONFIG_ESPRESSIF_EFUSE_VIRTUAL_KEEP_IN_FLASH),y)
$(Q) { \
$(call cfg_en,CONFIG_EFUSE_VIRTUAL) \
$(call cfg_en,CONFIG_EFUSE_VIRTUAL_KEEP_IN_FLASH) \
$(call cfg_val,CONFIG_EFUSE_VIRTUAL_OFFSET,$(CONFIG_ESPRESSIF_EFUSE_VIRTUAL_KEEP_IN_FLASH_OFFSET)) \
$(call cfg_val,CONFIG_EFUSE_VIRTUAL_SIZE,$(CONFIG_ESPRESSIF_EFUSE_VIRTUAL_KEEP_IN_FLASH_SIZE)) \
} >> $(BOOTLOADER_CONFIG)
endif
else ifeq ($(CONFIG_ESP32_APP_FORMAT_LEGACY),y)
$(Q) { \
$(call cfg_en,CONFIG_PARTITION_TABLE_CUSTOM) \
+4 -4
View File
@@ -1835,7 +1835,7 @@ config ESP32_OTA_PARTITION_ENCRYPT
config ESP32_OTA_PRIMARY_SLOT_OFFSET
hex "Application image primary slot offset"
default 0x10000
default 0x20000
config ESP32_OTA_PRIMARY_SLOT_DEVPATH
string "Application image primary slot device path"
@@ -1843,7 +1843,7 @@ config ESP32_OTA_PRIMARY_SLOT_DEVPATH
config ESP32_OTA_SECONDARY_SLOT_OFFSET
hex "Application image secondary slot offset"
default 0x110000
default 0x120000
config ESP32_OTA_SECONDARY_SLOT_DEVPATH
string "Application image secondary slot device path"
@@ -1855,7 +1855,7 @@ config ESP32_OTA_SLOT_SIZE
config ESP32_OTA_SCRATCH_OFFSET
hex "Scratch partition offset"
default 0x210000
default 0x220000
config ESP32_OTA_SCRATCH_SIZE
hex "Scratch partition size"
@@ -2793,7 +2793,7 @@ endchoice
config ESP32_MCUBOOT_VERSION
string "MCUboot version"
depends on ESP32_APP_FORMAT_MCUBOOT
default "20f98e0a975c24864872e0df5701eb1082e9c957"
default "aa4fa2b6e17361dd3ce16a60883059778fd147a9"
config ESP32_APP_MCUBOOT_HEADER_SIZE
int "Application image header size (in bytes)"
+1
View File
@@ -284,5 +284,6 @@ endif
distclean::
$(call DELDIR,chip/$(ESP_HAL_3RDPARTY_REPO))
$(call DELFILE,../../../vefuse.bin)
INCLUDES += ${INCDIR_PREFIX}$(ARCH_SRCDIR)$(DELIM)common$(DELIM)espressif
+1 -1
View File
@@ -1448,7 +1448,7 @@ endchoice
config ESP32S2_MCUBOOT_VERSION
string "MCUboot version"
default "20f98e0a975c24864872e0df5701eb1082e9c957"
default "aa4fa2b6e17361dd3ce16a60883059778fd147a9"
depends on ESP32S2_APP_FORMAT_MCUBOOT
config ESP32S2_APP_MCUBOOT_HEADER_SIZE
+1
View File
@@ -188,3 +188,4 @@ distclean::
ifeq ($(CONFIG_ESPRESSIF_USE_ULP_RISCV_CORE),y)
$(call DELDIR,chip/ulp)
endif
$(call DELFILE,../../../vefuse.bin)
+8
View File
@@ -96,6 +96,14 @@ ifeq ($(CONFIG_ESP32S3_APP_FORMAT_MCUBOOT),y)
$(call cfg_en,CONFIG_IDF_TARGET_ARCH_XTENSA) \
$(call cfg_val,CONFIG_BOOTLOADER_LOG_LEVEL,3) \
} >> $(BOOTLOADER_CONFIG)
ifeq ($(CONFIG_ESPRESSIF_EFUSE_VIRTUAL_KEEP_IN_FLASH),y)
$(Q) { \
$(call cfg_en,CONFIG_EFUSE_VIRTUAL) \
$(call cfg_en,CONFIG_EFUSE_VIRTUAL_KEEP_IN_FLASH) \
$(call cfg_val,CONFIG_EFUSE_VIRTUAL_OFFSET,$(CONFIG_ESPRESSIF_EFUSE_VIRTUAL_KEEP_IN_FLASH_OFFSET)) \
$(call cfg_val,CONFIG_EFUSE_VIRTUAL_SIZE,$(CONFIG_ESPRESSIF_EFUSE_VIRTUAL_KEEP_IN_FLASH_SIZE)) \
} >> $(BOOTLOADER_CONFIG)
endif
else ifeq ($(CONFIG_ESP32S3_APP_FORMAT_LEGACY),y)
$(Q) { \
$(call cfg_en,CONFIG_PARTITION_TABLE_CUSTOM) \
+4 -4
View File
@@ -1925,7 +1925,7 @@ comment "Application Image OTA Update support"
config ESP32S3_OTA_PRIMARY_SLOT_OFFSET
hex "Application image primary slot offset"
default 0x10000
default 0x20000
config ESP32S3_OTA_PRIMARY_SLOT_DEVPATH
string "Application image primary slot device path"
@@ -1933,7 +1933,7 @@ config ESP32S3_OTA_PRIMARY_SLOT_DEVPATH
config ESP32S3_OTA_SECONDARY_SLOT_OFFSET
hex "Application image secondary slot offset"
default 0x110000
default 0x120000
config ESP32S3_OTA_SECONDARY_SLOT_DEVPATH
string "Application image secondary slot device path"
@@ -1945,7 +1945,7 @@ config ESP32S3_OTA_SLOT_SIZE
config ESP32S3_OTA_SCRATCH_OFFSET
hex "Scratch partition offset"
default 0x210000
default 0x220000
config ESP32S3_OTA_SCRATCH_SIZE
hex "Scratch partition size"
@@ -2766,7 +2766,7 @@ endchoice
config ESP32S3_MCUBOOT_VERSION
string "MCUboot version"
default "20f98e0a975c24864872e0df5701eb1082e9c957"
default "aa4fa2b6e17361dd3ce16a60883059778fd147a9"
depends on ESP32S3_APP_FORMAT_MCUBOOT
config ESP32S3_APP_MCUBOOT_HEADER_SIZE
+1
View File
@@ -274,3 +274,4 @@ distclean::
ifeq ($(CONFIG_ESPRESSIF_USE_ULP_RISCV_CORE),y)
$(call DELDIR,chip/ulp)
endif
$(call DELFILE,../../../vefuse.bin)
+16
View File
@@ -20,6 +20,12 @@
#
############################################################################
# MCUBoot requires a region in flash for the E-Fuse virtual mode.
# To avoid erasing this region, flash a dummy empty file to the
# virtual E-Fuse offset.
VIRTUAL_EFUSE_BIN := vefuse.bin
# These are the macros that will be used in the NuttX make system to compile
# and assemble source files and to insert the resulting object files into an
# archive. These replace the default definitions at tools/Config.mk
@@ -58,6 +64,12 @@ endif
ESPTOOL_FLASH_OPTS := -fs $(FLASH_SIZE) -fm $(FLASH_MODE) -ff $(FLASH_FREQ)
define MAKE_VIRTUAL_EFUSE_BIN
$(Q)if [ ! -f "$(VIRTUAL_EFUSE_BIN)" ]; then \
dd if=/dev/zero of=$(VIRTUAL_EFUSE_BIN) count=0 status=none; \
fi
endef
# Configure the variables according to build environment
ESPTOOL_MIN_VERSION := 4.8.0
@@ -95,6 +107,9 @@ ifeq ($(CONFIG_ESP32_APP_FORMAT_LEGACY),y)
APP_IMAGE := nuttx.bin
FLASH_APP := $(APP_OFFSET) $(APP_IMAGE)
else ifeq ($(CONFIG_ESP32_APP_FORMAT_MCUBOOT),y)
ESPTOOL_BINS += $(CONFIG_ESPRESSIF_EFUSE_VIRTUAL_KEEP_IN_FLASH_OFFSET) $(VIRTUAL_EFUSE_BIN)
ifeq ($(CONFIG_ESP32_ESPTOOL_TARGET_PRIMARY),y)
VERIFIED := --confirm
APP_OFFSET := $(CONFIG_ESP32_OTA_PRIMARY_SLOT_OFFSET)
@@ -274,6 +289,7 @@ endif
define POSTBUILD
$(call MKIMAGE)
$(if $(CONFIG_ESPRESSIF_BOOTLOADER_MCUBOOT),$(call MAKE_VIRTUAL_EFUSE_BIN))
$(if $(CONFIG_ESP32_MERGE_BINS),$(call MERGEBIN))
endef
+16
View File
@@ -20,6 +20,12 @@
#
############################################################################
# MCUBoot requires a region in flash for the E-Fuse virtual mode.
# To avoid erasing this region, flash a dummy empty file to the
# virtual E-Fuse offset.
VIRTUAL_EFUSE_BIN := vefuse.bin
# These are the macros that will be used in the NuttX make system to compile
# and assemble source files and to insert the resulting object files into an
# archive. These replace the default definitions at tools/Config.mk
@@ -58,6 +64,12 @@ endif
ESPTOOL_FLASH_OPTS := -fs $(FLASH_SIZE) -fm $(FLASH_MODE) -ff $(FLASH_FREQ)
define MAKE_VIRTUAL_EFUSE_BIN
$(Q)if [ ! -f "$(VIRTUAL_EFUSE_BIN)" ]; then \
dd if=/dev/zero of=$(VIRTUAL_EFUSE_BIN) count=0 status=none; \
fi
endef
# Configure the variables according to build environment
ESPTOOL_MIN_VERSION := 4.8.0
@@ -83,6 +95,9 @@ ifdef ESPTOOL_BINDIR
endif
ifeq ($(CONFIG_ESP32S2_APP_FORMAT_MCUBOOT),y)
ESPTOOL_BINS += $(CONFIG_ESPRESSIF_EFUSE_VIRTUAL_KEEP_IN_FLASH_OFFSET) $(VIRTUAL_EFUSE_BIN)
ifeq ($(CONFIG_ESP32S2_ESPTOOL_TARGET_PRIMARY),y)
VERIFIED := --confirm
APP_OFFSET := $(CONFIG_ESPRESSIF_OTA_PRIMARY_SLOT_OFFSET)
@@ -235,6 +250,7 @@ endif
define POSTBUILD
$(call MKIMAGE)
$(if $(CONFIG_ESPRESSIF_BOOTLOADER_MCUBOOT),$(call MAKE_VIRTUAL_EFUSE_BIN))
$(if $(CONFIG_ESP32S2_MERGE_BINS),$(call MERGEBIN))
endef
+16
View File
@@ -20,6 +20,12 @@
#
############################################################################
# MCUBoot requires a region in flash for the E-Fuse virtual mode.
# To avoid erasing this region, flash a dummy empty file to the
# virtual E-Fuse offset.
VIRTUAL_EFUSE_BIN := vefuse.bin
# These are the macros that will be used in the NuttX make system to compile
# and assemble source files and to insert the resulting object files into an
# archive. These replace the default definitions at tools/Config.mk
@@ -56,6 +62,12 @@ endif
ESPTOOL_FLASH_OPTS := -fs $(FLASH_SIZE) -fm $(FLASH_MODE) -ff $(FLASH_FREQ)
define MAKE_VIRTUAL_EFUSE_BIN
$(Q)if [ ! -f "$(VIRTUAL_EFUSE_BIN)" ]; then \
dd if=/dev/zero of=$(VIRTUAL_EFUSE_BIN) count=0 status=none; \
fi
endef
# Configure the variables according to build environment
ESPTOOL_MIN_VERSION := 4.8.0
@@ -82,6 +94,9 @@ ifeq ($(CONFIG_ESP32S3_APP_FORMAT_LEGACY),y)
APP_IMAGE := nuttx.bin
FLASH_APP := $(APP_OFFSET) $(APP_IMAGE)
else ifeq ($(CONFIG_ESP32S3_APP_FORMAT_MCUBOOT),y)
ESPTOOL_BINS += $(CONFIG_ESPRESSIF_EFUSE_VIRTUAL_KEEP_IN_FLASH_OFFSET) $(VIRTUAL_EFUSE_BIN)
ifeq ($(CONFIG_ESP32S3_ESPTOOL_TARGET_PRIMARY),y)
VERIFIED := --confirm
APP_OFFSET := $(CONFIG_ESP32S3_OTA_PRIMARY_SLOT_OFFSET)
@@ -200,6 +215,7 @@ endif
define POSTBUILD
$(call MKIMAGE)
$(if $(CONFIG_ESPRESSIF_BOOTLOADER_MCUBOOT),$(call MAKE_VIRTUAL_EFUSE_BIN))
$(if $(CONFIG_ESP32S3_MERGE_BINS),$(call MERGEBIN))
endef