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 075addd8404ee1bbd3a22db2c51bfff21c844cae
Author: Filipe Cavalcanti <[email protected]>
AuthorDate: Thu Jun 12 17:20:59 2025 -0300

    arch/risc-v: decouple common source for Espressif's MCUBoot port
    
    Decouples the NuttX build from the MCUBoot common source on RISC-V Espressif
    devices. Allows using different branches for each.
    
    Signed-off-by: Filipe Cavalcanti <[email protected]>
---
 arch/risc-v/src/common/espressif/.gitignore    |  1 +
 arch/risc-v/src/common/espressif/Bootloader.mk | 20 ++++++++++++++++++--
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/arch/risc-v/src/common/espressif/.gitignore 
b/arch/risc-v/src/common/espressif/.gitignore
index d40b86f3a0..b963da3786 100644
--- a/arch/risc-v/src/common/espressif/.gitignore
+++ b/arch/risc-v/src/common/espressif/.gitignore
@@ -2,3 +2,4 @@
 /esp-nuttx-bootloader
 /*.zip
 /esp-hal-3rdparty
+/esp-hal-3rdparty-mcuboot
diff --git a/arch/risc-v/src/common/espressif/Bootloader.mk 
b/arch/risc-v/src/common/espressif/Bootloader.mk
index 46eee4f9e0..1939f6aea5 100644
--- a/arch/risc-v/src/common/espressif/Bootloader.mk
+++ b/arch/risc-v/src/common/espressif/Bootloader.mk
@@ -26,7 +26,6 @@ CHIP_SERIES = $(patsubst 
"%",%,$(CONFIG_ESPRESSIF_CHIP_SERIES))
 
 TOOLSDIR             = $(TOPDIR)/tools/espressif
 CHIPDIR              = $(TOPDIR)/arch/risc-v/src/chip
-HALDIR               = $(CHIPDIR)/esp-hal-3rdparty
 BOOTLOADER_SRCDIR    = $(CHIPDIR)/bootloader
 BOOTLOADER_OUTDIR    = $(BOOTLOADER_SRCDIR)/out
 BOOTLOADER_CONFIG    = $(BOOTLOADER_SRCDIR)/bootloader.conf
@@ -36,6 +35,8 @@ BOOTLOADER_CONFIG    = $(BOOTLOADER_SRCDIR)/bootloader.conf
 MCUBOOT_SRCDIR     = $(BOOTLOADER_SRCDIR)/mcuboot
 MCUBOOT_ESPDIR     = $(MCUBOOT_SRCDIR)/boot/espressif
 MCUBOOT_TOOLCHAIN  = $(TOOLSDIR)/mcuboot_toolchain_espressif.cmake
+HALDIR             = $(BOOTLOADER_SRCDIR)/esp-hal-3rdparty-mcuboot
+
 ifndef MCUBOOT_VERSION
        MCUBOOT_VERSION = $(CONFIG_ESPRESSIF_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_ESPRESSIF_BOOTLOADER_MCUBOOT),1,y)";
@@ -95,13 +100,23 @@ ifeq ($(CONFIG_ESPRESSIF_BOOTLOADER_MCUBOOT),y)
 
 BOOTLOADER_BIN = $(TOPDIR)/mcuboot-$(CHIP_SERIES).bin
 
+define CLONE_ESP_HAL_3RDPARTY_REPO_MCUBOOT
+       $(call CLONE, $(ESP_HAL_3RDPARTY_URL),$(HALDIR))
+endef
+
 $(MCUBOOT_SRCDIR): $(BOOTLOADER_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 MCUboot"
        $(Q) $(TOOLSDIR)/build_mcuboot.sh \
                -c $(CHIP_SERIES) \
@@ -114,6 +129,7 @@ $(BOOTLOADER_BIN): chip/$(ESP_HAL_3RDPARTY_REPO) 
$(MCUBOOT_SRCDIR) $(BOOTLOADER_
 bootloader: $(BOOTLOADER_CONFIG) $(BOOTLOADER_BIN)
 
 clean_bootloader:
+       $(call DELDIR,$(HALDIR))
        $(call DELDIR,$(BOOTLOADER_SRCDIR))
        $(call DELFILE,$(BOOTLOADER_BIN))
 endif

Reply via email to