Skip to content

Commit 4e14e5b

Browse files
committed
arch/xtensa/esp32[-s2|-s3]: Modify the method of downloading the repository
Add one permission config `CONFIG_ALLOW_DOWNLOADS` to set allow the NuttX build system to automatically download external packages from the Internet. 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. Currently, adaptation has only been done for ESP, so the `ARCH_CHIP_ESP` conditional check has been added. Signed-off-by: v-tangmeng <[email protected]>
1 parent be413af commit 4e14e5b

File tree

8 files changed

+50
-0
lines changed

8 files changed

+50
-0
lines changed

Kconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,13 @@ config APPS_DIR
264264
example, to include makefile fragments (e.g., .config or Make.defs)
265265
or to set up include file paths.
266266

267+
config ALLOW_DOWNLOADS
268+
bool "Allow the NuttX build system to automatically download external packages from the Internet"
269+
---help---
270+
This will allow to automatically download external packages from the Internet.
271+
If not set, the developer will need to provide external packages manually. If
272+
a necessary package cannot be found, an error will occur and the build will be aborted.
273+
267274
config BASE_DEFCONFIG
268275
string "Base Configuration"
269276
default ""

arch/risc-v/Kconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ config ARCH_CHIP_ESP32C3
9090
select ARCH_HAVE_PERF_EVENTS
9191
select ARCH_HAVE_DEBUG
9292
select ARCH_HAVE_RAMFUNCS
93+
select ALLOW_DOWNLOADS
9394
---help---
9495
Espressif ESP32-C3 (RV32IMC).
9596

@@ -121,6 +122,7 @@ config ARCH_CHIP_ESP32C3_GENERIC
121122
select ARCH_CHIP_ESPRESSIF
122123
select ARCH_HAVE_DEBUG
123124
select ARCH_HAVE_RAMFUNCS
125+
select ALLOW_DOWNLOADS
124126
---help---
125127
ESP32-C3 chip with a single RISC-V IMC core, no embedded Flash memory
126128

@@ -152,6 +154,7 @@ config ARCH_CHIP_ESP32C6
152154
select ESPRESSIF_SOC_RTC_MEM_SUPPORTED
153155
select ARCH_CHIP_ESPRESSIF
154156
select ARCH_HAVE_RAMFUNCS
157+
select ALLOW_DOWNLOADS
155158
---help---
156159
Espressif ESP32-C6 (RV32IMAC).
157160

@@ -182,6 +185,7 @@ config ARCH_CHIP_ESP32H2
182185
select ESPRESSIF_SOC_RTC_MEM_SUPPORTED
183186
select ARCH_CHIP_ESPRESSIF
184187
select ARCH_HAVE_RAMFUNCS
188+
select ALLOW_DOWNLOADS
185189
---help---
186190
Espressif ESP32-H2 (RV32IMC).
187191

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
#
2121
############################################################################
2222

23+
ifeq ($(CONFIG_ALLOW_DOWNLOADS),y)
2324
STORAGETMP = $(if $(wildcard $(NXTMPDIR)/.*),y,)
25+
endif
2426

2527
# The start-up, "head", file. May be either a .S or a .c file.
2628

@@ -193,6 +195,7 @@ endif
193195

194196
# Fetch source files and add them to build
195197

