Skip to content

Commit eac577d

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 eac577d

File tree

5 files changed

+368
-112
lines changed

5 files changed

+368
-112
lines changed

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

Lines changed: 94 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -199,37 +199,89 @@ 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
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
229259
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
260+
ifeq ($(wildcard chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_phy/lib/.git),)
261+
$(Q) wget -q -O - $(ESP_COMPONENTS_ESP_PHY_LIB_URL)/archive/$(ESP_COMPONENTS_ESP_PHY_LIB_VERSION).tar.gz | tar -xz -C chip/
262+
$(Q) rm -r chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_phy/lib
263+
$(Q) mv chip/$(ESP_COMPONENTS_ESP_PHY_LIB_REPO)-$(ESP_COMPONENTS_ESP_PHY_LIB_VERSION) chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_phy/lib
264+
endif
265+
ifeq ($(wildcard chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_wifi/lib/.git),)
266+
$(Q) wget -q -O - $(ESP_COMPONENTS_ESP_WIFI_LIB_URL)/archive/$(ESP_COMPONENTS_ESP_WIFI_LIB_VERSION).tar.gz | tar -xz -C chip/
267+
$(Q) rm -r chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_wifi/lib
268+
$(Q) mv chip/$(ESP_COMPONENTS_ESP_WIFI_LIB_REPO)-$(ESP_COMPONENTS_ESP_WIFI_LIB_VERSION) chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_wifi/lib
269+
endif
270+
ifeq ($(wildcard chip/$(ESP_HAL_3RDPARTY_REPO)/components/bt/controller/lib_esp32c3_family/.git),)
271+
$(Q) wget -q -O - $(ESP_COMPONENTS_ESP32C3_BT_LIB_URL)/archive/$(ESP_COMPONENTS_ESP32C3_BT_LIB_VERSION).tar.gz | tar -xz -C chip/
272+
$(Q) rm -r chip/$(ESP_HAL_3RDPARTY_REPO)/components/bt/controller/lib_esp32c3_family
273+
$(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
274+
endif
275+
ifeq ($(wildcard chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_coex/lib/.git),)
276+
$(Q) wget -q -O - $(ESP_COMPONENTS_ESP_COEX_LIB_URL)/archive/$(ESP_COMPONENTS_ESP_COEX_LIB_VERSION).tar.gz | tar -xz -C chip/
277+
$(Q) rm -r chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_coex/lib
278+
$(Q) mv chip/$(ESP_COMPONENTS_ESP_COEX_LIB_REPO)-$(ESP_COMPONENTS_ESP_COEX_LIB_VERSION) chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_coex/lib
279+
endif
280+
endif
281+
ifeq ($(wildcard chip/$(ESP_HAL_3RDPARTY_REPO)/components/mbedtls/mbedtls/.git),)
282+
$(Q) wget -q -O - $(ESP_COMPONENTS_MBEDTLS_URL)/archive/$(ESP_COMPONENTS_MBEDTLS_VERSION).tar.gz | tar -xz -C chip/
283+
$(Q) rm -r chip/$(ESP_HAL_3RDPARTY_REPO)/components/mbedtls/mbedtls
284+
$(Q) mv chip/$(ESP_COMPONENTS_MBEDTLS_REPO)-$(ESP_COMPONENTS_MBEDTLS_VERSION) chip/$(ESP_HAL_3RDPARTY_REPO)/components/mbedtls/mbedtls
233285
$(Q) echo "Applying patches..."
234286
$(Q) cd chip/$(ESP_HAL_3RDPARTY_REPO)/components/mbedtls/mbedtls && git apply ../../../nuttx/patches/components/mbedtls/mbedtls/*.patch
235287
endif
@@ -258,7 +310,27 @@ distclean::
258310
$(call DELFILE,../include/chip/gpio_sig_map.h)
259311
$(call DELFILE,../include/chip/irq.h)
260312
$(call DELFILE,../../../vefuse.bin)
313+
ifeq ($(wildcard chip/$(ESP_HAL_3RDPARTY_REPO)/.git),)
261314
$(call DELDIR,chip/$(ESP_HAL_3RDPARTY_REPO))
315+
else
316+
ifeq ($(wildcard chip/$(ESP_HAL_3RDPARTY_REPO)/components/mbedtls/mbedtls/.git),)
317+
$(call DELDIR,chip/$(ESP_HAL_3RDPARTY_REPO)/components/mbedtls/mbedtls)
318+
endif
319+
ifeq ($(CONFIG_ESP_WIRELESS),y)
320+
ifeq ($(wildcard chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_phy/lib/.git),)
321+
$(call DELDIR,chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_phy/lib)
322+
endif
323+
ifeq ($(wildcard chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_wifi/lib/.git),)
324+
$(call DELDIR,chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_wifi/lib)
325+
endif
326+
ifeq ($(wildcard chip/$(ESP_HAL_3RDPARTY_REPO)/components/bt/controller/lib_esp32c3_family/.git),)
327+
$(call DELDIR,chip/$(ESP_HAL_3RDPARTY_REPO)/components/bt/controller/lib_esp32c3_family)
328+
endif
329+
ifeq ($(wildcard chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_coex/lib/.git),)
330+
$(call DELDIR,chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_coex/lib)
331+
endif
332+
endif
333+
endif
262334
ifeq ($(CONFIG_ESPRESSIF_USE_LP_CORE),y)
263335
$(call DELDIR,chip/ulp)
264336
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: 99 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -227,33 +227,93 @@ 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
249245
endif
250246

251-
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)
247+
ifndef ESP_COMPONENTS_ESP_PHY_LIB_URL
248+
ESP_COMPONENTS_ESP_PHY_LIB_URL = https://github.com/espressif/esp-phy-lib
249+
endif
256250

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
276+
endif
277+
278+
chip/$(ESP_HAL_3RDPARTY_REPO):
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+
ifeq ($(CONFIG_ESPRESSIF_WIRELESS),y)
288+
ifeq ($(wildcard chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_phy/lib/.git),)
289+
$(Q) wget -q -O - $(ESP_COMPONENTS_ESP_PHY_LIB_URL)/archive/$(ESP_COMPONENTS_ESP_PHY_LIB_VERSION).tar.gz | tar -xz -C chip/
290+
$(Q) rm -r chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_phy/lib
291+
$(Q) mv chip/$(ESP_COMPONENTS_ESP_PHY_LIB_REPO)-$(ESP_COMPONENTS_ESP_PHY_LIB_VERSION) chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_phy/lib
292+
endif
293+
ifeq ($(wildcard chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_wifi/lib/.git),)
294+
$(Q) wget -q -O - $(ESP_COMPONENTS_ESP_WIFI_LIB_URL)/archive/$(ESP_COMPONENTS_ESP_WIFI_LIB_VERSION).tar.gz | tar -xz -C chip/
295+
$(Q) rm -r chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_wifi/lib
296+
$(Q) mv chip/$(ESP_COMPONENTS_ESP_WIFI_LIB_REPO)-$(ESP_COMPONENTS_ESP_WIFI_LIB_VERSION) chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_wifi/lib
297+
endif
298+
ifeq ($(wildcard chip/$(ESP_HAL_3RDPARTY_REPO)/components/bt/controller/lib_esp32/.git),)
299+
$(Q) wget -q -O - $(ESP_COMPONENTS_ESP32_BT_LIB_URL)/archive/$(ESP_COMPONENTS_ESP32_BT_LIB_VERSION).tar.gz | tar -xz -C chip/
300+
$(Q) rm -r chip/$(ESP_HAL_3RDPARTY_REPO)/components/bt/controller/lib_esp32
301+
$(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
302+
endif
303+
ifeq ($(wildcard chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_coex/lib/.git),)
304+
$(Q) wget -q -O - $(ESP_COMPONENTS_ESP_COEX_LIB_URL)/archive/$(ESP_COMPONENTS_ESP_COEX_LIB_VERSION).tar.gz | tar -xz -C chip/
305+
$(Q) rm -r chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_coex/lib
306+
$(Q) mv chip/$(ESP_COMPONENTS_ESP_COEX_LIB_REPO)-$(ESP_COMPONENTS_ESP_COEX_LIB_VERSION) chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_coex/lib
307+
endif
308+
endif
309+
ifeq ($(wildcard chip/$(ESP_HAL_3RDPARTY_REPO)/components/mbedtls/mbedtls/.git),)
310+
$(Q) wget -q -O - $(ESP_COMPONENTS_MBEDTLS_URL)/archive/$(ESP_COMPONENTS_MBEDTLS_VERSION).tar.gz | tar -xz -C chip/
311+
$(Q) rm -r chip/$(ESP_HAL_3RDPARTY_REPO)/components/mbedtls/mbedtls
312+
$(Q) mv chip/$(ESP_COMPONENTS_MBEDTLS_REPO)-$(ESP_COMPONENTS_MBEDTLS_VERSION) chip/$(ESP_HAL_3RDPARTY_REPO)/components/mbedtls/mbedtls
313+
$(Q) echo "Applying patches..."
314+
$(Q) cd chip/$(ESP_HAL_3RDPARTY_REPO)/components/mbedtls/mbedtls && git apply ../../../nuttx/patches/components/mbedtls/mbedtls/*.patch
315+
endif
316+
257317
# Silent preprocessor warnings
258318

259319
CFLAGS += -Wno-undef -Wno-unused-variable -fno-jump-tables -fno-tree-switch-conversion
@@ -273,17 +333,29 @@ include chip/hal.mk
273333
include common/espressif/Make.defs
274334

275335
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
284336

285337
distclean::
338+
ifeq ($(wildcard chip/$(ESP_HAL_3RDPARTY_REPO)/.git),)
286339
$(call DELDIR,chip/$(ESP_HAL_3RDPARTY_REPO))
340+
else
341+
ifeq ($(wildcard chip/$(ESP_HAL_3RDPARTY_REPO)/components/mbedtls/mbedtls/.git),)
342+
$(call DELDIR,chip/$(ESP_HAL_3RDPARTY_REPO)/components/mbedtls/mbedtls)
343+
endif
344+
ifeq ($(CONFIG_ESP_WIRELESS),y)
345+
ifeq ($(wildcard chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_phy/lib/.git),)
346+
$(call DELDIR,chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_phy/lib)
347+
endif
348+
ifeq ($(wildcard chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_wifi/lib/.git),)
349+
$(call DELDIR,chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_wifi/lib)
350+
endif
351+
ifeq ($(wildcard chip/$(ESP_HAL_3RDPARTY_REPO)/components/bt/controller/lib_esp32c3_family/.git),)
352+
$(call DELDIR,chip/$(ESP_HAL_3RDPARTY_REPO)/components/bt/controller/lib_esp32c3_family)
353+
endif
354+
ifeq ($(wildcard chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_coex/lib/.git),)
355+
$(call DELDIR,chip/$(ESP_HAL_3RDPARTY_REPO)/components/esp_coex/lib)
356+
endif
357+
endif
358+
endif
287359
$(call DELFILE,../../../vefuse.bin)
288360

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

0 commit comments

Comments
 (0)