Skip to content

Commit 9e457f2

Browse files
committed
arch/xtensa/esp32[-s2|-s3]: Modify the method of downloading the repository
Directly downloading the Git repository is inconvenient for local debugging. Change it to the same approach as other components, that is downloading the compressed package. Also, add handling for cases where the Git repository has already been downloaded. Signed-off-by: v-tangmeng <[email protected]>
1 parent be413af commit 9e457f2

File tree

5 files changed

+397
-116
lines changed

5 files changed

+397
-116
lines changed

arch/risc-v/src/common/espressif/Make.defs

Lines changed: 102 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -199,41 +199,99 @@ ifndef ESP_HAL_3RDPARTY_VERSION
199199
endif
200200

201201
ifndef ESP_HAL_3RDPARTY_URL
202-
ESP_HAL_3RDPARTY_URL = https://github.com/espressif/esp-hal-3rdparty.git
202+
ESP_HAL_3RDPARTY_URL = https://github.com/espressif/esp-hal-3rdparty
203203
endif
204204

205-
ifndef DISABLE_GIT_DEPTH
206-
ifndef GIT_DEPTH
207-
GIT_DEPTH=1
205+
ESP_COMPONENTS_MBEDTLS_REPO = mbedtls
206+
ifndef ESP_COMPONENTS_MBEDTLS_VERSION
207+
ESP_COMPONENTS_MBEDTLS_VERSION = mbedtls-3.6.4-idf
208208
endif
209-
GIT_DEPTH_PARAMETER = --depth=$(GIT_DEPTH)
209+
210+
ifndef ESP_COMPONENTS_MBEDTLS_URL
211+
ESP_COMPONENTS_MBEDTLS_URL = https://github.com/espressif/mbedtls
210212
endif
211213

212-
ifeq ($(STORAGETMP),y)
213-
define CLONE_ESP_HAL_3RDPARTY_REPO
214-
$(call CHECK_COMMITSHA, $(NXTMPDIR)/$(ESP_HAL_3RDPARTY_REPO),$(ESP_HAL_3RDPARTY_VERSION))
215-
$(call CLONE, $(ESP_HAL_3RDPARTY_URL),chip/$(ESP_HAL_3RDPARTY_REPO),$(NXTMPDIR)/$(ESP_HAL_3RDPARTY_REPO))
216-
endef
217-
else
218-
define CLONE_ESP_HAL_3RDPARTY_REPO
219-
$(call CLONE, $(ESP_HAL_3RDPARTY_URL),chip/$(ESP_HAL_3RDPARTY_REPO))
220-
endef
214+
ESP_COMPONENTS_ESP_PHY_LIB_REPO = esp-phy-lib
215+
ifndef ESP_COMPONENTS_ESP_PHY_LIB_VERSION
216+
ESP_COMPONENTS_ESP_PHY_LIB_VERSION = master
217+
endif
218+
219+
ifndef ESP_COMPONENTS_ESP_PHY_LIB_URL
220+
ESP_COMPONENTS_ESP_PHY_LIB_URL = https://github.com/espressif/esp-phy-lib
221+
endif
222+
223+
ESP_COMPONENTS_ESP_WIFI_LIB_REPO = esp-wifi-lib
224+
ifndef ESP_COMPONENTS_ESP_WIFI_LIB_VERSION
225+
ESP_COMPONENTS_ESP_WIFI_LIB_VERSION = master
226+
endif
227+
228+
ifndef ESP_COMPONENTS_ESP_WIFI_LIB_URL
229+
ESP_COMPONENTS_ESP_WIFI_LIB_URL = https://github.com/espressif/esp-wifi-lib
230+
endif
231+
232+
ESP_COMPONENTS_ESP32C3_BT_LIB_REPO = esp32c3-bt-lib
233+
ifndef ESP_COMPONENTS_ESP32C3_BT_LIB_VERSION
234+
ESP_COMPONENTS_ESP32C3_BT_LIB_VERSION = master
235+
endif
236+
237+
ifndef ESP_COMPONENTS_ESP32C3_BT_LIB_URL
238+
ESP_COMPONENTS_ESP32C3_BT_LIB_URL = https://github.com/espressif/esp32c3-bt-lib
239+
endif
240+
241+
ESP_COMPONENTS_ESP_COEX_LIB_REPO = esp-coex-lib
242+
ifndef ESP_COMPONENTS_ESP_COEX_LIB_VERSION
243+
ESP_COMPONENTS_ESP_COEX_LIB_VERSION = main
244+
endif
245+
246+
ifndef ESP_COMPONENTS_ESP_COEX_LIB_URL
247+
ESP_COMPONENTS_ESP_COEX_LIB_URL = https://github.com/espressif/esp-coex-lib
221248
endif
222249

