This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new a221df7175a arch/xtensa/esp32[-s2|-s3]: add 
USE_NXTMPDIR_ESP_REPO_DIRECTLY
a221df7175a is described below

commit a221df7175a048030b94e11770421023abfb87b8
Author: v-tangmeng <[email protected]>
AuthorDate: Thu Oct 23 13:20:25 2025 +0800

    arch/xtensa/esp32[-s2|-s3]: add USE_NXTMPDIR_ESP_REPO_DIRECTLY
    
    Directly downloading the Git repository is inconvenient for local debugging.
    This will allow to automatically download external packages from the 
Internet.
    If not set, the repo need to be download will need to provide them manually,
    otherwise an error will occur and the build will be aborted.
    
    Add `USE_NXTMPDIR_ESP_REPO_DIRECTLY`, with this we can use
    `USE_NXTMPDIR_ESP_REPO_DIRECTLY=y make` which can directly use 
esp-hal-3rdparty
    under nxtmpdir without CLONE, CHECK_COMMITSHA, reset, checkout and update. 
Just
    `cp -rf nxtmpdir/esp-hal-3rdparty chip/$(ESP_HAL_3RDPARTY_REPO)`.
    
    Signed-off-by: v-tangmeng <[email protected]>
---
 arch/risc-v/src/common/espressif/Make.defs | 15 +++++++++++++++
 arch/risc-v/src/esp32c3-legacy/Make.defs   | 13 +++++++++++++
 arch/xtensa/src/esp32/Make.defs            | 17 +++++++++++++++++
 arch/xtensa/src/esp32s2/Make.defs          | 17 +++++++++++++++++
 arch/xtensa/src/esp32s3/Make.defs          | 17 +++++++++++++++++
 5 files changed, 79 insertions(+)

diff --git a/arch/risc-v/src/common/espressif/Make.defs 
b/arch/risc-v/src/common/espressif/Make.defs
index d5e8ab12bcc..d0d64968f87 100644
--- a/arch/risc-v/src/common/espressif/Make.defs
+++ b/arch/risc-v/src/common/espressif/Make.defs
@@ -212,11 +212,22 @@ endif
        GIT_DEPTH_PARAMETER = --depth=$(GIT_DEPTH)
 endif
 
+# When set USE_NXTMPDIR_ESP_REPO_DIRECTLY=y, will directly use esp-hal-3rdparty
+# under nxtmpdir without CHECK_COMMITSHA, reset, checkout and update.
+
+USE_NXTMPDIR_ESP_REPO_DIRECTLY ?= n
+
 ifeq ($(STORAGETMP),y)
+ifeq ($(USE_NXTMPDIR_ESP_REPO_DIRECTLY),y)
+define CLONE_ESP_HAL_3RDPARTY_REPO
+       $(call COPYDIR, 
$(NXTMPDIR)/$(ESP_HAL_3RDPARTY_REPO),chip/$(ESP_HAL_3RDPARTY_REPO))
+endef
+else
 define CLONE_ESP_HAL_3RDPARTY_REPO
        $(call CHECK_COMMITSHA, 
$(NXTMPDIR)/$(ESP_HAL_3RDPARTY_REPO),$(ESP_HAL_3RDPARTY_VERSION))
        $(call CLONE, 
$(ESP_HAL_3RDPARTY_URL),chip/$(ESP_HAL_3RDPARTY_REPO),$(NXTMPDIR)/$(ESP_HAL_3RDPARTY_REPO))
 endef
+endif
 else
 define CLONE_ESP_HAL_3RDPARTY_REPO
        $(call CLONE, $(ESP_HAL_3RDPARTY_URL),chip/$(ESP_HAL_3RDPARTY_REPO))
@@ -226,13 +237,17 @@ endif
 chip/$(ESP_HAL_3RDPARTY_REPO):
        $(Q) echo "Cloning Espressif HAL for 3rd Party Platforms"
        $(Q) $(call CLONE_ESP_HAL_3RDPARTY_REPO)
+ifneq ($(USE_NXTMPDIR_ESP_REPO_DIRECTLY),y)
        $(Q) echo "Espressif HAL for 3rd Party Platforms: 
${ESP_HAL_3RDPARTY_VERSION}"
        $(Q) git -C chip/$(ESP_HAL_3RDPARTY_REPO) checkout --quiet 
