@@ -62,19 +62,7 @@ INC += \
62
62
-isystem esp-idf/components/bt/host/nimble/nimble/porting/nimble/include \
63
63
-isystem esp-idf/components/bt/host/nimble/nimble/porting/npl/freertos/include \
64
64
-isystem esp-idf/components/bt/host/nimble/port/include \
65
- -isystem esp-idf/components/driver/include \
66
- -isystem esp-idf/components/driver/deprecated \
67
- -isystem esp-idf/components/driver/dac/include \
68
- -isystem esp-idf/components/driver/gpio/include \
69
- -isystem esp-idf/components/driver/gptimer/include \
70
65
-isystem esp-idf/components/driver/i2c/include \
71
- -isystem esp-idf/components/driver/i2s/include \
72
- -isystem esp-idf/components/driver/$(IDF_TARGET ) /include \
73
- -isystem esp-idf/components/driver/ledc/include \
74
- -isystem esp-idf/components/driver/pcnt/include \
75
- -isystem esp-idf/components/driver/rmt/include \
76
- -isystem esp-idf/components/driver/spi/include \
77
- -isystem esp-idf/components/driver/temperature_sensor/include \
78
66
-isystem esp-idf/components/driver/touch_sensor/include \
79
67
-isystem esp-idf/components/driver/touch_sensor/$(IDF_TARGET ) /include \
80
68
-isystem esp-idf/components/driver/twai/include \
@@ -86,7 +74,21 @@ INC += \
86
74
-isystem esp-idf/components/esp_app_format/include \
87
75
-isystem esp-idf/components/esp_bootloader_format/include \
88
76
-isystem esp-idf/components/esp_common/include \
77
+ -isystem esp-idf/components/esp_driver_deprecated \
78
+ -isystem esp-idf/components/esp_driver_dac/include \
79
+ -isystem esp-idf/components/esp_driver_gpio/include \
80
+ -isystem esp-idf/components/esp_driver_gptimer/include \
81
+ -isystem esp-idf/components/esp_driver_i2c/include \
82
+ -isystem esp-idf/components/esp_driver_i2s/include \
83
+ -isystem esp-idf/components/esp_driver_$(IDF_TARGET ) /include \
84
+ -isystem esp-idf/components/esp_driver_ledc/include \
85
+ -isystem esp-idf/components/esp_driver_pcnt/include \
86
+ -isystem esp-idf/components/esp_driver_rmt/include \
87
+ -isystem esp-idf/components/esp_driver_spi/include \
88
+ -isystem esp-idf/components/esp_driver_tsens/include \
89
+ -isystem esp-idf/components/esp_driver_uart/include \
89
90
-isystem esp-idf/components/esp_event/include \
91
+ -isystem esp-idf/components/esp_hw_support/dma/include \
90
92
-isystem esp-idf/components/esp_hw_support/include \
91
93
-isystem esp-idf/components/esp_hw_support/include/soc \
92
94
-isystem esp-idf/components/esp_netif/include \
@@ -98,6 +100,7 @@ INC += \
98
100
-isystem esp-idf/components/esp_system/include \
99
101
-isystem esp-idf/components/esp_timer/include \
100
102
-isystem esp-idf/components/esp_wifi/include \
103
+ -isystem esp-idf/components/esp_wifi/include/local \
101
104
-isystem esp-idf/components/freertos/config/include \
102
105
-isystem esp-idf/components/freertos/config/include/freertos \
103
106
-isystem esp-idf/components/freertos/config/$(IDF_TARGET_ARCH ) /include \
@@ -146,6 +149,29 @@ CFLAGS += \
146
149
# This define is in FreeRTOS as tskSTACK_FILL_BYTE 0xa5U which we expand out to a full word.
147
150
CFLAGS += -DSTACK_CANARY_VALUE=0xa5a5a5a5
148
151
152
+ # IDF 5.3 uses a new ESP_SYSTEM_INIT_FN macro to "register" functions to run on
153
+ # init. They work by placing function pointers into a linker section that ends
154
+ # up as a function pointer array. To ensure the linker includes these functions,
155
+ # one must provide `-u` arguments to state the symbols are missing. This would
156
+ # normally happen implicitly by another function calling to these.
157
+ REGISTRATION_FUNCTIONS = \
158
+ -u newlib_include_pthread_impl \
159
+ -u ld_include_highint_hdl \
160
+ -u __cxx_fatal_exception \
161
+ -u esp_app_desc \
162
+ -u esp_timer_init_include_func \
163
+ -u uart_vfs_include_dev_init \
164
+ -u esp_vfs_include_console_register \
165
+ -u __ubsan_include \
166
+ -u esp_system_include_startup_funcs \
167
+ -u esp_efuse_startup_include_func \
168
+ -u newlib_include_heap_impl \
169
+ -u newlib_include_syscalls_impl \
170
+ -u newlib_include_pthread_impl \
171
+ -u newlib_include_assert_impl \
172
+ -u newlib_include_getentropy_impl \
173
+ -u newlib_include_init_funcs
174
+
149
175
# Debugging/Optimization
150
176
ifeq ($(DEBUG ) , 1)
151
177
CFLAGS += -ggdb
@@ -178,6 +204,8 @@ CFLAGS += $(INC) -Werror -Wall -std=gnu11 -Wl,--gc-sections $(BASE_CFLAGS) $(C_D
178
204
ifneq ($(IDF_TARGET ) ,esp32c6)
179
205
CFLAGS += --specs=nano.specs
180
206
LDFLAGS += -T$(IDF_TARGET).rom.newlib-nano.ld
207
+ else
208
+ LDFLAGS += -T$(IDF_TARGET).rom.newlib-normal.ld
181
209
endif
182
210
183
211
ifeq ($(IDF_TARGET_ARCH ) ,xtensa)
@@ -187,11 +215,14 @@ ifeq ($(IDF_TARGET_ARCH),xtensa)
187
215
CFLAGS += -mlongcalls -isystem esp-idf/components/xtensa/deprecated_include/ -Wno-error=cpp
188
216
else ifeq ($(IDF_TARGET_ARCH),riscv)
189
217
CFLAGS += -march=rv32imac_zicsr_zifencei
218
+ LDFLAGS += \
219
+ -Lesp-idf/components/riscv/ld \
220
+ -Trom.api.ld
190
221
endif
191
222
192
223
$(BUILD ) /lib/tlsf/tlsf.o : CFLAGS += -Wno-cast-align
193
224
194
- LDFLAGS = $(CFLAGS ) -Wl,-nostdlib -Wl,-Map=$@ .map -Wl,-cref -Wl,--undefined=uxTopUsedPriority
225
+ LDFLAGS + = $(CFLAGS ) -Wl,-nostdlib -Wl,-Map=$@ .map -Wl,-cref -Wl,--undefined=uxTopUsedPriority
195
226
196
227
LDFLAGS += \
197
228
-L$(BUILD ) /esp-idf/esp-idf/esp_system/ld \
@@ -210,20 +241,37 @@ LDFLAGS += \
210
241
211
242
ifeq ($(IDF_TARGET ) ,esp32)
212
243
LDFLAGS += \
213
- -T$(IDF_TARGET ) .rom.newlib-data.ld \
214
- -T$(IDF_TARGET ) .rom.newlib-funcs.ld \
215
- -T$(IDF_TARGET ) .rom.spiflash.ld
244
+ -Tesp32.rom.newlib-data.ld \
245
+ -Tesp32.rom.newlib-funcs.ld \
246
+ -Tesp32.rom.newlib-time.ld \
247
+ -Tesp32.rom.spiflash_legacy.ld
248
+
249
+ CHIP_COMPONENTS = \
250
+ esp_driver_dac
251
+
216
252
else ifeq ($(IDF_TARGET),esp32c2)
217
253
LDFLAGS += \
218
254
-Tesp32c2.rom.heap.ld \
219
255
-Tesp32c2.rom.newlib.ld \
220
- -Tesp32c2.rom.version.ld
256
+ -Tesp32c2.rom.version.ld \
257
+ -Tesp32c2.rom.systimer.ld \
258
+ -Tesp32c2.rom.wdt.ld
259
+
221
260
CFLAGS += -DSOC_XTAL_FREQ_MHZ=CONFIG_XTAL_FREQ
261
+
262
+ CHIP_COMPONENTS = \
263
+ esp_driver_tsens
264
+
222
265
else ifeq ($(IDF_TARGET),esp32c3)
223
266
LDFLAGS += \
224
267
-Tesp32c3.rom.newlib.ld \
268
+ -Tesp32c3.rom.newlib-time.ld \
225
269
-Tesp32c3.rom.version.ld \
226
270
-Tesp32c3.rom.eco3.ld
271
+
272
+ CHIP_COMPONENTS = \
273
+ esp_driver_tsens
274
+
227
275
else ifeq ($(IDF_TARGET),esp32c6)
228
276
LDFLAGS += \
229
277
-Tesp32c6.rom.phy.ld \
@@ -234,21 +282,43 @@ LDFLAGS += \
234
282
-Tesp32c6.rom.heap.ld \
235
283
-Tesp32c6.rom.systimer.ld \
236
284
-Tesp32c6.rom.wdt.ld
285
+
286
+
287
+ CHIP_COMPONENTS = \
288
+ esp_driver_tsens
289
+
237
290
else ifeq ($(IDF_TARGET),esp32h2)
238
291
LDFLAGS += \
239
292
-Tesp32h2.rom.heap.ld \
240
293
-Tesp32h2.rom.newlib.ld \
241
294
-Tesp32h2.rom.systimer.ld \
242
295
-Tesp32h2.rom.wdt.ld
296
+
297
+ CHIP_COMPONENTS = \
298
+ esp_driver_tsens
299
+
243
300
else ifeq ($(IDF_TARGET),esp32s2)
244
301
LDFLAGS += \
245
- -T$(IDF_TARGET ) .rom.newlib-data.ld \
246
- -T$(IDF_TARGET ) .rom.newlib-funcs.ld \
247
- -T$(IDF_TARGET ) .rom.spiflash.ld
302
+ -Tesp32s2.rom.newlib-data.ld \
303
+ -Tesp32s2.rom.newlib-funcs.ld \
304
+ -Tesp32s2.rom.newlib-time.ld \
305
+ -Tesp32s2.rom.spiflash_legacy.ld
306
+
307
+ CHIP_COMPONENTS = \
308
+ esp_driver_dac \
309
+ esp_driver_tsens
310
+
248
311
else ifeq ($(IDF_TARGET),esp32s3)
249
312
LDFLAGS += \
250
313
-Tesp32s3.rom.newlib.ld \
251
- -Tesp32s3.rom.version.ld
314
+ -Tesp32s3.rom.newlib-time.ld \
315
+ -Tesp32s3.rom.version.ld \
316
+ -Tesp32s3.rom.systimer.ld \
317
+ -Tesp32s3.rom.wdt.ld
318
+
319
+ CHIP_COMPONENTS = \
320
+ esp_driver_tsens
321
+
252
322
endif
253
323
254
324
LIBS := -lgcc -lc -lstdc++
@@ -322,13 +392,19 @@ ifneq ($(CIRCUITPY_USB_DEVICE),0)
322
392
SRC_C += lib/tinyusb/src/portable/espressif/esp32sx/dcd_esp32sx.c
323
393
endif
324
394
395
+ ifneq ($(CIRCUITPY_AUDIOBUSIO ) ,0)
396
+ CHIP_COMPONENTS += esp_driver_i2s
397
+ endif
398
+
325
399
ifneq ($(CIRCUITPY_BLEIO ) ,0)
326
400
SRC_C += common-hal/_bleio/ble_events.c
327
401
endif
328
402
329
403
ifneq ($(CIRCUITPY_DOTCLOCKFRAMEBUFFER ) ,0)
330
- CFLAGS += -isystem esp-idf/components/esp_lcd/include
331
- CFLAGS += -isystem esp-idf/components/esp_lcd/interface
404
+ CFLAGS += \
405
+ -isystem esp-idf/components/esp_lcd/include \
406
+ -isystem esp-idf/components/esp_lcd/interface \
407
+ -isystem esp-idf/components/esp_lcd/rgb/include
332
408
endif
333
409
334
410
ifneq ($(CIRCUITPY_ESPCAMERA ) ,0)
@@ -361,6 +437,30 @@ SRC_ULP := \
361
437
SRC_C += $(SRC_ULP )
362
438
endif
363
439
440
+ ifneq ($(CIRCUITPY_NEOPIXEL_WRITE ) ,0)
441
+ CHIP_COMPONENTS += esp_driver_rmt
442
+ endif
443
+
444
+ ifneq ($(CIRCUITPY_PARALLELDISPLAYBUS ) ,0)
445
+ CHIP_COMPONENTS += esp_driver_i2s
446
+ endif
447
+
448
+ ifneq ($(CIRCUITPY_PULSEIO ) ,0)
449
+ CHIP_COMPONENTS += esp_driver_rmt
450
+ endif
451
+
452
+ ifneq ($(CIRCUITPY_COUNTIO ) ,0)
453
+ CHIP_COMPONENTS += esp_driver_pcnt
454
+ endif
455
+
456
+ ifneq ($(CIRCUITPY_ROTARYIO ) ,0)
457
+ CHIP_COMPONENTS += esp_driver_pcnt
458
+ endif
459
+
460
+ ifneq ($(CIRCUITPY_FREQUENCYIO ) ,0)
461
+ CHIP_COMPONENTS += esp_driver_pcnt
462
+ endif
463
+
364
464
SRC_COMMON_HAL_EXPANDED = \
365
465
$(addprefix shared-bindings/, $(SRC_COMMON_HAL ) ) \
366
466
$(addprefix shared-bindings/, $(SRC_BINDINGS_ENUMS ) ) \
@@ -490,7 +590,7 @@ ifeq ($(IDF_TARGET),esp32)
490
590
BINARY_BLOBS += esp-idf/components/esp_phy/lib/$(IDF_TARGET ) /librtc.a
491
591
endif
492
592
493
- 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
593
+ ESP_IDF_COMPONENTS_LINK = $(IDF_TARGET_ARCH ) $( CHIP_COMPONENTS ) app_update bootloader_support driver esp_driver_gpio esp_driver_gptimer esp_driver_ledc esp_driver_spi esp_driver_uart 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 esp_vfs_console
494
594
ifneq ($(CIRCUITPY_WIFI ) ,0)
495
595
ESP_IDF_COMPONENTS_LINK += esp_coex esp_netif esp-tls esp_wifi lwip mbedtls mdns wpa_supplicant
496
596
endif
@@ -507,7 +607,7 @@ ifneq ($(CIRCUITPY_BLEIO),0)
507
607
ifeq ($(BLE_IMPL),esp32)
508
608
# BLE will hang the ESP32 and trigger an interrupt watchdog without this undefined symbol at
509
609
# link because a weak version of the interrupt that BLE uses will be linked incorrectly.
510
- LDFLAGS += -u ld_include_hli_vectors_bt
610
+ REGISTRATION_FUNCTIONS += -u ld_include_hli_vectors_bt
511
611
BINARY_BLOBS += esp-idf/components/bt/controller/lib_esp32/$(IDF_TARGET)/libbtdm_app.a
512
612
endif
513
613
@@ -619,7 +719,7 @@ esp-idf-stamp: $(BUILD)/esp-idf/config/sdkconfig.h
619
719
620
720
$(BUILD ) /firmware.elf : $(OBJ ) | esp-idf-stamp $(IDF_CMAKE_TARGETS )
621
721
$(STEPECHO ) " LINK $@ "
622
- $(Q )$(CC ) -o $@ $(LDFLAGS ) $^ -Wl,--print-memory-usage -Wl,--start-group $(ESP_IDF_COMPONENTS_EXPANDED ) $(BINARY_BLOBS ) $(MBEDTLS_COMPONENTS_LINK_EXPANDED ) $(LIBS ) -Wl,--end-group -u newlib_include_pthread_impl -u ld_include_highint_hdl -u __cxx_fatal_exception -u esp_app_desc
722
+ $(Q )$(CC ) -o $@ $(LDFLAGS ) $^ -Wl,--print-memory-usage -Wl,--start-group $(ESP_IDF_COMPONENTS_EXPANDED ) $(BINARY_BLOBS ) $(MBEDTLS_COMPONENTS_LINK_EXPANDED ) $(LIBS ) -Wl,--end-group $( REGISTRATION_FUNCTIONS )
623
723
624
724
$(BUILD ) /circuitpython-firmware.bin : $(BUILD ) /firmware.elf | tools/build_memory_info.py
625
725
$(STEPECHO ) " Create $@ "
0 commit comments