@@ -27,11 +27,23 @@ include ../../py/circuitpy_mkenv.mk
27
27
ifeq ($(IDF_TARGET ) ,esp32c3)
28
28
IDF_TARGET_ARCH = riscv
29
29
CROSS_COMPILE = riscv32-esp-elf-
30
+ else ifeq ($(IDF_TARGET),esp32c6)
31
+ IDF_TARGET_ARCH = riscv
32
+ CROSS_COMPILE = riscv32-esp-elf-
33
+ else ifeq ($(IDF_TARGET),esp32h2)
34
+ IDF_TARGET_ARCH = riscv
35
+ CROSS_COMPILE = riscv32-esp-elf-
30
36
else
31
37
IDF_TARGET_ARCH = xtensa
32
38
CROSS_COMPILE = xtensa-$(IDF_TARGET ) -elf-
33
39
endif
34
40
41
+ ifeq ($(IDF_TARGET ) ,esp32s3)
42
+ BT_IDF_TARGET = esp32c3
43
+ else
44
+ BT_IDF_TARGET = $(IDF_TARGET )
45
+ endif
46
+
35
47
# ######################################
36
48
# CFLAGS
37
49
# ######################################
@@ -52,23 +64,35 @@ INC += \
52
64
-isystem esp-idf/components/app_update/include \
53
65
-isystem esp-idf/components/bootloader_support/include \
54
66
-isystem esp-idf/components/bootloader_support/bootloader_flash/include \
55
- -isystem esp-idf/components/bt/include/$(IDF_TARGET ) /include \
67
+ -isystem esp-idf/components/bt/include/$(BT_IDF_TARGET ) /include \
56
68
-isystem esp-idf/components/bt/host/nimble/esp-hci/include \
57
69
-isystem esp-idf/components/bt/host/nimble/nimble/nimble/controller/include \
58
70
-isystem esp-idf/components/bt/host/nimble/nimble/nimble/host/include \
59
71
-isystem esp-idf/components/bt/host/nimble/nimble/nimble/host/services/gap/include \
60
72
-isystem esp-idf/components/bt/host/nimble/nimble/nimble/include \
61
73
-isystem esp-idf/components/bt/host/nimble/nimble/nimble/host/util/include \
74
+ -isystem esp-idf/components/bt/host/nimble/nimble/nimble/transport/include \
62
75
-isystem esp-idf/components/bt/host/nimble/nimble/porting/nimble/include \
63
76
-isystem esp-idf/components/bt/host/nimble/nimble/porting/npl/freertos/include \
64
77
-isystem esp-idf/components/bt/host/nimble/port/include \
65
78
-isystem esp-idf/components/driver/include \
66
79
-isystem esp-idf/components/driver/deprecated \
80
+ -isystem esp-idf/components/driver/dac/include \
81
+ -isystem esp-idf/components/driver/gpio/include \
82
+ -isystem esp-idf/components/driver/i2c/include \
83
+ -isystem esp-idf/components/driver/i2s/include \
67
84
-isystem esp-idf/components/driver/$(IDF_TARGET ) /include \
85
+ -isystem esp-idf/components/driver/ledc/include \
86
+ -isystem esp-idf/components/driver/spi/include \
87
+ -isystem esp-idf/components/driver/temperature_sensor/include \
88
+ -isystem esp-idf/components/driver/touch_sensor/include \
89
+ -isystem esp-idf/components/driver/touch_sensor/$(IDF_TARGET ) /include \
90
+ -isystem esp-idf/components/driver/twai/include \
68
91
-isystem esp-idf/components/efuse/include \
69
92
-isystem esp-idf/components/efuse/$(IDF_TARGET ) /include \
70
93
-isystem esp-idf/components/$(IDF_TARGET ) /include \
71
- -isystem esp-idf/components/esp_adc/deprecated/include \
94
+ -isystem esp-idf/components/esp_adc/include \
95
+ -isystem esp-idf/components/esp_adc/$(IDF_TARGET ) /include \
72
96
-isystem esp-idf/components/esp_app_format/include \
73
97
-isystem esp-idf/components/esp_common/include \
74
98
-isystem esp-idf/components/esp_event/include \
@@ -85,6 +109,7 @@ INC += \
85
109
-isystem esp-idf/components/esp_wifi/include \
86
110
-isystem esp-idf/components/freertos/esp_additions/include \
87
111
-isystem esp-idf/components/freertos/esp_additions/include/freertos \
112
+ -isystem esp-idf/components/freertos/esp_additions/arch/$(IDF_TARGET_ARCH ) /include \
88
113
-isystem esp-idf/components/freertos/FreeRTOS-Kernel/include \
89
114
-isystem esp-idf/components/freertos/FreeRTOS-Kernel/include/freertos \
90
115
-isystem esp-idf/components/freertos/FreeRTOS-Kernel/portable/$(IDF_TARGET_ARCH ) /include \
@@ -95,7 +120,9 @@ INC += \
95
120
-isystem esp-idf/components/log/include \
96
121
-isystem esp-idf/components/lwip/include \
97
122
-isystem esp-idf/components/lwip/lwip/src/include \
98
- -isystem esp-idf/components/lwip/port/esp32/include \
123
+ -isystem esp-idf/components/lwip/port/include \
124
+ -isystem esp-idf/components/lwip/port/esp32xx/include \
125
+ -isystem esp-idf/components/lwip/port/freertos/include \
99
126
-isystem esp-idf/components/mbedtls/esp_crt_bundle/include \
100
127
-isystem esp-idf/components/mbedtls/mbedtls/include \
101
128
-isystem esp-idf/components/mbedtls/port/include \
@@ -153,12 +180,13 @@ CFLAGS += $(INC) -Werror -Wall -std=gnu11 -Wl,--gc-sections $(BASE_CFLAGS) $(C_D
153
180
# Most current ESPs have nano versions of newlib in ROM so we use them.
154
181
ifneq ($(IDF_TARGET ) ,esp32c6)
155
182
CFLAGS += --specs=nano.specs
183
+ LDFLAGS += -T$(IDF_TARGET).rom.newlib-nano.ld
156
184
endif
157
185
158
186
ifeq ($(IDF_TARGET_ARCH ) ,xtensa)
159
187
CFLAGS += -mlongcalls
160
188
else ifeq ($(IDF_TARGET_ARCH),riscv)
161
- CFLAGS += -march=rv32imc
189
+ CFLAGS += -march=rv32imac_zicsr_zifencei
162
190
endif
163
191
164
192
LDFLAGS = $(CFLAGS ) -Wl,-nostdlib -Wl,-Map=$@ .map -Wl,-cref -Wl,--undefined=uxTopUsedPriority
@@ -173,7 +201,6 @@ LDFLAGS += \
173
201
-T$(IDF_TARGET ) .rom.ld \
174
202
-T$(IDF_TARGET ) .rom.api.ld \
175
203
-T$(IDF_TARGET ) .rom.libgcc.ld \
176
- -T$(IDF_TARGET ) .rom.newlib-nano.ld \
177
204
-Wl,-Bstatic \
178
205
-Wl,--no-warn-mismatch \
179
206
-Wl,--build-id=none \
@@ -189,6 +216,20 @@ LDFLAGS += \
189
216
-Tesp32c3.rom.newlib.ld \
190
217
-Tesp32c3.rom.version.ld \
191
218
-Tesp32c3.rom.eco3.ld
219
+ else ifeq ($(IDF_TARGET),esp32c6)
220
+ LDFLAGS += \
221
+ -Tesp32c6.rom.phy.ld \
222
+ -Tesp32c6.rom.pp.ld \
223
+ -Tesp32c6.rom.net80211.ld \
224
+ -Tesp32c6.rom.newlib.ld \
225
+ -Tesp32c6.rom.coexist.ld \
226
+ -Tesp32c6.rom.heap.ld \
227
+ -Tesp32c6.rom.wdt.ld
228
+ else ifeq ($(IDF_TARGET),esp32h2)
229
+ LDFLAGS += \
230
+ -Tesp32h2.rom.heap.ld \
231
+ -Tesp32h2.rom.newlib.ld \
232
+ -Tesp32h2.rom.wdt.ld
192
233
else ifeq ($(IDF_TARGET),esp32s2)
193
234
LDFLAGS += \
194
235
-T$(IDF_TARGET ) .rom.newlib-data.ld \
@@ -203,7 +244,7 @@ endif
203
244
LIBS := -lgcc -lc -lstdc++
204
245
205
246
# Use toolchain libm if we're not using our own.
206
- ifndef INTERNAL_LIBM
247
+ ifneq ( $( INTERNAL_LIBM ) ,1)
207
248
LIBS += -lm
208
249
endif
209
250
@@ -243,12 +284,16 @@ SRC_C += \
243
284
244
285
SRC_C += $(wildcard common-hal/espidf/* .c)
245
286
246
- ifeq ($(IDF_TARGET ) ,esp32c3 )
287
+ ifneq ($(CIRCUITPY_ESP_USB_SERIAL_JTAG ) ,0 )
247
288
SRC_C += supervisor/usb_serial_jtag.c
248
- else
249
- SRC_C += \
250
- peripherals/pcnt.c \
251
- peripherals/touch.c
289
+ endif
290
+
291
+ ifneq ($(CIRCUITPY_COUNTIO ) ,0)
292
+ SRC_C += peripherals/pcnt.c
293
+ endif
294
+
295
+ ifneq ($(CIRCUITPY_TOUCHIO_USE_NATIVE ) ,0)
296
+ SRC_C += peripherals/touch.c
252
297
endif
253
298
254
299
ifneq ($(CIRCUITPY_USB ) ,0)
@@ -408,21 +453,42 @@ update-all-sdkconfigs: $(BUILD)/esp-idf/config/sdkconfig.h
408
453
update-board-sdkconfig : $(BUILD ) /esp-idf/config/sdkconfig.h
409
454
python tools/update_sdkconfig.py --board=$(BOARD ) --debug=$(DEBUG )
410
455
411
- BINARY_WIFI_BLOBS = libcoexist.a libcore.a libespnow.a libmesh.a libnet80211.a libpp.a libsmartconfig.a libwapi.a
412
- BINARY_BLOBS = esp-idf/components/esp_phy/lib/$(IDF_TARGET ) /libphy.a $(addprefix esp-idf/components/esp_wifi/lib/$(IDF_TARGET ) /, $(BINARY_WIFI_BLOBS ) )
456
+ BINARY_WIFI_BLOBS = libcore.a libespnow.a libmesh.a libnet80211.a libpp.a libsmartconfig.a libwapi.a
457
+ BINARY_BLOBS = esp-idf/components/esp_phy/lib/$(IDF_TARGET ) /libphy.a
458
+ ifneq ($(CIRCUITPY_WIFI ) ,0)
459
+ BINARY_BLOBS += esp-idf/components/esp_coex/lib/$(IDF_TARGET)/libcoexist.a $(addprefix esp-idf/components/esp_wifi/lib/$(IDF_TARGET)/, $(BINARY_WIFI_BLOBS))
460
+ endif
413
461
ifeq ($(IDF_TARGET ) ,esp32)
414
462
BINARY_BLOBS += esp-idf/components/esp_phy/lib/$(IDF_TARGET ) /librtc.a
415
463
endif
416
464
417
- ESP_IDF_COMPONENTS_LINK = $(IDF_TARGET_ARCH ) app_update bootloader_support driver efuse esp_adc esp_app_format esp_common esp_event esp_hw_support esp_netif esp_partition esp_phy esp_pm esp_ringbuf esp_rom esp_system esp_timer esp-tls esp_wifi freertos hal heap log lwip mbedtls mdns newlib nvs_flash pthread soc spi_flash vfs wpa_supplicant
465
+ ESP_IDF_COMPONENTS_LINK = $(IDF_TARGET_ARCH ) app_update bootloader_support driver efuse esp_adc esp_app_format esp_common esp_event esp_hw_support esp_mm esp_partition esp_phy esp_pm esp_ringbuf esp_rom esp_system esp_timer freertos hal heap log newlib nvs_flash pthread soc spi_flash vfs
466
+ ifneq ($(CIRCUITPY_WIFI ) ,0)
467
+ ESP_IDF_COMPONENTS_LINK += esp_coex esp_netif esp-tls esp_wifi lwip mbedtls mdns wpa_supplicant
468
+ endif
418
469
ifneq ($(CIRCUITPY_BLEIO ) ,0)
470
+ BLE_IMPL_esp32 := esp32
471
+ BLE_IMPL_esp32s3 := esp32c3
472
+ BLE_IMPL_esp32c2 := libble
473
+ BLE_IMPL_esp32c3 := esp32c3
474
+ BLE_IMPL_esp32c6 := libble
475
+ BLE_IMPL_esp32h2 := libble
476
+ BLE_IMPL = $(BLE_IMPL_$(IDF_TARGET))
477
+
419
478
ESP_IDF_COMPONENTS_LINK += bt
420
- ifeq ($(IDF_TARGET),esp32)
421
- BINARY_BLOBS += esp-idf/components/bt/controller/lib_esp32/$(IDF_TARGET)/libbtdm_app.a
422
- else
479
+ ifeq ($(BLE_IMPL),esp32)
480
+ BINARY_BLOBS += esp-idf/components/bt/controller/lib_esp32/$(IDF_TARGET)/libbtdm_app.a
481
+ endif
482
+
483
+ ifeq ($(BLE_IMPL),esp32c3)
423
484
BINARY_BLOBS += esp-idf/components/esp_phy/lib/$(IDF_TARGET)/libbtbb.a \
424
485
esp-idf/components/bt/controller/lib_esp32c3_family/$(IDF_TARGET)/libbtdm_app.a
425
486
endif
487
+
488
+ ifeq ($(BLE_IMPL),libble)
489
+ BINARY_BLOBS += esp-idf/components/esp_phy/lib/$(IDF_TARGET)/libbtbb.a \
490
+ esp-idf/components/bt/controller/lib_$(IDF_TARGET)/$(IDF_TARGET)-bt-lib/libble_app.a
491
+ endif
426
492
endif
427
493
ifneq ($(CIRCUITPY_ESPULP ) ,0)
428
494
ESP_IDF_COMPONENTS_LINK += ulp
@@ -450,11 +516,16 @@ ESP_IDF_COMPONENTS_EXPANDED += $(BUILD)/esp-idf/esp-idf/esp-camera/libesp-camera
450
516
endif
451
517
452
518
ifneq ($(VALID_BOARD ) ,)
519
+ # From esp-idf/components/bootloader/Kconfig.projbuild
453
520
# BOOTLOADER_OFFSET is determined by chip type, based on the ROM bootloader, and is not changeable.
454
521
ifeq ($(IDF_TARGET ) ,esp32)
455
522
BOOTLOADER_OFFSET = 0x1000
523
+ else ifeq ($(IDF_TARGET),esp32h2)
524
+ BOOTLOADER_OFFSET = 0x0
456
525
else ifeq ($(IDF_TARGET),esp32c3)
457
526
BOOTLOADER_OFFSET = 0x0
527
+ else ifeq ($(IDF_TARGET),esp32c6)
528
+ BOOTLOADER_OFFSET = 0x0
458
529
else ifeq ($(IDF_TARGET),esp32s3)
459
530
BOOTLOADER_OFFSET = 0x0
460
531
else ifeq ($(IDF_TARGET),esp32s2)
0 commit comments