Skip to content

Commit fd34d7b

Browse files
committed
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 CHECK_COMMITSHA, reset, checkout and update. Signed-off-by: v-tangmeng <[email protected]>
1 parent be413af commit fd34d7b

File tree

5 files changed

+79
-0
lines changed

5 files changed

+79
-0
lines changed

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,11 +209,22 @@ endif
209209
GIT_DEPTH_PARAMETER = --depth=$(GIT_DEPTH)
210210
endif
211211

212+
# When set USE_NXTMPDIR_ESP_REPO_DIRECTLY=y, will directly use esp-hal-3rdparty
213+
# under nxtmpdir without CHECK_COMMITSHA, reset, checkout and update.
214+
215+
USE_NXTMPDIR_ESP_REPO_DIRECTLY ?= n
216+
212217
ifeq ($(STORAGETMP),y)
218+
ifeq ($(USE_NXTMPDIR_ESP_REPO_DIRECTLY),y)
219+
define CLONE_ESP_HAL_3RDPARTY_REPO
220+
$(call CLONE, $(ESP_HAL_3RDPARTY_URL),chip/$(ESP_HAL_3RDPARTY_REPO),$(NXTMPDIR)/$(ESP_HAL_3RDPARTY_REPO))
221+
endef
222+
else
213223
define CLONE_ESP_HAL_3RDPARTY_REPO
214224
$(call CHECK_COMMITSHA, $(NXTMPDIR)/$(ESP_HAL_3RDPARTY_REPO),$(ESP_HAL_3RDPARTY_VERSION))
215225
$(call CLONE, $(ESP_HAL_3RDPARTY_URL),chip/$(ESP_HAL_3RDPARTY_REPO),$(NXTMPDIR)/$(ESP_HAL_3RDPARTY_REPO))
216226
endef
227+
endif
217228
else
218229
define CLONE_ESP_HAL_3RDPARTY_REPO
219230
$(call CLONE, $(ESP_HAL_3RDPARTY_URL),chip/$(ESP_HAL_3RDPARTY_REPO))
@@ -223,13 +234,17 @@ endif
223234
chip/$(ESP_HAL_3RDPARTY_REPO):
224235
$(Q) echo "Cloning Espressif HAL for 3rd Party Platforms"
225236
$(Q) $(call CLONE_ESP_HAL_3RDPARTY_REPO)
237+
ifneq ($(USE_NXTMPDIR_ESP_REPO_DIRECTLY),y)
226238
$(Q) echo "Espressif HAL for 3rd Party Platforms: ${ESP_HAL_3RDPARTY_VERSION}"
227239
$(Q) git -C chip/$(ESP_HAL_3RDPARTY_REPO) checkout --quiet $(ESP_HAL_3RDPARTY_VERSION)
228240
$(Q) git -C chip/$(ESP_HAL_3RDPARTY_REPO) submodule --quiet update --init $(GIT_DEPTH_PARAMETER) components/mbedtls/mbedtls
241+
endif
229242
ifeq ($(CONFIG_ESP_WIRELESS),y)
243+
ifneq ($(USE_NXTMPDIR_ESP_REPO_DIRECTLY),y)
230244
$(Q) echo "Espressif HAL for 3rd Party Platforms: initializing submodules..."
231245
$(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
232246
$(Q) git -C chip/$(ESP_HAL_3RDPARTY_REPO)/components/mbedtls/mbedtls reset --quiet --hard
247+
endif
233248
$(Q) echo "Applying patches..."
234249
$(Q) cd chip/$(ESP_HAL_3RDPARTY_REPO)/components/mbedtls/mbedtls && git apply ../../../nuttx/patches/components/mbedtls/mbedtls/*.patch
235250
endif

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,11 +248,22 @@ ifndef ESP_HAL_3RDPARTY_URL
248248
ESP_HAL_3RDPARTY_URL = https://github.com/espressif/esp-hal-3rdparty.git
249249
endif
250250

251+
# When set USE_NXTMPDIR_ESP_REPO_DIRECTLY=y, will directly use esp-hal-3rdparty
252+
# under nxtmpdir without CHECK_COMMITSHA, reset, checkout and update.
253+
254+
USE_NXTMPDIR_ESP_REPO_DIRECTLY ?= n
255+
251256
ifeq ($(STORAGETMP),y)
257+
ifeq ($(USE_NXTMPDIR_ESP_REPO_DIRECTLY),y)
258+
define CLONE_ESP_HAL_3RDPARTY_REPO
259+
$(call CLONE, $(ESP_HAL_3RDPARTY_URL),chip/$(ESP_HAL_3RDPARTY_REPO),$(NXTMPDIR)/$(ESP_HAL_3RDPARTY_REPO))
260+
endef
261+
else
252262
define CLONE_ESP_HAL_3RDPARTY_REPO
253263
$(call CHECK_COMMITSHA, $(NXTMPDIR)/$(ESP_HAL_3RDPARTY_REPO),$(ESP_HAL_3RDPARTY_VERSION))
254264
$(call CLONE, $(ESP_HAL_3RDPARTY_URL),chip/$(ESP_HAL_3RDPARTY_REPO),$(NXTMPDIR)/$(ESP_HAL_3RDPARTY_REPO))
255265
endef
266+
endif
256267
else
257268
define CLONE_ESP_HAL_3RDPARTY_REPO
258269
$(call CLONE, $(ESP_HAL_3RDPARTY_URL),chip/$(ESP_HAL_3RDPARTY_REPO))
@@ -262,8 +273,10 @@ endif
262273
chip/$(ESP_HAL_3RDPARTY_REPO):
263274
$(Q) echo "Cloning Espressif HAL for 3rd Party Platforms"
264275
$(Q) $(call CLONE_ESP_HAL_3RDPARTY_REPO)
276+
ifneq ($(USE_NXTMPDIR_ESP_REPO_DIRECTLY),y)
265277
$(Q) echo "Espressif HAL for 3rd Party Platforms: ${ESP_HAL_3RDPARTY_VERSION}"
266278
$(Q) git -C chip/$(ESP_HAL_3RDPARTY_REPO) checkout --quiet $(ESP_HAL_3RDPARTY_VERSION)
279+
endif
267280

268281
# Silent preprocessor warnings
269282

arch/xtensa/src/esp32/Make.defs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,11 +237,22 @@ endif
237237
GIT_DEPTH_PARAMETER = --depth=$(GIT_DEPTH)
238238
endif
239239

240+
# When set USE_NXTMPDIR_ESP_REPO_DIRECTLY=y, will directly use esp-hal-3rdparty
241+
# under nxtmpdir without CHECK_COMMITSHA, reset, checkout and update.
242+
243+
USE_NXTMPDIR_ESP_REPO_DIRECTLY ?= n
244+
240245
ifeq ($(STORAGETMP),y)
246+
ifeq ($(USE_NXTMPDIR_ESP_REPO_DIRECTLY),y)
247+
define CLONE_ESP_HAL_3RDPARTY_REPO
248+
$(call CLONE, $(ESP_HAL_3RDPARTY_URL),chip/$(ESP_HAL_3RDPARTY_REPO),$(NXTMPDIR)/$(ESP_HAL_3RDPARTY_REPO))
249+
endef
250+
else
241251
define CLONE_ESP_HAL_3RDPARTY_REPO
242252
$(call CHECK_COMMITSHA, $(NXTMPDIR)/$(ESP_HAL_3RDPARTY_REPO),$(ESP_HAL_3RDPARTY_VERSION))
243253
$(call CLONE, $(ESP_HAL_3RDPARTY_URL),chip/$(ESP_HAL_3RDPARTY_REPO),$(NXTMPDIR)/$(ESP_HAL_3RDPARTY_REPO))
244254
endef
255+
endif
245256
else
246257
define CLONE_ESP_HAL_3RDPARTY_REPO
247258
$(call CLONE, $(ESP_HAL_3RDPARTY_URL),chip/$(ESP_HAL_3RDPARTY_REPO))
@@ -251,8 +262,10 @@ endif
251262
chip/$(ESP_HAL_3RDPARTY_REPO):
252263
$(Q) echo "Cloning Espressif HAL for 3rd Party Platforms"
253264
$(Q) $(call CLONE_ESP_HAL_3RDPARTY_REPO)
265+
ifneq ($(USE_NXTMPDIR_ESP_REPO_DIRECTLY),y)
254266
$(Q) echo "Espressif HAL for 3rd Party Platforms: ${ESP_HAL_3RDPARTY_VERSION}"
255267
$(Q) git -C chip/$(ESP_HAL_3RDPARTY_REPO) checkout --quiet $(ESP_HAL_3RDPARTY_VERSION)
268+
endif
256269

257270
# Silent preprocessor warnings
258271

@@ -273,14 +286,18 @@ include chip/hal.mk
273286
include common/espressif/Make.defs
274287

275288
context:: chip/$(ESP_HAL_3RDPARTY_REPO)
289+
ifneq ($(USE_NXTMPDIR_ESP_REPO_DIRECTLY),y)
276290
$(Q) echo "Espressif HAL for 3rd Party Platforms: initializing submodules..."
277291
$(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
278292
$(Q) git -C chip/$(ESP_HAL_3RDPARTY_REPO)/components/mbedtls/mbedtls reset --quiet --hard
293+
endif
279294
$(Q) echo "Applying patches..."
280295
$(Q) cd chip/$(ESP_HAL_3RDPARTY_REPO)/components/mbedtls/mbedtls && git apply ../../../nuttx/patches/components/mbedtls/mbedtls/*.patch
281296
ifeq ($(CONFIG_ESPRESSIF_WIRELESS),y)
297+
ifneq ($(USE_NXTMPDIR_ESP_REPO_DIRECTLY),y)
282298
$(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
283299
endif
300+
endif
284301

285302
distclean::
286303
$(call DELDIR,chip/$(ESP_HAL_3RDPARTY_REPO))

arch/xtensa/src/esp32s2/Make.defs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,22 @@ ifndef ESP_HAL_3RDPARTY_URL
140140
ESP_HAL_3RDPARTY_URL = https://github.com/espressif/esp-hal-3rdparty.git
141141
endif
142142

143+
# When set USE_NXTMPDIR_ESP_REPO_DIRECTLY=y, will directly use esp-hal-3rdparty
144+
# under nxtmpdir without CHECK_COMMITSHA, reset, checkout and update.
145+
146+
USE_NXTMPDIR_ESP_REPO_DIRECTLY ?= n
147+
143148
ifeq ($(STORAGETMP),y)
149+
ifeq ($(USE_NXTMPDIR_ESP_REPO_DIRECTLY),y)
150+
define CLONE_ESP_HAL_3RDPARTY_REPO
151+
$(call CLONE, $(ESP_HAL_3RDPARTY_URL),chip/$(ESP_HAL_3RDPARTY_REPO),$(NXTMPDIR)/$(ESP_HAL_3RDPARTY_REPO))
152+
endef
153+
else
144154
define CLONE_ESP_HAL_3RDPARTY_REPO
145155
$(call CHECK_COMMITSHA, $(NXTMPDIR)/$(ESP_HAL_3RDPARTY_REPO),$(ESP_HAL_3RDPARTY_VERSION))
146156
$(call CLONE, $(ESP_HAL_3RDPARTY_URL),chip/$(ESP_HAL_3RDPARTY_REPO),$(NXTMPDIR)/$(ESP_HAL_3RDPARTY_REPO))
147157
endef
158+
endif
148159
else
149160
define CLONE_ESP_HAL_3RDPARTY_REPO
150161
$(call CLONE, $(ESP_HAL_3RDPARTY_URL),chip/$(ESP_HAL_3RDPARTY_REPO))
@@ -154,8 +165,10 @@ endif
154165
chip/$(ESP_HAL_3RDPARTY_REPO):
155166
$(Q) echo "Cloning Espressif HAL for 3rd Party Platforms"
156167
$(Q) $(call CLONE_ESP_HAL_3RDPARTY_REPO)
168+
ifneq ($(USE_NXTMPDIR_ESP_REPO_DIRECTLY),y)
157169
$(Q) echo "Espressif HAL for 3rd Party Platforms: ${ESP_HAL_3RDPARTY_VERSION}"
158170
$(Q) git -C chip/$(ESP_HAL_3RDPARTY_REPO) checkout --quiet $(ESP_HAL_3RDPARTY_VERSION)
171+
endif
159172

160173
# Silent preprocessor warnings
161174

@@ -174,14 +187,18 @@ include common/espressif/Make.defs
174187
include chip/Bootloader.mk
175188

176189
context:: chip/$(ESP_HAL_3RDPARTY_REPO)
190+
ifneq ($(USE_NXTMPDIR_ESP_REPO_DIRECTLY),y)
177191
$(Q) echo "Espressif HAL for 3rd Party Platforms: initializing submodules..."
178192
$(Q) git -C chip/$(ESP_HAL_3RDPARTY_REPO) submodule --quiet update --init $(GIT_DEPTH_PARAMETER) components/mbedtls/mbedtls
179193
$(Q) git -C chip/$(ESP_HAL_3RDPARTY_REPO)/components/mbedtls/mbedtls reset --quiet --hard
194+
endif
180195
$(Q) echo "Applying patches..."
181196
$(Q) cd chip/$(ESP_HAL_3RDPARTY_REPO)/components/mbedtls/mbedtls && git apply ../../../nuttx/patches/components/mbedtls/mbedtls/*.patch
182197
ifeq ($(CONFIG_ESPRESSIF_WIRELESS),y)
198+
ifneq ($(USE_NXTMPDIR_ESP_REPO_DIRECTLY),y)
183199
$(Q) git -C chip/$(ESP_HAL_3RDPARTY_REPO) submodule --quiet update --init $(GIT_DEPTH_PARAMETER) components/esp_phy/lib components/esp_wifi/lib
184200
endif
201+
endif
185202

186203
distclean::
187204
$(call DELDIR,chip/$(ESP_HAL_3RDPARTY_REPO))

arch/xtensa/src/esp32s3/Make.defs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,11 +221,22 @@ endif
221221
GIT_DEPTH_PARAMETER = --depth=$(GIT_DEPTH)
222222
endif
223223

224+
# When set USE_NXTMPDIR_ESP_REPO_DIRECTLY=y, will directly use esp-hal-3rdparty
225+
# under nxtmpdir without CHECK_COMMITSHA, reset, checkout and update.
226+
227+
USE_NXTMPDIR_ESP_REPO_DIRECTLY ?= n
228+
224229
ifeq ($(STORAGETMP),y)
230+
ifeq ($(USE_NXTMPDIR_ESP_REPO_DIRECTLY),y)
231+
define CLONE_ESP_HAL_3RDPARTY_REPO
232+
$(call CLONE, $(ESP_HAL_3RDPARTY_URL),chip/$(ESP_HAL_3RDPARTY_REPO),$(NXTMPDIR)/$(ESP_HAL_3RDPARTY_REPO))
233+
endef
234+
else
225235
define CLONE_ESP_HAL_3RDPARTY_REPO
226236
$(call CHECK_COMMITSHA, $(NXTMPDIR)/$(ESP_HAL_3RDPARTY_REPO),$(ESP_HAL_3RDPARTY_VERSION))
227237
$(call CLONE, $(ESP_HAL_3RDPARTY_URL),chip/$(ESP_HAL_3RDPARTY_REPO),$(NXTMPDIR)/$(ESP_HAL_3RDPARTY_REPO))
228238
endef
239+
endif
229240
else
230241
define CLONE_ESP_HAL_3RDPARTY_REPO
231242
$(call CLONE, $(ESP_HAL_3RDPARTY_URL),chip/$(ESP_HAL_3RDPARTY_REPO))
@@ -235,8 +246,10 @@ endif
235246
chip/$(ESP_HAL_3RDPARTY_REPO):
236247
$(Q) echo "Cloning Espressif HAL for 3rd Party Platforms"
237248
$(Q) $(call CLONE_ESP_HAL_3RDPARTY_REPO)
249+
ifneq ($(USE_NXTMPDIR_ESP_REPO_DIRECTLY),y)
238250
$(Q) echo "Espressif HAL for 3rd Party Platforms: ${ESP_HAL_3RDPARTY_VERSION}"
239251
$(Q) git -C chip/$(ESP_HAL_3RDPARTY_REPO) checkout --quiet $(ESP_HAL_3RDPARTY_VERSION)
252+
endif
240253

241254
# Silent preprocessor warnings
242255

@@ -260,14 +273,18 @@ include chip/hal.mk
260273
include common/espressif/Make.defs
261274

262275
context:: chip/$(ESP_HAL_3RDPARTY_REPO)
276+
ifneq ($(USE_NXTMPDIR_ESP_REPO_DIRECTLY),y)
263277
$(Q) echo "Espressif HAL for 3rd Party Platforms: initializing submodules..."
264278
$(Q) git -C chip/$(ESP_HAL_3RDPARTY_REPO) submodule --quiet update --init $(GIT_DEPTH_PARAMETER) components/mbedtls/mbedtls
265279
$(Q) git -C chip/$(ESP_HAL_3RDPARTY_REPO)/components/mbedtls/mbedtls reset --quiet --hard
280+
endif
266281
$(Q) echo "Applying patches..."
267282
$(Q) cd chip/$(ESP_HAL_3RDPARTY_REPO)/components/mbedtls/mbedtls && git apply ../../../nuttx/patches/components/mbedtls/mbedtls/*.patch
268283
ifeq ($(CONFIG_ESPRESSIF_WIRELESS),y)
284+
ifneq ($(USE_NXTMPDIR_ESP_REPO_DIRECTLY),y)
269285
$(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
270286
endif
287+
endif
271288

272289
distclean::
273290
$(call DELDIR,chip/$(ESP_HAL_3RDPARTY_REPO))

0 commit comments

Comments
 (0)