198+
ifeq ($(CONFIG_ALLOW_DOWNLOADS),y)
196199
ESP_HAL_3RDPARTY_REPO = esp-hal-3rdparty
197200
ifndef ESP_HAL_3RDPARTY_VERSION
198201
ESP_HAL_3RDPARTY_VERSION = 84efb531f4cdf3162e91652357cac6a0be8dd73e
@@ -233,6 +236,7 @@ ifeq ($(CONFIG_ESP_WIRELESS),y)
233236
$(Q) echo "Applying patches..."
234237
$(Q) cd chip/$(ESP_HAL_3RDPARTY_REPO)/components/mbedtls/mbedtls && git apply ../../../nuttx/patches/components/mbedtls/mbedtls/*.patch
235238
endif
239+
endif
236240

237241
include common$(DELIM)espressif$(DELIM)Bootloader.mk
238242

@@ -258,7 +262,9 @@ distclean::
258262
$(call DELFILE,../include/chip/gpio_sig_map.h)
259263
$(call DELFILE,../include/chip/irq.h)
260264
$(call DELFILE,../../../vefuse.bin)
265+
ifeq ($(CONFIG_ALLOW_DOWNLOADS),y)
261266
$(call DELDIR,chip/$(ESP_HAL_3RDPARTY_REPO))
267+
endif
262268
ifeq ($(CONFIG_ESPRESSIF_USE_LP_CORE),y)
263269
$(call DELDIR,chip/ulp)
264270
endif

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222

2323
include common/Make.defs
2424

25+
ifeq ($(CONFIG_ALLOW_DOWNLOADS),y)
2526
STORAGETMP = $(if $(wildcard $(NXTMPDIR)/.*),y,)
27+
endif
2628

2729
# Specify our HEAD assembly file. This will be linked as
2830
# the first object file, so it will appear at address 0
@@ -239,6 +241,7 @@ endif
239241

240242
# Fetch source files and add them to build
241243

244+
ifeq ($(CONFIG_ALLOW_DOWNLOADS),y)
242245
ESP_HAL_3RDPARTY_REPO = esp-hal-3rdparty
243246
ifndef ESP_HAL_3RDPARTY_VERSION
244247
ESP_HAL_3RDPARTY_VERSION = e3899a2324c8e326db20f99f208e890fdd7a5b92
@@ -264,6 +267,7 @@ chip/$(ESP_HAL_3RDPARTY_REPO):
264267
$(Q) $(call CLONE_ESP_HAL_3RDPARTY_REPO)
265268
$(Q) echo "Espressif HAL for 3rd Party Platforms: ${ESP_HAL_3RDPARTY_VERSION}"
266269
$(Q) git -C chip/$(ESP_HAL_3RDPARTY_REPO) checkout --quiet $(ESP_HAL_3RDPARTY_VERSION)
270+
endif
267271

268272
# Silent preprocessor warnings
269273

@@ -272,4 +276,6 @@ CFLAGS += -Wno-undef -Wno-unused-variable
272276
include chip/Bootloader.mk
273277

274278
distclean::
279+
ifeq ($(CONFIG_ALLOW_DOWNLOADS),y)
275280
$(call DELDIR,chip/$(ESP_HAL_3RDPARTY_REPO))
281+
endif

arch/xtensa/Kconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ config ARCH_CHIP_ESP32
2222
select ARCH_HAVE_TESTSET
2323
select ARCH_HAVE_TEXT_HEAP
2424
select ARCH_VECNOTIRQ
25+
select ALLOW_DOWNLOADS
2526
select LIBC_PREVENT_STRING_KERNEL
2627
select LIBC_ARCH_MEMCPY if BUILD_FLAT
2728
select LIBC_ARCH_MEMCHR if BUILD_FLAT
@@ -68,6 +69,7 @@ config ARCH_CHIP_ESP32S2
6869
select LIBC_ARCH_STRNCPY
6970
select LIBC_ARCH_STRLEN
7071
select LIBC_ARCH_STRNLEN
72+
select ALLOW_DOWNLOADS
7173
---help---
7274
ESP32-S2 is a truly secure, highly integrated, low-power, 2.4 GHz Wi-Fi
7375
Microcontroller SoC supporting Wi-Fi HT40 and having 43 GPIOs.
@@ -92,6 +94,7 @@ config ARCH_CHIP_ESP32S3
9294
select ARCH_DCACHE
9395
select ARCH_ICACHE
9496
select ARCH_VECNOTIRQ
97+
select ALLOW_DOWNLOADS
9598
select LIBC_PREVENT_STRING_KERNEL
9699
select LIBC_ARCH_MEMCPY if BUILD_FLAT
97100
select LIBC_ARCH_MEMCHR if BUILD_FLAT

arch/xtensa/src/esp32/Make.defs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020

2121
include common/Make.defs
2222

23+
ifeq ($(CONFIG_ALLOW_DOWNLOADS),y)
2324
STORAGETMP = $(if $(wildcard $(NXTMPDIR)/.*),y,)
25+
endif
2426

2527
# The start-up, "head", file. May be either a .S or a .c file.
2628

@@ -221,6 +223,7 @@ endif
221223

222224
# Fetch source files and add them to build
223225

226+
ifeq ($(CONFIG_ALLOW_DOWNLOADS),y)
224227
ESP_HAL_3RDPARTY_REPO = esp-hal-3rdparty
225228
ifndef ESP_HAL_3RDPARTY_VERSION
226229
ESP_HAL_3RDPARTY_VERSION = b6fa6c9098318007a61acc7c9f0f180443bb80c2
@@ -253,6 +256,7 @@ chip/$(ESP_HAL_3RDPARTY_REPO):
253256
$(Q) $(call CLONE_ESP_HAL_3RDPARTY_REPO)
254257
$(Q) echo "Espressif HAL for 3rd Party Platforms: ${ESP_HAL_3RDPARTY_VERSION}"
255258
$(Q) git -C chip/$(ESP_HAL_3RDPARTY_REPO) checkout --quiet $(ESP_HAL_3RDPARTY_VERSION)
259+
endif # CONFIG_ALLOW_DOWNLOADS
256260

257261
# Silent preprocessor warnings
258262

@@ -272,6 +276,7 @@ include chip/hal.mk
272276

273277
include common/espressif/Make.defs
274278

279+
ifeq ($(CONFIG_ALLOW_DOWNLOADS),y)
275280
context:: chip/$(ESP_HAL_3RDPARTY_REPO)
276281
$(Q) echo "Espressif HAL for 3rd Party Platforms: initializing submodules..."
277282
$(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
@@ -281,9 +286,12 @@ context:: chip/$(ESP_HAL_3RDPARTY_REPO)
281286
ifeq ($(CONFIG_ESPRESSIF_WIRELESS),y)
282287
$(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
283288
endif
289+
endif
284290

285291
distclean::
292+
ifeq ($(CONFIG_ALLOW_DOWNLOADS),y)
286293
$(call DELDIR,chip/$(ESP_HAL_3RDPARTY_REPO))
294+
endif
287295
$(call DELFILE,../../../vefuse.bin)
288296

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

arch/xtensa/src/esp32s2/Make.defs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020

2121
include common/Make.defs
2222

23+
ifeq ($(CONFIG_ALLOW_DOWNLOADS),y)
2324
STORAGETMP = $(if $(wildcard $(NXTMPDIR)/.*),y,)
25+
endif
2426

2527
# The start-up, "head", file. May be either a .S or a .c file.
2628

@@ -131,6 +133,7 @@ endif
131133

132134
# Fetch source files and add them to build
133135

136+
ifeq ($(CONFIG_ALLOW_DOWNLOADS),y)
134137
ESP_HAL_3RDPARTY_REPO = esp-hal-3rdparty
135138
ifndef ESP_HAL_3RDPARTY_VERSION
136139
ESP_HAL_3RDPARTY_VERSION = 6782de1b073f93a54c501edf23d99a42a23d41ac
@@ -156,6 +159,7 @@ chip/$(ESP_HAL_3RDPARTY_REPO):
156159
$(Q) $(call CLONE_ESP_HAL_3RDPARTY_REPO)
157160
$(Q) echo "Espressif HAL for 3rd Party Platforms: ${ESP_HAL_3RDPARTY_VERSION}"
158161
$(Q) git -C chip/$(ESP_HAL_3RDPARTY_REPO) checkout --quiet $(ESP_HAL_3RDPARTY_VERSION)
162+
endif # CONFIG_ALLOW_DOWNLOADS
159163

160164
# Silent preprocessor warnings
161165

@@ -173,6 +177,7 @@ include common/espressif/Make.defs
173177

174178
include chip/Bootloader.mk
175179

180+
ifeq ($(CONFIG_ALLOW_DOWNLOADS),y)
176181
context:: chip/$(ESP_HAL_3RDPARTY_REPO)
177182
$(Q) echo "Espressif HAL for 3rd Party Platforms: initializing submodules..."
178183
$(Q) git -C chip/$(ESP_HAL_3RDPARTY_REPO) submodule --quiet update --init $(GIT_DEPTH_PARAMETER) components/mbedtls/mbedtls
@@ -182,7 +187,10 @@ context:: chip/$(ESP_HAL_3RDPARTY_REPO)
182187
ifeq ($(CONFIG_ESPRESSIF_WIRELESS),y)
183188
$(Q) git -C chip/$(ESP_HAL_3RDPARTY_REPO) submodule --quiet update --init $(GIT_DEPTH_PARAMETER) components/esp_phy/lib components/esp_wifi/lib
184189
endif
190+
endif
185191

186192
distclean::
193+
ifeq ($(CONFIG_ALLOW_DOWNLOADS),y)
187194
$(call DELDIR,chip/$(ESP_HAL_3RDPARTY_REPO))
195+
endif
188196
$(call DELFILE,../../../vefuse.bin)

arch/xtensa/src/esp32s3/Make.defs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020

2121
include common/Make.defs
2222

23+
ifeq ($(CONFIG_ALLOW_DOWNLOADS),y)
2324
STORAGETMP = $(if $(wildcard $(NXTMPDIR)/.*),y,)
25+
endif
2426

2527
# The start-up, "head", file. May be either a .S or a .c file.
2628

@@ -205,6 +207,7 @@ endif
205207

206208
# Fetch source files and add them to build
207209

210+
ifeq ($(CONFIG_ALLOW_DOWNLOADS),y)
208211
ESP_HAL_3RDPARTY_REPO = esp-hal-3rdparty
209212
ifndef ESP_HAL_3RDPARTY_VERSION
210213
ESP_HAL_3RDPARTY_VERSION = 6782de1b073f93a54c501edf23d99a42a23d41ac
@@ -237,6 +240,7 @@ chip/$(ESP_HAL_3RDPARTY_REPO):
237240
$(Q) $(call CLONE_ESP_HAL_3RDPARTY_REPO)
238241
$(Q) echo "Espressif HAL for 3rd Party Platforms: ${ESP_HAL_3RDPARTY_VERSION}"
239242
$(Q) git -C chip/$(ESP_HAL_3RDPARTY_REPO) checkout --quiet $(ESP_HAL_3RDPARTY_VERSION)
243+
endif # CONFIG_ALLOW_DOWNLOADS
240244

241245
# Silent preprocessor warnings
242246

@@ -259,6 +263,7 @@ include chip/hal.mk
259263

260264
include common/espressif/Make.defs
261265

266+
ifeq ($(CONFIG_ALLOW_DOWNLOADS),y)
262267
context:: chip/$(ESP_HAL_3RDPARTY_REPO)
263268
$(Q) echo "Espressif HAL for 3rd Party Platforms: initializing submodules..."
264269
$(Q) git -C chip/$(ESP_HAL_3RDPARTY_REPO) submodule --quiet update --init $(GIT_DEPTH_PARAMETER) components/mbedtls/mbedtls
@@ -268,7 +273,10 @@ context:: chip/$(ESP_HAL_3RDPARTY_REPO)
268273
ifeq ($(CONFIG_ESPRESSIF_WIRELESS),y)
269274
$(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
270275
endif
276+
endif
271277

272278
distclean::
279+
ifeq ($(CONFIG_ALLOW_DOWNLOADS),y)
273280
$(call DELDIR,chip/$(ESP_HAL_3RDPARTY_REPO))
281+
endif
274282
$(call DELFILE,../../../vefuse.bin)

0 commit comments

Comments
 (0)