$(ESP_HAL_3RDPARTY_VERSION)
        $(Q) git -C chip/$(ESP_HAL_3RDPARTY_REPO) submodule --quiet update 
--init $(GIT_DEPTH_PARAMETER) components/mbedtls/mbedtls
+endif
 ifeq ($(CONFIG_ESP_WIRELESS),y)
+ifneq ($(USE_NXTMPDIR_ESP_REPO_DIRECTLY),y)
        $(Q) echo "Espressif HAL for 3rd Party Platforms: initializing 
submodules..."
        $(Q) git -C chip/$(ESP_HAL_3RDPARTY_REPO) submodule --quiet update 
--init $(GIT_DEPTH_PARAMETER) components/esp_phy/lib components/esp_wifi/lib 
components/bt/controller/lib_esp32c3_family components/esp_coex/lib
        $(Q) git -C chip/$(ESP_HAL_3RDPARTY_REPO)/components/mbedtls/mbedtls 
reset --quiet --hard
+endif
        $(Q) echo "Applying patches..."
        $(Q) cd chip/$(ESP_HAL_3RDPARTY_REPO)/components/mbedtls/mbedtls && git 
apply ../../../nuttx/patches/components/mbedtls/mbedtls/*.patch
 endif
diff --git a/arch/risc-v/src/esp32c3-legacy/Make.defs 
b/arch/risc-v/src/esp32c3-legacy/Make.defs
index 86f37c92762..195efc1eb4a 100644
--- a/arch/risc-v/src/esp32c3-legacy/Make.defs
+++ b/arch/risc-v/src/esp32c3-legacy/Make.defs
@@ -248,11 +248,22 @@ ifndef ESP_HAL_3RDPARTY_URL
        ESP_HAL_3RDPARTY_URL    = 
https://github.com/espressif/esp-hal-3rdparty.git
 endif
 
+# When set USE_NXTMPDIR_ESP_REPO_DIRECTLY=y, will directly use esp-hal-3rdparty
+# under nxtmpdir without CHECK_COMMITSHA, reset, checkout and update.
+
+USE_NXTMPDIR_ESP_REPO_DIRECTLY ?= n
+
 ifeq ($(STORAGETMP),y)
+ifeq ($(USE_NXTMPDIR_ESP_REPO_DIRECTLY),y)
+define CLONE_ESP_HAL_3RDPARTY_REPO
+       $(call COPYDIR, 
$(NXTMPDIR)/$(ESP_HAL_3RDPARTY_REPO),chip/$(ESP_HAL_3RDPARTY_REPO))
+endef
+else
 define CLONE_ESP_HAL_3RDPARTY_REPO
        $(call CHECK_COMMITSHA, 
$(NXTMPDIR)/$(ESP_HAL_3RDPARTY_REPO),$(ESP_HAL_3RDPARTY_VERSION))
        $(call CLONE, 
$(ESP_HAL_3RDPARTY_URL),chip/$(ESP_HAL_3RDPARTY_REPO),$(NXTMPDIR)/$(ESP_HAL_3RDPARTY_REPO))
 endef
+endif
 else
 define CLONE_ESP_HAL_3RDPARTY_REPO
        $(call CLONE, $(ESP_HAL_3RDPARTY_URL),chip/$(ESP_HAL_3RDPARTY_REPO))
@@ -262,8 +273,10 @@ endif
 chip/$(ESP_HAL_3RDPARTY_REPO):
        $(Q) echo "Cloning Espressif HAL for 3rd Party Platforms"
        $(Q) $(call CLONE_ESP_HAL_3RDPARTY_REPO)
+ifneq ($(USE_NXTMPDIR_ESP_REPO_DIRECTLY),y)
        $(Q) echo "Espressif HAL for 3rd Party Platforms: 
${ESP_HAL_3RDPARTY_VERSION}"
        $(Q) git -C chip/$(ESP_HAL_3RDPARTY_REPO) checkout --quiet 
$(ESP_HAL_3RDPARTY_VERSION)
+endif
 
 # Silent preprocessor warnings
 
diff --git a/arch/xtensa/src/esp32/Make.defs b/arch/xtensa/src/esp32/Make.defs
index 7c4c764451b..766c9adf618 100644
--- a/arch/xtensa/src/esp32/Make.defs
+++ b/arch/xtensa/src/esp32/Make.defs
@@ -226,11 +226,22 @@ endif
        GIT_DEPTH_PARAMETER = --depth=$(GIT_DEPTH)
 endif
 
+# When set USE_NXTMPDIR_ESP_REPO_DIRECTLY=y, will directly use esp-hal-3rdparty
+# under nxtmpdir without CHECK_COMMITSHA, reset, checkout and update.
+
+USE_NXTMPDIR_ESP_REPO_DIRECTLY ?= n
+
 ifeq ($(STORAGETMP),y)
+ifeq ($(USE_NXTMPDIR_ESP_REPO_DIRECTLY),y)
+define CLONE_ESP_HAL_3RDPARTY_REPO
+       $(call COPYDIR, 
$(NXTMPDIR)/$(ESP_HAL_3RDPARTY_REPO),chip/$(ESP_HAL_3RDPARTY_REPO))
+endef
+else
 define CLONE_ESP_HAL_3RDPARTY_REPO
        $(call CHECK_COMMITSHA, 
$(NXTMPDIR)/$(ESP_HAL_3RDPARTY_REPO),$(ESP_HAL_3RDPARTY_VERSION))
        $(call CLONE, 
$(ESP_HAL_3RDPARTY_URL),chip/$(ESP_HAL_3RDPARTY_REPO),$(NXTMPDIR)/$(ESP_HAL_3RDPARTY_REPO))
 endef
+endif
 else
 define CLONE_ESP_HAL_3RDPARTY_REPO
        $(call CLONE, $(ESP_HAL_3RDPARTY_URL),chip/$(ESP_HAL_3RDPARTY_REPO))
@@ -240,8 +251,10 @@ endif
 chip/$(ESP_HAL_3RDPARTY_REPO):
        $(Q) echo "Cloning Espressif HAL for 3rd Party Platforms"
        $(Q) $(call CLONE_ESP_HAL_3RDPARTY_REPO)
+ifneq ($(USE_NXTMPDIR_ESP_REPO_DIRECTLY),y)
        $(Q) echo "Espressif HAL for 3rd Party Platforms: 
${ESP_HAL_3RDPARTY_VERSION}"
        $(Q) git -C chip/$(ESP_HAL_3RDPARTY_REPO) checkout --quiet 
$(ESP_HAL_3RDPARTY_VERSION)
+endif
 
 # Silent preprocessor warnings
 
@@ -262,14 +275,18 @@ include chip/hal.mk
 include common/espressif/Make.defs
 
 context:: chip/$(ESP_HAL_3RDPARTY_REPO)
+ifneq ($(USE_NXTMPDIR_ESP_REPO_DIRECTLY),y)
        $(Q) echo "Espressif HAL for 3rd Party Platforms: initializing 
submodules..."
        $(Q) git -C chip/$(ESP_HAL_3RDPARTY_REPO) submodule --quiet update 
--init $(GIT_DEPTH_PARAMETER) components/mbedtls/mbedtls components/esp_phy/lib 
components/esp_wifi/lib components/bt/controller/lib_esp32 
components/esp_coex/lib
        $(Q) git -C chip/$(ESP_HAL_3RDPARTY_REPO)/components/mbedtls/mbedtls 
reset --quiet --hard
+endif
        $(Q) echo "Applying patches..."
        $(Q) cd chip/$(ESP_HAL_3RDPARTY_REPO)/components/mbedtls/mbedtls && git 
apply ../../../nuttx/patches/components/mbedtls/mbedtls/*.patch
 ifeq ($(CONFIG_ESPRESSIF_WIRELESS),y)
+ifneq ($(USE_NXTMPDIR_ESP_REPO_DIRECTLY),y)
        $(Q) git -C chip/$(ESP_HAL_3RDPARTY_REPO) submodule --quiet update 
--init $(GIT_DEPTH_PARAMETER) components/esp_phy/lib components/esp_wifi/lib 
components/bt/controller/lib_esp32 components/esp_coex/lib
 endif
+endif
 
 distclean::
        $(call DELDIR,chip/$(ESP_HAL_3RDPARTY_REPO))
diff --git a/arch/xtensa/src/esp32s2/Make.defs 
b/arch/xtensa/src/esp32s2/Make.defs
index e9f0d693b4a..42598df39ae 100644
--- a/arch/xtensa/src/esp32s2/Make.defs
+++ b/arch/xtensa/src/esp32s2/Make.defs
@@ -140,11 +140,22 @@ ifndef ESP_HAL_3RDPARTY_URL
        ESP_HAL_3RDPARTY_URL = https://github.com/espressif/esp-hal-3rdparty.git
 endif
 
+# When set USE_NXTMPDIR_ESP_REPO_DIRECTLY=y, will directly use esp-hal-3rdparty
+# under nxtmpdir without CHECK_COMMITSHA, reset, checkout and update.
+
+USE_NXTMPDIR_ESP_REPO_DIRECTLY ?= n
+
 ifeq ($(STORAGETMP),y)
+ifeq ($(USE_NXTMPDIR_ESP_REPO_DIRECTLY),y)
+define CLONE_ESP_HAL_3RDPARTY_REPO
+       $(call COPYDIR, 
$(NXTMPDIR)/$(ESP_HAL_3RDPARTY_REPO),chip/$(ESP_HAL_3RDPARTY_REPO))
+endef
+else
 define CLONE_ESP_HAL_3RDPARTY_REPO
        $(call CHECK_COMMITSHA, 
$(NXTMPDIR)/$(ESP_HAL_3RDPARTY_REPO),$(ESP_HAL_3RDPARTY_VERSION))
        $(call CLONE, 
$(ESP_HAL_3RDPARTY_URL),chip/$(ESP_HAL_3RDPARTY_REPO),$(NXTMPDIR)/$(ESP_HAL_3RDPARTY_REPO))
 endef
+endif
 else
 define CLONE_ESP_HAL_3RDPARTY_REPO
        $(call CLONE, $(ESP_HAL_3RDPARTY_URL),chip/$(ESP_HAL_3RDPARTY_REPO))
@@ -154,8 +165,10 @@ endif
 chip/$(ESP_HAL_3RDPARTY_REPO):
        $(Q) echo "Cloning Espressif HAL for 3rd Party Platforms"
        $(Q) $(call CLONE_ESP_HAL_3RDPARTY_REPO)
+ifneq ($(USE_NXTMPDIR_ESP_REPO_DIRECTLY),y)
        $(Q) echo "Espressif HAL for 3rd Party Platforms: 
${ESP_HAL_3RDPARTY_VERSION}"
        $(Q) git -C chip/$(ESP_HAL_3RDPARTY_REPO) checkout --quiet 
$(ESP_HAL_3RDPARTY_VERSION)
+endif
 
 # Silent preprocessor warnings
 
@@ -174,14 +187,18 @@ include common/espressif/Make.defs
 include chip/Bootloader.mk
 
 context:: chip/$(ESP_HAL_3RDPARTY_REPO)
+ifneq ($(USE_NXTMPDIR_ESP_REPO_DIRECTLY),y)
        $(Q) echo "Espressif HAL for 3rd Party Platforms: initializing 
submodules..."
        $(Q) git -C chip/$(ESP_HAL_3RDPARTY_REPO) submodule --quiet update 
--init $(GIT_DEPTH_PARAMETER) components/mbedtls/mbedtls
        $(Q) git -C chip/$(ESP_HAL_3RDPARTY_REPO)/components/mbedtls/mbedtls 
reset --quiet --hard
+endif
        $(Q) echo "Applying patches..."
        $(Q) cd chip/$(ESP_HAL_3RDPARTY_REPO)/components/mbedtls/mbedtls && git 
apply ../../../nuttx/patches/components/mbedtls/mbedtls/*.patch
 ifeq ($(CONFIG_ESPRESSIF_WIRELESS),y)
+ifneq ($(USE_NXTMPDIR_ESP_REPO_DIRECTLY),y)
        $(Q) git -C chip/$(ESP_HAL_3RDPARTY_REPO) submodule --quiet update 
--init $(GIT_DEPTH_PARAMETER) components/esp_phy/lib components/esp_wifi/lib
 endif
+endif
 
 distclean::
        $(call DELDIR,chip/$(ESP_HAL_3RDPARTY_REPO))
diff --git a/arch/xtensa/src/esp32s3/Make.defs 
b/arch/xtensa/src/esp32s3/Make.defs
index 5744f182d63..a131596cb52 100644
--- a/arch/xtensa/src/esp32s3/Make.defs
+++ b/arch/xtensa/src/esp32s3/Make.defs
@@ -223,11 +223,22 @@ endif
        GIT_DEPTH_PARAMETER = --depth=$(GIT_DEPTH)
 endif
 
+# When set USE_NXTMPDIR_ESP_REPO_DIRECTLY=y, will directly use esp-hal-3rdparty
+# under nxtmpdir without CHECK_COMMITSHA, reset, checkout and update.
+
+USE_NXTMPDIR_ESP_REPO_DIRECTLY ?= n
+
 ifeq ($(STORAGETMP),y)
+ifeq ($(USE_NXTMPDIR_ESP_REPO_DIRECTLY),y)
+define CLONE_ESP_HAL_3RDPARTY_REPO
+       $(call COPYDIR, 
$(NXTMPDIR)/$(ESP_HAL_3RDPARTY_REPO),chip/$(ESP_HAL_3RDPARTY_REPO))
+endef
+else
 define CLONE_ESP_HAL_3RDPARTY_REPO
        $(call CHECK_COMMITSHA, 
$(NXTMPDIR)/$(ESP_HAL_3RDPARTY_REPO),$(ESP_HAL_3RDPARTY_VERSION))
        $(call CLONE, 
$(ESP_HAL_3RDPARTY_URL),chip/$(ESP_HAL_3RDPARTY_REPO),$(NXTMPDIR)/$(ESP_HAL_3RDPARTY_REPO))
 endef
+endif
 else
 define CLONE_ESP_HAL_3RDPARTY_REPO
        $(call CLONE, $(ESP_HAL_3RDPARTY_URL),chip/$(ESP_HAL_3RDPARTY_REPO))
@@ -237,8 +248,10 @@ endif
 chip/$(ESP_HAL_3RDPARTY_REPO):
        $(Q) echo "Cloning Espressif HAL for 3rd Party Platforms"
        $(Q) $(call CLONE_ESP_HAL_3RDPARTY_REPO)
+ifneq ($(USE_NXTMPDIR_ESP_REPO_DIRECTLY),y)
        $(Q) echo "Espressif HAL for 3rd Party Platforms: 
${ESP_HAL_3RDPARTY_VERSION}"
        $(Q) git -C chip/$(ESP_HAL_3RDPARTY_REPO) checkout --quiet 
$(ESP_HAL_3RDPARTY_VERSION)
+endif
 
 # Silent preprocessor warnings
 
@@ -262,14 +275,18 @@ include chip/hal.mk
 include common/espressif/Make.defs
 
 context:: chip/$(ESP_HAL_3RDPARTY_REPO)
+ifneq ($(USE_NXTMPDIR_ESP_REPO_DIRECTLY),y)
        $(Q) echo "Espressif HAL for 3rd Party Platforms: initializing 
submodules..."
        $(Q) git -C chip/$(ESP_HAL_3RDPARTY_REPO) submodule --quiet update 
--init $(GIT_DEPTH_PARAMETER) components/mbedtls/mbedtls
        $(Q) git -C chip/$(ESP_HAL_3RDPARTY_REPO)/components/mbedtls/mbedtls 
reset --quiet --hard
+endif
        $(Q) echo "Applying patches..."
        $(Q) cd chip/$(ESP_HAL_3RDPARTY_REPO)/components/mbedtls/mbedtls && git 
apply ../../../nuttx/patches/components/mbedtls/mbedtls/*.patch
 ifeq ($(CONFIG_ESPRESSIF_WIRELESS),y)
+ifneq ($(USE_NXTMPDIR_ESP_REPO_DIRECTLY),y)
        $(Q) git -C chip/$(ESP_HAL_3RDPARTY_REPO) submodule --quiet update 
--init $(GIT_DEPTH_PARAMETER) components/esp_phy/lib components/esp_wifi/lib 
components/bt/controller/lib_esp32c3_family components/esp_coex/lib
 endif
+endif
 
 distclean::
        $(call DELDIR,chip/$(ESP_HAL_3RDPARTY_REPO))

Reply via email to