223250
chip/$(ESP_HAL_3RDPARTY_REPO):
224-
$(Q) echo "Cloning Espressif HAL for 3rd Party Platforms"
225-
$(Q) $(call CLONE_ESP_HAL_3RDPARTY_REPO)
226-
$(Q) echo "Espressif HAL for 3rd Party Platforms: ${ESP_HAL_3RDPARTY_VERSION}"
227-
$(Q) git -C chip/$(ESP_HAL_3RDPARTY_REPO) checkout --quiet $(ESP_HAL_3RDPARTY_VERSION)
228-
$(Q) git -C chip/$(ESP_HAL_3RDPARTY_REPO) submodule --quiet update --init $(GIT_DEPTH_PARAMETER) components/mbedtls/mbedtls
229-
ifeq ($(CONFIG_ESP_WIRELESS),y)
230-
$(Q) echo "Espressif HAL for 3rd Party Platforms: initializing submodules..."
231-
$(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
232-
$(Q) git -C chip/$(ESP_HAL_3RDPARTY_REPO)/components/mbedtls/mbedtls reset --quiet --hard
251+
ifeq ($(wildcard chip/$(ESP_HAL_3RDPARTY_REPO)/.git),)
252+
$(Q) echo "Downloading Espressif HAL for 3rd Party Platforms"
253+
$(Q) wget -q -O - $(ESP_HAL_3RDPARTY_URL)/archive/$(ESP_HAL_3RDPARTY_VERSION).tar.gz | tar -xz -C chip/
254+
$(Q) mv chip/$(ESP_HAL_3RDPARTY_REPO)-$(ESP_HAL_3RDPARTY_VERSION) chip/$(ESP_HAL_3RDPARTY_REPO)
255+
ifeq ($(STORAGETMP),y)
256+
$(Q) cp -r chip/$(ESP_HAL_3RDPARTY_REPO) $(NXTMPDIR)
257+
endif
258+
endif
259+
260+
chip/$(ESP_HAL_3RDPARTY_REPO)/mbedtls:
261+
ifeq ($(wildcard chip/$(ESP_HAL_3RDPARTY_REPO)/components/mbedtls/mbedtls/.git),)
262+
$(Q) wget -q -O - $(ESP_COMPONENTS_MBEDTLS_URL)/archive/$(ESP_COMPONENTS_MBEDTLS_VERSION).tar.gz | tar -xz -C chip/
263+
$(Q) rm -r chip/$(ESP_HAL_3RDPARTY_REPO)/components/mbedtls/mbedtls
264+
$(Q) mv chip/$(ESP_COMPONENTS_MBEDTLS_REPO)-$(ESP_COMPONENTS_MBEDTLS_VERSION) chip/$(ESP_HAL_3RDPARTY_REPO)/components/mbedtls/mbedtls
233265
$(Q) echo "Applying patches..."
234266
$(Q) cd chip/$(ESP_HAL_3RDPARTY_REPO)/components/mbedtls/mbedtls && git apply ../../../nuttx/patches/components/mbedtls/mbedtls/*.patch
235267
endif
236268

269+
ifeq ($(CONFIG_ESP_WIRELESS),y)
270+
chip/$(ESP_HAL_3RDPARTY_REPO)/wireless:
271+
ifeq ($(wildcard chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_phy/lib/.git),)
272+
$(Q) wget -q -O - $(ESP_COMPONENTS_ESP_PHY_LIB_URL)/archive/$(ESP_COMPONENTS_ESP_PHY_LIB_VERSION).tar.gz | tar -xz -C chip/
273+
$(Q) rm -r chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_phy/lib
274+
$(Q) mv chip/$(ESP_COMPONENTS_ESP_PHY_LIB_REPO)-$(ESP_COMPONENTS_ESP_PHY_LIB_VERSION) chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_phy/lib
275+
endif
276+
ifeq ($(wildcard chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_wifi/lib/.git),)
277+
$(Q) wget -q -O - $(ESP_COMPONENTS_ESP_WIFI_LIB_URL)/archive/$(ESP_COMPONENTS_ESP_WIFI_LIB_VERSION).tar.gz | tar -xz -C chip/
278+
$(Q) rm -r chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_wifi/lib
279+
$(Q) mv chip/$(ESP_COMPONENTS_ESP_WIFI_LIB_REPO)-$(ESP_COMPONENTS_ESP_WIFI_LIB_VERSION) chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_wifi/lib
280+
endif
281+
ifeq ($(wildcard chip/$(ESP_HAL_3RDPARTY_REPO)/components/bt/controller/lib_esp32c3_family/.git),)
282+
$(Q) wget -q -O - $(ESP_COMPONENTS_ESP32C3_BT_LIB_URL)/archive/$(ESP_COMPONENTS_ESP32C3_BT_LIB_VERSION).tar.gz | tar -xz -C chip/
283+
$(Q) rm -r chip/$(ESP_HAL_3RDPARTY_REPO)/components/bt/controller/lib_esp32c3_family
284+
$(Q) mv chip/$(ESP_COMPONENTS_ESP32C3_BT_LIB_REPO)-$(ESP_COMPONENTS_ESP32C3_BT_LIB_VERSION) chip/$(ESP_HAL_3RDPARTY_REPO)/components/bt/controller/lib_esp32c3_family
285+
endif
286+
ifeq ($(wildcard chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_coex/lib/.git),)
287+
$(Q) wget -q -O - $(ESP_COMPONENTS_ESP_COEX_LIB_URL)/archive/$(ESP_COMPONENTS_ESP_COEX_LIB_VERSION).tar.gz | tar -xz -C chip/
288+
$(Q) rm -r chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_coex/lib
289+
$(Q) mv chip/$(ESP_COMPONENTS_ESP_COEX_LIB_REPO)-$(ESP_COMPONENTS_ESP_COEX_LIB_VERSION) chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_coex/lib
290+
endif
291+
else
292+
chip/$(ESP_HAL_3RDPARTY_REPO)/wireless:
293+
endif
294+
237295
include common$(DELIM)espressif$(DELIM)Bootloader.mk
238296

239297
# Silent preprocessor warnings
@@ -250,15 +308,35 @@ ifeq ($(CONFIG_ESP_WIRELESS),y)
250308
include common$(DELIM)espressif$(DELIM)Wireless.mk
251309
endif
252310

253-
context:: chip/$(ESP_HAL_3RDPARTY_REPO)
311+
context:: chip/$(ESP_HAL_3RDPARTY_REPO) chip/$(ESP_HAL_3RDPARTY_REPO)/wireless chip/$(ESP_HAL_3RDPARTY_REPO)/mbedtls
254312
$(call COPYFILE,chip/$(ESP_HAL_3RDPARTY_REPO)/components/soc/$(CHIP_SERIES)/include/soc/gpio_sig_map.h,../include/chip/)
255313
$(call COPYFILE,chip/$(ESP_HAL_3RDPARTY_REPO)/nuttx/$(CHIP_SERIES)/include/irq.h,../include/chip/)
256314

257315
distclean::
258316
$(call DELFILE,../include/chip/gpio_sig_map.h)
259317
$(call DELFILE,../include/chip/irq.h)
260318
$(call DELFILE,../../../vefuse.bin)
319+
ifeq ($(wildcard chip/$(ESP_HAL_3RDPARTY_REPO)/.git),)
261320
$(call DELDIR,chip/$(ESP_HAL_3RDPARTY_REPO))
321+
else
322+
ifeq ($(wildcard chip/$(ESP_HAL_3RDPARTY_REPO)/components/mbedtls/mbedtls/.git),)
323+
$(call DELDIR,chip/$(ESP_HAL_3RDPARTY_REPO)/components/mbedtls/mbedtls)
324+
endif
325+
ifeq ($(CONFIG_ESP_WIRELESS),y)
326+
ifeq ($(wildcard chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_phy/lib/.git),)
327+
$(call DELDIR,chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_phy/lib)
328+
endif
329+
ifeq ($(wildcard chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_wifi/lib/.git),)
330+
$(call DELDIR,chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_wifi/lib)
331+
endif
332+
ifeq ($(wildcard chip/$(ESP_HAL_3RDPARTY_REPO)/components/bt/controller/lib_esp32c3_family/.git),)
333+
$(call DELDIR,chip/$(ESP_HAL_3RDPARTY_REPO)/components/bt/controller/lib_esp32c3_family)
334+
endif
335+
ifeq ($(wildcard chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_coex/lib/.git),)
336+
$(call DELDIR,chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_coex/lib)
337+
endif
338+
endif
339+
endif
262340
ifeq ($(CONFIG_ESPRESSIF_USE_LP_CORE),y)
263341
$(call DELDIR,chip/ulp)
264342
endif

arch/risc-v/src/esp32c3-legacy/Make.defs

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -245,25 +245,18 @@ ifndef ESP_HAL_3RDPARTY_VERSION
245245
endif
246246

247247
ifndef ESP_HAL_3RDPARTY_URL
248-
ESP_HAL_3RDPARTY_URL = https://github.com/espressif/esp-hal-3rdparty.git
248+
ESP_HAL_3RDPARTY_URL = https://github.com/espressif/esp-hal-3rdparty
249249
endif
250250

251+
chip/$(ESP_HAL_3RDPARTY_REPO):
252+
ifeq ($(wildcard chip/$(ESP_HAL_3RDPARTY_REPO)/.git),)
253+
$(Q) echo "Downloading Espressif HAL for 3rd Party Platforms"
254+
$(Q) wget -q -O - $(ESP_HAL_3RDPARTY_URL)/archive/$(ESP_HAL_3RDPARTY_VERSION).tar.gz | tar -xz -C chip/
255+
$(Q) mv chip/$(ESP_HAL_3RDPARTY_REPO)-$(ESP_HAL_3RDPARTY_VERSION) chip/$(ESP_HAL_3RDPARTY_REPO)
251256
ifeq ($(STORAGETMP),y)
252-
define CLONE_ESP_HAL_3RDPARTY_REPO
253-
$(call CHECK_COMMITSHA, $(NXTMPDIR)/$(ESP_HAL_3RDPARTY_REPO),$(ESP_HAL_3RDPARTY_VERSION))
254-
$(call CLONE, $(ESP_HAL_3RDPARTY_URL),chip/$(ESP_HAL_3RDPARTY_REPO),$(NXTMPDIR)/$(ESP_HAL_3RDPARTY_REPO))
255-
endef
256-
else
257-
define CLONE_ESP_HAL_3RDPARTY_REPO
258-
$(call CLONE, $(ESP_HAL_3RDPARTY_URL),chip/$(ESP_HAL_3RDPARTY_REPO))
259-
endef
257+
$(Q) cp -r chip/$(ESP_HAL_3RDPARTY_REPO) $(NXTMPDIR)
258+
endif
260259
endif
261-
262-
chip/$(ESP_HAL_3RDPARTY_REPO):
263-
$(Q) echo "Cloning Espressif HAL for 3rd Party Platforms"
264-
$(Q) $(call CLONE_ESP_HAL_3RDPARTY_REPO)
265-
$(Q) echo "Espressif HAL for 3rd Party Platforms: ${ESP_HAL_3RDPARTY_VERSION}"
266-
$(Q) git -C chip/$(ESP_HAL_3RDPARTY_REPO) checkout --quiet $(ESP_HAL_3RDPARTY_VERSION)
267260

268261
# Silent preprocessor warnings
269262

@@ -272,4 +265,6 @@ CFLAGS += -Wno-undef -Wno-unused-variable
272265
include chip/Bootloader.mk
273266

274267
distclean::
268+
ifeq ($(wildcard chip/$(ESP_HAL_3RDPARTY_REPO)/.git),)
275269
$(call DELDIR,chip/$(ESP_HAL_3RDPARTY_REPO))
270+
endif

arch/xtensa/src/esp32/Make.defs

Lines changed: 106 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -227,33 +227,100 @@ ifndef ESP_HAL_3RDPARTY_VERSION
227227
endif
228228

229229
ifndef ESP_HAL_3RDPARTY_URL
230-
ESP_HAL_3RDPARTY_URL = https://github.com/espressif/esp-hal-3rdparty.git
230+
ESP_HAL_3RDPARTY_URL = https://github.com/espressif/esp-hal-3rdparty
231231
endif
232232

233-
ifndef DISABLE_GIT_DEPTH
234-
ifndef GIT_DEPTH
235-
GIT_DEPTH=1
233+
ESP_COMPONENTS_MBEDTLS_REPO = mbedtls
234+
ifndef ESP_COMPONENTS_MBEDTLS_VERSION
235+
ESP_COMPONENTS_MBEDTLS_VERSION = mbedtls-3.6.4-idf
236236
endif
237-
GIT_DEPTH_PARAMETER = --depth=$(GIT_DEPTH)
237+
238+
ifndef ESP_COMPONENTS_MBEDTLS_URL
239+
ESP_COMPONENTS_MBEDTLS_URL = https://github.com/espressif/mbedtls
238240
endif
239241

240-
ifeq ($(STORAGETMP),y)
241-
define CLONE_ESP_HAL_3RDPARTY_REPO
242-
$(call CHECK_COMMITSHA, $(NXTMPDIR)/$(ESP_HAL_3RDPARTY_REPO),$(ESP_HAL_3RDPARTY_VERSION))
243-
$(call CLONE, $(ESP_HAL_3RDPARTY_URL),chip/$(ESP_HAL_3RDPARTY_REPO),$(NXTMPDIR)/$(ESP_HAL_3RDPARTY_REPO))
244-
endef
245-
else
246-
define CLONE_ESP_HAL_3RDPARTY_REPO
247-
$(call CLONE, $(ESP_HAL_3RDPARTY_URL),chip/$(ESP_HAL_3RDPARTY_REPO))
248-
endef
242+
ESP_COMPONENTS_ESP_PHY_LIB_REPO = esp-phy-lib
243+
ifndef ESP_COMPONENTS_ESP_PHY_LIB_VERSION
244+
ESP_COMPONENTS_ESP_PHY_LIB_VERSION = master
245+
endif
246+
247+
ifndef ESP_COMPONENTS_ESP_PHY_LIB_URL
248+
ESP_COMPONENTS_ESP_PHY_LIB_URL = https://github.com/espressif/esp-phy-lib
249+
endif
250+
251+
ESP_COMPONENTS_ESP_WIFI_LIB_REPO = esp-wifi-lib
252+
ifndef ESP_COMPONENTS_ESP_WIFI_LIB_VERSION
253+
ESP_COMPONENTS_ESP_WIFI_LIB_VERSION = master
254+
endif
255+
256+
ifndef ESP_COMPONENTS_ESP_WIFI_LIB_URL
257+
ESP_COMPONENTS_ESP_WIFI_LIB_URL = https://github.com/espressif/esp-wifi-lib
258+
endif
259+
260+
ESP_COMPONENTS_ESP32_BT_LIB_REPO = esp32-bt-lib
261+
ifndef ESP_COMPONENTS_ESP32_BT_LIB_VERSION
262+
ESP_COMPONENTS_ESP32_BT_LIB_VERSION = master
263+
endif
264+
265+
ifndef ESP_COMPONENTS_ESP32_BT_LIB_URL
266+
ESP_COMPONENTS_ESP32_BT_LIB_URL = https://github.com/espressif/esp32-bt-lib
267+
endif
268+
269+
ESP_COMPONENTS_ESP_COEX_LIB_REPO = esp-coex-lib
270+
ifndef ESP_COMPONENTS_ESP_COEX_LIB_VERSION
271+
ESP_COMPONENTS_ESP_COEX_LIB_VERSION = main
272+
endif
273+
274+
ifndef ESP_COMPONENTS_ESP_COEX_LIB_URL
275+
ESP_COMPONENTS_ESP_COEX_LIB_URL = https://github.com/espressif/esp-coex-lib
249276
endif
250277

251278
chip/$(ESP_HAL_3RDPARTY_REPO):
252-
$(Q) echo "Cloning Espressif HAL for 3rd Party Platforms"
253-
$(Q) $(call CLONE_ESP_HAL_3RDPARTY_REPO)
254-
$(Q) echo "Espressif HAL for 3rd Party Platforms: ${ESP_HAL_3RDPARTY_VERSION}"
255-
$(Q) git -C chip/$(ESP_HAL_3RDPARTY_REPO) checkout --quiet $(ESP_HAL_3RDPARTY_VERSION)
279+
ifeq ($(wildcard chip/$(ESP_HAL_3RDPARTY_REPO)/.git),)
280+
$(Q) echo "Downloading Espressif HAL for 3rd Party Platforms"
281+
$(Q) wget -q -O - $(ESP_HAL_3RDPARTY_URL)/archive/$(ESP_HAL_3RDPARTY_VERSION).tar.gz | tar -xz -C chip/
282+
$(Q) mv chip/$(ESP_HAL_3RDPARTY_REPO)-$(ESP_HAL_3RDPARTY_VERSION) chip/$(ESP_HAL_3RDPARTY_REPO)
283+
ifeq ($(STORAGETMP),y)
284+
$(Q) cp -r chip/$(ESP_HAL_3RDPARTY_REPO) $(NXTMPDIR)
285+
endif
286+
endif
287+
288+
chip/$(ESP_HAL_3RDPARTY_REPO)/mbedtls:
289+
ifeq ($(wildcard chip/$(ESP_HAL_3RDPARTY_REPO)/components/mbedtls/mbedtls/.git),)
290+
$(Q) wget -q -O - $(ESP_COMPONENTS_MBEDTLS_URL)/archive/$(ESP_COMPONENTS_MBEDTLS_VERSION).tar.gz | tar -xz -C chip/
291+
$(Q) rm -r chip/$(ESP_HAL_3RDPARTY_REPO)/components/mbedtls/mbedtls
292+
$(Q) mv chip/$(ESP_COMPONENTS_MBEDTLS_REPO)-$(ESP_COMPONENTS_MBEDTLS_VERSION) chip/$(ESP_HAL_3RDPARTY_REPO)/components/mbedtls/mbedtls
293+
$(Q) echo "Applying patches..."
294+
$(Q) cd chip/$(ESP_HAL_3RDPARTY_REPO)/components/mbedtls/mbedtls && git apply ../../../nuttx/patches/components/mbedtls/mbedtls/*.patch
295+
endif
256296

297+
ifeq ($(CONFIG_ESPRESSIF_WIRELESS),y)
298+
chip/$(ESP_HAL_3RDPARTY_REPO)/wireless:
299+
ifeq ($(wildcard chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_phy/lib/.git),)
300+
$(Q) wget -q -O - $(ESP_COMPONENTS_ESP_PHY_LIB_URL)/archive/$(ESP_COMPONENTS_ESP_PHY_LIB_VERSION).tar.gz | tar -xz -C chip/
301+
$(Q) rm -r chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_phy/lib
302+
$(Q) mv chip/$(ESP_COMPONENTS_ESP_PHY_LIB_REPO)-$(ESP_COMPONENTS_ESP_PHY_LIB_VERSION) chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_phy/lib
303+
endif
304+
ifeq ($(wildcard chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_wifi/lib/.git),)
305+
$(Q) wget -q -O - $(ESP_COMPONENTS_ESP_WIFI_LIB_URL)/archive/$(ESP_COMPONENTS_ESP_WIFI_LIB_VERSION).tar.gz | tar -xz -C chip/
306+
$(Q) rm -r chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_wifi/lib
307+
$(Q) mv chip/$(ESP_COMPONENTS_ESP_WIFI_LIB_REPO)-$(ESP_COMPONENTS_ESP_WIFI_LIB_VERSION) chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_wifi/lib
308+
endif
309+
ifeq ($(wildcard chip/$(ESP_HAL_3RDPARTY_REPO)/components/bt/controller/lib_esp32/.git),)
310+
$(Q) wget -q -O - $(ESP_COMPONENTS_ESP32_BT_LIB_URL)/archive/$(ESP_COMPONENTS_ESP32_BT_LIB_VERSION).tar.gz | tar -xz -C chip/
311+
$(Q) rm -r chip/$(ESP_HAL_3RDPARTY_REPO)/components/bt/controller/lib_esp32
312+
$(Q) mv chip/$(ESP_COMPONENTS_ESP32_BT_LIB_REPO)-$(ESP_COMPONENTS_ESP32_BT_LIB_VERSION) chip/$(ESP_HAL_3RDPARTY_REPO)/components/bt/controller/lib_esp32
313+
endif
314+
ifeq ($(wildcard chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_coex/lib/.git),)
315+
$(Q) wget -q -O - $(ESP_COMPONENTS_ESP_COEX_LIB_URL)/archive/$(ESP_COMPONENTS_ESP_COEX_LIB_VERSION).tar.gz | tar -xz -C chip/
316+
$(Q) rm -r chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_coex/lib
317+
$(Q) mv chip/$(ESP_COMPONENTS_ESP_COEX_LIB_REPO)-$(ESP_COMPONENTS_ESP_COEX_LIB_VERSION) chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_coex/lib
318+
endif
319+
else
320+
chip/$(ESP_HAL_3RDPARTY_REPO)/wireless:
321+
endif
322+
323+
257324
# Silent preprocessor warnings
258325

259326
CFLAGS += -Wno-undef -Wno-unused-variable -fno-jump-tables -fno-tree-switch-conversion
@@ -272,18 +339,30 @@ include chip/hal.mk
272339

273340
include common/espressif/Make.defs
274341

275-
context:: chip/$(ESP_HAL_3RDPARTY_REPO)
276-
$(Q) echo "Espressif HAL for 3rd Party Platforms: initializing submodules..."
277-
$(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
278-
$(Q) git -C chip/$(ESP_HAL_3RDPARTY_REPO)/components/mbedtls/mbedtls reset --quiet --hard
279-
$(Q) echo "Applying patches..."
280-
$(Q) cd chip/$(ESP_HAL_3RDPARTY_REPO)/components/mbedtls/mbedtls && git apply ../../../nuttx/patches/components/mbedtls/mbedtls/*.patch
281-
ifeq ($(CONFIG_ESPRESSIF_WIRELESS),y)
282-
$(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
283-
endif
342+
context:: chip/$(ESP_HAL_3RDPARTY_REPO) chip/$(ESP_HAL_3RDPARTY_REPO)/wireless chip/$(ESP_HAL_3RDPARTY_REPO)/mbedtls
284343

285344
distclean::
345+
ifeq ($(wildcard chip/$(ESP_HAL_3RDPARTY_REPO)/.git),)
286346
$(call DELDIR,chip/$(ESP_HAL_3RDPARTY_REPO))
347+
else
348+
ifeq ($(wildcard chip/$(ESP_HAL_3RDPARTY_REPO)/components/mbedtls/mbedtls/.git),)
349+
$(call DELDIR,chip/$(ESP_HAL_3RDPARTY_REPO)/components/mbedtls/mbedtls)
350+
endif
351+
ifeq ($(CONFIG_ESPRESSIF_WIRELESS),y)
352+
ifeq ($(wildcard chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_phy/lib/.git),)
353+
$(call DELDIR,chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_phy/lib)
354+
endif
355+
ifeq ($(wildcard chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_wifi/lib/.git),)
356+
$(call DELDIR,chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_wifi/lib)
357+
endif
358+
ifeq ($(wildcard chip/$(ESP_HAL_3RDPARTY_REPO)/components/bt/controller/lib_esp32c3_family/.git),)
359+
$(call DELDIR,chip/$(ESP_HAL_3RDPARTY_REPO)/components/bt/controller/lib_esp32c3_family)
360+
endif
361+
ifeq ($(wildcard chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_coex/lib/.git),)
362+
$(call DELDIR,chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_coex/lib)
363+
endif
364+
endif
365+
endif
287366
$(call DELFILE,../../../vefuse.bin)
288367

289368
INCLUDES += ${INCDIR_PREFIX}$(ARCH_SRCDIR)$(DELIM)common$(DELIM)espressif

0 commit comments

Comments
 (0)