TangMeng12 commented on code in PR #17236: URL: https://github.com/apache/nuttx/pull/17236#discussion_r2501933401
########## arch/risc-v/src/common/espressif/Make.defs: ########## @@ -199,41 +199,177 @@ ifndef ESP_HAL_3RDPARTY_VERSION endif ifndef ESP_HAL_3RDPARTY_URL - ESP_HAL_3RDPARTY_URL = https://github.com/espressif/esp-hal-3rdparty.git + ESP_HAL_3RDPARTY_URL = https://github.com/espressif/esp-hal-3rdparty/archive endif -ifndef DISABLE_GIT_DEPTH -ifndef GIT_DEPTH - GIT_DEPTH=1 +ESP_HAL_3RDPARTY_ZIP = $(ESP_HAL_3RDPARTY_VERSION).zip + +ifeq ($(STORAGETMP),y) +define DOWNLOAD_ESP_HAL_3RDPARTY_REPO + $(call DOWNLOAD,$(ESP_HAL_3RDPARTY_URL),$(ESP_HAL_3RDPARTY_ZIP),chip/$(ESP_HAL_3RDPARTY_ZIP),$(NXTMPDIR)/$(ESP_HAL_3RDPARTY_ZIP)) +endef +else +define DOWNLOAD_ESP_HAL_3RDPARTY_REPO + $(call DOWNLOAD,$(ESP_HAL_3RDPARTY_URL),$(ESP_HAL_3RDPARTY_ZIP),chip/$(ESP_HAL_3RDPARTY_ZIP)) +endef endif - GIT_DEPTH_PARAMETER = --depth=$(GIT_DEPTH) + +$(ESP_HAL_3RDPARTY_ZIP): + $(Q) $(call DOWNLOAD_ESP_HAL_3RDPARTY_REPO) + +chip/$(ESP_HAL_3RDPARTY_REPO): $(ESP_HAL_3RDPARTY_ZIP) + $(Q) echo "Unpacking: Espressif HAL for 3rd Party Platforms" + $(Q) unzip -oqq chip/$(ESP_HAL_3RDPARTY_ZIP) -d chip/ + $(Q) mv chip/$(ESP_HAL_3RDPARTY_REPO)-$(ESP_HAL_3RDPARTY_VERSION) chip/$(ESP_HAL_3RDPARTY_REPO) + +ESP_COMPONENTS_MBEDTLS_UNPACK = mbedtls +ifndef ESP_COMPONENTS_MBEDTLS_VERSION + ESP_COMPONENTS_MBEDTLS_VERSION = mbedtls-3.6.3-idf +endif + +ifndef ESP_COMPONENTS_MBEDTLS_URL + ESP_COMPONENTS_MBEDTLS_URL = https://github.com/espressif/mbedtls/archive endif +ESP_COMPONENTS_MBEDTLS_ZIP = $(ESP_COMPONENTS_MBEDTLS_VERSION).zip + ifeq ($(STORAGETMP),y) -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)) +define DOWNLOAD_ESP_COMPONENTS_MBEDTLS_UNPACK + $(call DOWNLOAD,$(ESP_COMPONENTS_MBEDTLS_URL),$(ESP_COMPONENTS_MBEDTLS_ZIP),chip/$(ESP_COMPONENTS_MBEDTLS_ZIP),$(NXTMPDIR)/$(ESP_COMPONENTS_MBEDTLS_ZIP)) endef else -define CLONE_ESP_HAL_3RDPARTY_REPO - $(call CLONE, $(ESP_HAL_3RDPARTY_URL),chip/$(ESP_HAL_3RDPARTY_REPO)) +define DOWNLOAD_ESP_COMPONENTS_MBEDTLS_UNPACK + $(call DOWNLOAD,$(ESP_COMPONENTS_MBEDTLS_URL),$(ESP_COMPONENTS_MBEDTLS_ZIP),chip/$(ESP_COMPONENTS_MBEDTLS_ZIP)) endef endif -chip/$(ESP_HAL_3RDPARTY_REPO): - $(Q) echo "Cloning Espressif HAL for 3rd Party Platforms" - $(Q) $(call CLONE_ESP_HAL_3RDPARTY_REPO) - $(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 -ifeq ($(CONFIG_ESP_WIRELESS),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 +$(ESP_COMPONENTS_MBEDTLS_ZIP): + $(call DOWNLOAD_ESP_COMPONENTS_MBEDTLS_UNPACK) + +chip/$(ESP_COMPONENTS_MBEDTLS_UNPACK): $(ESP_COMPONENTS_MBEDTLS_ZIP) chip/$(ESP_HAL_3RDPARTY_REPO) + $(Q) unzip -oqq chip/$(ESP_COMPONENTS_MBEDTLS_ZIP) -d chip/ + $(Q) rm -fr chip/$(ESP_HAL_3RDPARTY_REPO)/components/mbedtls/mbedtls + $(Q) mv chip/$(ESP_COMPONENTS_MBEDTLS_UNPACK)-$(ESP_COMPONENTS_MBEDTLS_VERSION) chip/$(ESP_HAL_3RDPARTY_REPO)/components/mbedtls/mbedtls $(Q) echo "Applying patches..." - $(Q) cd chip/$(ESP_HAL_3RDPARTY_REPO)/components/mbedtls/mbedtls && git apply ../../../nuttx/patches/components/mbedtls/mbedtls/*.patch + $(Q) cd chip/$(ESP_HAL_3RDPARTY_REPO)/components/mbedtls/mbedtls && patch -p1 < ../../../nuttx/patches/components/mbedtls/mbedtls/0001-mbedtls_add_prefix.patch + $(Q) cd chip/$(ESP_HAL_3RDPARTY_REPO)/components/mbedtls/mbedtls && patch -p1 < ../../../nuttx/patches/components/mbedtls/mbedtls/0002-mbedtls_add_prefix_to_macro.patch + +ESP_COMPONENTS_ESP_PHY_LIB_UNPACK = esp-phy-lib +ifndef ESP_COMPONENTS_ESP_PHY_LIB_VERSION Review Comment: Is it possible to introduce a `USE_NXTMPDIR_ESP_REPO_DIRECTLY` macro? If we set `USE_NXTMPDIR_ESP_REPO_DIRECTLY = yes`, then we directly use the prepared `esp-hal-3rdparty` under nxtmpdir. For example: `diff --git a/arch/risc-v/src/common/espressif/Make.defs b/arch/risc-v/src/common/espressif/Make.defs index 6021697719..df0cbbeb18 100644 --- a/arch/risc-v/src/common/espressif/Make.defs +++ b/arch/risc-v/src/common/espressif/Make.defs @@ -211,7 +211,9 @@ endif ifeq ($(STORAGETMP),y) define CLONE_ESP_HAL_3RDPARTY_REPO +ifndef USE_NXTMPDIR_ESP_REPO_DIRECTLY $(call CHECK_COMMITSHA, $(NXTMPDIR)/$(ESP_HAL_3RDPARTY_REPO),$(ESP_HAL_3RDPARTY_VERSION)) +endif $(call CLONE, $(ESP_HAL_3RDPARTY_URL),chip/$(ESP_HAL_3RDPARTY_REPO),$(NXTMPDIR)/$(ESP_HAL_3RDPARTY_REPO)) endef else @@ -223,13 +225,17 @@ endif chip/$(ESP_HAL_3RDPARTY_REPO): $(Q) echo "Cloning Espressif HAL for 3rd Party Platforms" $(Q) $(call CLONE_ESP_HAL_3RDPARTY_REPO) +ifndef USE_NXTMPDIR_ESP_REPO_DIRECTLY $(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) +ifndef USE_NXTMPDIR_ESP_REPO_DIRECTLY $(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` With this we can use `USE_NXTMPDIR_ESP_REPO_DIRECTLY=yes make` which can directly using `esp-hal-3rdparty` under nxtmpdir without reset, checkout and update. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
