This is an automated email from the ASF dual-hosted git repository. xiaoxiang pushed a commit to branch releases/12.10 in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit e15e6820caaef7839296579b68d04e67bfcea495 Author: Filipe Cavalcanti <filipe.cavalca...@espressif.com> AuthorDate: Thu Jun 12 16:59:43 2025 -0300 arch/xtensa: decouple common source for Espressif's MCUBoot port Decouples the NuttX build from the MCUBoot common source on Xtensa devices. Allows using different branches for each. Signed-off-by: Filipe Cavalcanti <filipe.cavalca...@espressif.com> --- arch/xtensa/src/esp32/.gitignore | 1 + arch/xtensa/src/esp32/Bootloader.mk | 21 +++++++++++++++++++-- arch/xtensa/src/esp32s2/.gitignore | 1 + arch/xtensa/src/esp32s2/Bootloader.mk | 22 ++++++++++++++++++++-- arch/xtensa/src/esp32s3/.gitignore | 1 + arch/xtensa/src/esp32s3/Bootloader.mk | 21 +++++++++++++++++++-- 6 files changed, 61 insertions(+), 6 deletions(-) diff --git a/arch/xtensa/src/esp32/.gitignore b/arch/xtensa/src/esp32/.gitignore index ab19fe9ea8..94940fe623 100644 --- a/arch/xtensa/src/esp32/.gitignore +++ b/arch/xtensa/src/esp32/.gitignore @@ -1,3 +1,4 @@ /esp-hal-3rdparty +/esp-hal-3rdparty-mcuboot /esp-wireless-drivers-3rdparty /*.zip diff --git a/arch/xtensa/src/esp32/Bootloader.mk b/arch/xtensa/src/esp32/Bootloader.mk index 411cce20ba..e7ef1354a6 100644 --- a/arch/xtensa/src/esp32/Bootloader.mk +++ b/arch/xtensa/src/esp32/Bootloader.mk @@ -24,7 +24,6 @@ ifeq ($(CONFIG_ESPRESSIF_SIMPLE_BOOT),) TOOLSDIR = $(TOPDIR)/tools/espressif CHIPDIR = $(TOPDIR)/arch/xtensa/src/chip -HALDIR = $(CHIPDIR)/esp-hal-3rdparty BOOTLOADER_DIR = $(CHIPDIR)/bootloader BOOTLOADER_SRCDIR = $(BOOTLOADER_DIR)/esp-nuttx-bootloader @@ -32,10 +31,12 @@ BOOTLOADER_VERSION = main BOOTLOADER_URL = https://github.com/espressif/esp-nuttx-bootloader BOOTLOADER_OUTDIR = out BOOTLOADER_CONFIG = $(BOOTLOADER_DIR)/bootloader.conf +HALDIR = $(BOOTLOADER_DIR)/esp-hal-3rdparty-mcuboot MCUBOOT_SRCDIR = $(BOOTLOADER_DIR)/mcuboot MCUBOOT_ESPDIR = $(MCUBOOT_SRCDIR)/boot/espressif MCUBOOT_TOOLCHAIN = $(TOPDIR)/tools/esp32/mcuboot_toolchain_esp32.cmake + ifndef MCUBOOT_VERSION MCUBOOT_VERSION = $(CONFIG_ESP32_MCUBOOT_VERSION) endif @@ -44,6 +45,10 @@ ifndef MCUBOOT_URL MCUBOOT_URL = https://github.com/mcu-tools/mcuboot endif +ifndef ESP_HAL_3RDPARTY_VERSION_FOR_MCUBOOT + ESP_HAL_3RDPARTY_VERSION_FOR_MCUBOOT = 3f02f2139e79ddc60f98ca35ed65c62c6914f079 +endif + # Helpers for creating the configuration file cfg_en = echo "$(1)=$(if $(CONFIG_ESP32_APP_FORMAT_MCUBOOT),1,y)"; @@ -131,13 +136,23 @@ else ifeq ($(CONFIG_ESP32_APP_FORMAT_MCUBOOT),y) BOOTLOADER_BIN = $(TOPDIR)/mcuboot-esp32.bin BOOTLOADER_SIGNED_BIN = $(TOPDIR)/mcuboot-esp32.signed.bin +define CLONE_ESP_HAL_3RDPARTY_REPO_MCUBOOT + $(call CLONE, $(ESP_HAL_3RDPARTY_URL),$(HALDIR)) +endef + $(MCUBOOT_SRCDIR): $(Q) echo "Cloning MCUboot" $(Q) git clone --quiet $(MCUBOOT_URL) $(MCUBOOT_SRCDIR) $(Q) git -C "$(MCUBOOT_SRCDIR)" checkout --quiet $(MCUBOOT_VERSION) $(Q) git -C "$(MCUBOOT_SRCDIR)" submodule --quiet update --init --recursive ext/mbedtls -$(BOOTLOADER_BIN): chip/$(ESP_HAL_3RDPARTY_REPO) $(MCUBOOT_SRCDIR) $(BOOTLOADER_CONFIG) +$(HALDIR): + $(Q) echo "Cloning Espressif HAL for 3rd Party Platforms (MCUBoot build)" + $(Q) $(call CLONE_ESP_HAL_3RDPARTY_REPO_MCUBOOT) + $(Q) echo "Espressif HAL for 3rd Party Platforms (MCUBoot build): ${ESP_HAL_3RDPARTY_VERSION_FOR_MCUBOOT}" + $(Q) git -C $(HALDIR) checkout --quiet $(ESP_HAL_3RDPARTY_VERSION_FOR_MCUBOOT) + +$(BOOTLOADER_BIN): $(HALDIR) $(MCUBOOT_SRCDIR) $(BOOTLOADER_CONFIG) $(Q) echo "Building Bootloader" $(Q) $(TOOLSDIR)/build_mcuboot.sh \ -c esp32 \ @@ -172,6 +187,7 @@ endif endif clean_bootloader: + $(call DELDIR,$(HALDIR)) $(call DELDIR,$(MCUBOOT_SRCDIR)) $(call DELDIR,$(BOOTLOADER_DIR)/$(BOOTLOADER_OUTDIR)) $(call DELFILE,$(BOOTLOADER_CONFIG)) @@ -191,6 +207,7 @@ bootloader: $(BOOTLOADER_SRCDIR) $(BOOTLOADER_CONFIG) $(call COPYFILE,$(BOOTLOADER_SRCDIR)/$(BOOTLOADER_OUTDIR)/partition-table-esp32.bin,$(TOPDIR)) clean_bootloader: + $(call DELDIR,$(HALDIR)) $(call DELDIR,$(BOOTLOADER_SRCDIR)) $(call DELFILE,$(BOOTLOADER_CONFIG)) $(call DELFILE,$(TOPDIR)/bootloader-esp32.bin) diff --git a/arch/xtensa/src/esp32s2/.gitignore b/arch/xtensa/src/esp32s2/.gitignore index 172cd927bd..d41668e07f 100644 --- a/arch/xtensa/src/esp32s2/.gitignore +++ b/arch/xtensa/src/esp32s2/.gitignore @@ -1,3 +1,4 @@ /bootloader /esp-hal-3rdparty +/esp-hal-3rdparty-mcuboot /esp-nuttx-bootloader diff --git a/arch/xtensa/src/esp32s2/Bootloader.mk b/arch/xtensa/src/esp32s2/Bootloader.mk index 34507d08dd..f0181a4030 100644 --- a/arch/xtensa/src/esp32s2/Bootloader.mk +++ b/arch/xtensa/src/esp32s2/Bootloader.mk @@ -22,9 +22,10 @@ ifeq ($(CONFIG_ESP32S2_APP_FORMAT_MCUBOOT),y) +ESP_HAL_3RDPARTY_REPO_FOR_MCUBOOT = esp-hal-3rdparty-mcuboot + TOOLSDIR = $(TOPDIR)/tools/espressif CHIPDIR = $(TOPDIR)/arch/xtensa/src/chip -HALDIR = $(CHIPDIR)/esp-hal-3rdparty BOOTLOADER_DIR = $(CHIPDIR)/bootloader BOOTLOADER_SRCDIR = $(BOOTLOADER_DIR)/esp-nuttx-bootloader @@ -32,10 +33,12 @@ BOOTLOADER_VERSION = main BOOTLOADER_URL = https://github.com/espressif/esp-nuttx-bootloader BOOTLOADER_OUTDIR = out BOOTLOADER_CONFIG = $(BOOTLOADER_DIR)/bootloader.conf +HALDIR = $(BOOTLOADER_DIR)/$(ESP_HAL_3RDPARTY_REPO_FOR_MCUBOOT) MCUBOOT_SRCDIR = $(BOOTLOADER_DIR)/mcuboot MCUBOOT_ESPDIR = $(MCUBOOT_SRCDIR)/boot/espressif MCUBOOT_TOOLCHAIN = $(TOPDIR)/tools/esp32s2/mcuboot_toolchain_esp32s2.cmake + ifndef MCUBOOT_VERSION MCUBOOT_VERSION = $(CONFIG_ESP32S2_MCUBOOT_VERSION) endif @@ -44,6 +47,10 @@ ifndef MCUBOOT_URL MCUBOOT_URL = https://github.com/mcu-tools/mcuboot endif +ifndef ESP_HAL_3RDPARTY_VERSION_FOR_MCUBOOT + ESP_HAL_3RDPARTY_VERSION_FOR_MCUBOOT = 3f02f2139e79ddc60f98ca35ed65c62c6914f079 +endif + $(BOOTLOADER_DIR): $(Q) mkdir -p $(BOOTLOADER_DIR) &>/dev/null @@ -124,13 +131,23 @@ else BOOTLOADER_BIN = $(TOPDIR)/mcuboot-esp32s2.bin BOOTLOADER_SIGNED_BIN = $(TOPDIR)/mcuboot-esp32s2.signed.bin +define CLONE_ESP_HAL_3RDPARTY_REPO_MCUBOOT + $(call CLONE, $(ESP_HAL_3RDPARTY_URL),$(HALDIR)) +endef + $(MCUBOOT_SRCDIR): $(BOOTLOADER_DIR) $(Q) echo "Cloning MCUboot" $(Q) git clone --quiet $(MCUBOOT_URL) $(MCUBOOT_SRCDIR) $(Q) git -C "$(MCUBOOT_SRCDIR)" checkout --quiet $(MCUBOOT_VERSION) $(Q) git -C "$(MCUBOOT_SRCDIR)" submodule --quiet update --init --recursive ext/mbedtls -$(BOOTLOADER_BIN): chip/$(ESP_HAL_3RDPARTY_REPO) $(MCUBOOT_SRCDIR) $(BOOTLOADER_CONFIG) +$(HALDIR): + $(Q) echo "Cloning Espressif HAL for 3rd Party Platforms (MCUBoot build)" + $(Q) $(call CLONE_ESP_HAL_3RDPARTY_REPO_MCUBOOT) + $(Q) echo "Espressif HAL for 3rd Party Platforms (MCUBoot build): ${ESP_HAL_3RDPARTY_VERSION_FOR_MCUBOOT}" + $(Q) git -C $(HALDIR) checkout --quiet $(ESP_HAL_3RDPARTY_VERSION_FOR_MCUBOOT) + +$(BOOTLOADER_BIN): $(HALDIR) $(MCUBOOT_SRCDIR) $(BOOTLOADER_CONFIG) $(Q) echo "Building Bootloader" $(Q) $(TOOLSDIR)/build_mcuboot.sh \ -c esp32s2 \ @@ -165,6 +182,7 @@ endif endif clean_bootloader: + $(call DELDIR,$(HALDIR)) $(call DELDIR,$(BOOTLOADER_DIR)) $(call DELFILE,$(BOOTLOADER_BIN)) $(if $(CONFIG_ESP32S2_SECURE_BOOT_BUILD_SIGNED_BINARIES),$(call DELFILE,$(BOOTLOADER_SIGNED_BIN))) diff --git a/arch/xtensa/src/esp32s3/.gitignore b/arch/xtensa/src/esp32s3/.gitignore index 172cd927bd..d41668e07f 100644 --- a/arch/xtensa/src/esp32s3/.gitignore +++ b/arch/xtensa/src/esp32s3/.gitignore @@ -1,3 +1,4 @@ /bootloader /esp-hal-3rdparty +/esp-hal-3rdparty-mcuboot /esp-nuttx-bootloader diff --git a/arch/xtensa/src/esp32s3/Bootloader.mk b/arch/xtensa/src/esp32s3/Bootloader.mk index 07f5c7e485..300450c3b9 100644 --- a/arch/xtensa/src/esp32s3/Bootloader.mk +++ b/arch/xtensa/src/esp32s3/Bootloader.mk @@ -24,7 +24,6 @@ ifeq ($(CONFIG_ESPRESSIF_SIMPLE_BOOT),) TOOLSDIR = $(TOPDIR)/tools/espressif CHIPDIR = $(TOPDIR)/arch/xtensa/src/chip -HALDIR = $(CHIPDIR)/esp-hal-3rdparty BOOTLOADER_DIR = $(CHIPDIR)/bootloader BOOTLOADER_SRCDIR = $(BOOTLOADER_DIR)/esp-nuttx-bootloader @@ -32,10 +31,12 @@ BOOTLOADER_VERSION = main BOOTLOADER_URL = https://github.com/espressif/esp-nuttx-bootloader BOOTLOADER_OUTDIR = out BOOTLOADER_CONFIG = $(BOOTLOADER_DIR)/bootloader.conf +HALDIR = $(BOOTLOADER_DIR)/esp-hal-3rdparty-mcuboot MCUBOOT_SRCDIR = $(BOOTLOADER_DIR)/mcuboot MCUBOOT_ESPDIR = $(MCUBOOT_SRCDIR)/boot/espressif MCUBOOT_TOOLCHAIN = $(TOPDIR)/tools/esp32s3/mcuboot_toolchain_esp32s3.cmake + ifndef MCUBOOT_VERSION MCUBOOT_VERSION = $(CONFIG_ESP32S3_MCUBOOT_VERSION) endif @@ -44,6 +45,10 @@ ifndef MCUBOOT_URL MCUBOOT_URL = https://github.com/mcu-tools/mcuboot endif +ifndef ESP_HAL_3RDPARTY_VERSION_FOR_MCUBOOT + ESP_HAL_3RDPARTY_VERSION_FOR_MCUBOOT = 3f02f2139e79ddc60f98ca35ed65c62c6914f079 +endif + $(BOOTLOADER_DIR): $(Q) mkdir -p $(BOOTLOADER_DIR) &>/dev/null @@ -101,13 +106,23 @@ else ifeq ($(CONFIG_ESP32S3_APP_FORMAT_MCUBOOT),y) BOOTLOADER_BIN = $(TOPDIR)/mcuboot-esp32s3.bin +define CLONE_ESP_HAL_3RDPARTY_REPO_MCUBOOT + $(call CLONE, $(ESP_HAL_3RDPARTY_URL),$(HALDIR)) +endef + $(MCUBOOT_SRCDIR): $(BOOTLOADER_DIR) $(Q) echo "Cloning MCUboot" $(Q) git clone --quiet $(MCUBOOT_URL) $(MCUBOOT_SRCDIR) $(Q) git -C "$(MCUBOOT_SRCDIR)" checkout --quiet $(MCUBOOT_VERSION) $(Q) git -C "$(MCUBOOT_SRCDIR)" submodule --quiet update --init --recursive ext/mbedtls -$(BOOTLOADER_BIN): chip/$(ESP_HAL_3RDPARTY_REPO) $(MCUBOOT_SRCDIR) $(BOOTLOADER_CONFIG) +$(HALDIR): + $(Q) echo "Cloning Espressif HAL for 3rd Party Platforms (MCUBoot build)" + $(Q) $(call CLONE_ESP_HAL_3RDPARTY_REPO_MCUBOOT) + $(Q) echo "Espressif HAL for 3rd Party Platforms (MCUBoot build): ${ESP_HAL_3RDPARTY_VERSION_FOR_MCUBOOT}" + $(Q) git -C $(HALDIR) checkout --quiet $(ESP_HAL_3RDPARTY_VERSION_FOR_MCUBOOT) + +$(BOOTLOADER_BIN): $(HALDIR) $(MCUBOOT_SRCDIR) $(BOOTLOADER_CONFIG) $(Q) echo "Building Bootloader" $(Q) $(TOOLSDIR)/build_mcuboot.sh \ -c esp32s3 \ @@ -120,6 +135,7 @@ $(BOOTLOADER_BIN): chip/$(ESP_HAL_3RDPARTY_REPO) $(MCUBOOT_SRCDIR) $(BOOTLOADER_ bootloader: $(BOOTLOADER_CONFIG) $(BOOTLOADER_BIN) clean_bootloader: + $(call DELDIR,$(HALDIR)) $(call DELDIR,$(BOOTLOADER_DIR)) $(call DELFILE,$(BOOTLOADER_BIN)) @@ -135,6 +151,7 @@ bootloader: $(BOOTLOADER_SRCDIR) $(BOOTLOADER_CONFIG) $(call COPYFILE,$(BOOTLOADER_SRCDIR)/$(BOOTLOADER_OUTDIR)/partition-table-esp32s3.bin,$(TOPDIR)) clean_bootloader: + $(call DELDIR,$(HALDIR)) $(call DELDIR,$(BOOTLOADER_DIR)) $(call DELFILE,$(TOPDIR)/bootloader-esp32s3.bin) $(call DELFILE,$(TOPDIR)/partition-table-esp32s3.bin)