@@ -77,6 +77,7 @@ INC += \
7777 -isystem esp-idf/components/esp_event/include \
7878 -isystem esp-idf/components/esp_hw_support/include \
7979 -isystem esp-idf/components/esp_hw_support/include/soc \
80+ -isystem esp-idf/components/esp_hw_support/port/$(IDF_TARGET ) /private_include \
8081 -isystem esp-idf/components/esp_hw_support/etm/include \
8182 -isystem esp-idf/components/esp_mm/include \
8283 -isystem esp-idf/components/esp_netif/include \
@@ -126,7 +127,12 @@ INC += \
126127 -isystem esp-idf/components/esp_hal_lcd/include \
127128 -isystem esp-idf/components/esp_hal_lcd/$(IDF_TARGET ) /include \
128129 -isystem esp-idf/components/esp_hal_usb/include \
130+ -isystem esp-idf/components/esp_hal_usb/$(IDF_TARGET ) /include \
129131 -isystem esp-idf/components/esp_hal_parlio/include \
132+ -isystem esp-idf/components/esp_hal_pmu/include \
133+ -isystem esp-idf/components/esp_hal_pmu/$(IDF_TARGET ) /include \
134+ -isystem esp-idf/components/esp_hal_wdt/include \
135+ -isystem esp-idf/components/esp_hal_wdt/$(IDF_TARGET ) /include \
130136 -isystem esp-idf/components/esp_hal_security/include \
131137 -isystem esp-idf/components/heap/include \
132138 -isystem esp-idf/components/log/include \
@@ -225,7 +231,7 @@ endif
225231# option to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk
226232CFLAGS += $(OPTIMIZATION_FLAGS )
227233
228- CFLAGS += $(INC ) -Werror -Wall -std=gnu11 -Wl,--gc-sections $(BASE_CFLAGS ) $(C_DEFS ) $(CFLAGS_MOD ) $(COPT ) -Werror=missing-prototypes -Werror=old-style-definition
234+ CFLAGS += $(INC ) -Werror -Wall -std=gnu11 -Wl,--gc-sections $(BASE_CFLAGS ) $(C_DEFS ) $(CFLAGS_MOD ) $(COPT ) -Werror=missing-prototypes -Werror=old-style-definition -Wno-error=cpp -Wno-cpp
229235
230236# ESP-IDF v6.0 uses picolibc instead of newlib.
231237CFLAGS += --specs=picolibc.specs
@@ -237,7 +243,7 @@ ifeq ($(IDF_TARGET_ARCH),xtensa)
237243# Remove the last two flags once TinyUSB is updated with the `#include <xtensa_api.h>` instead of
238244# `#include "xtensa/xtensa_api.h"`.
239245
240- CFLAGS += -mlongcalls -isystem esp-idf/components/xtensa/deprecated_include/ -Wno-error=cpp
246+ CFLAGS += -mlongcalls -isystem esp-idf/components/xtensa/deprecated_include/
241247 CFLAGS += -DMICROPY_GCREGS_SETJMP=1
242248
243249# Wrap longjmp with a patched version that protects register window update with a critical section
@@ -261,12 +267,13 @@ else ifeq ($(IDF_TARGET_ARCH),riscv)
261267endif
262268
263269
264- LDFLAGS += $(CFLAGS ) -Wl,-nostdlib -Wl,-Map=$@ .map -Wl,-cref -Wl,--undefined=uxTopUsedPriority
270+ LDFLAGS += $(CFLAGS ) -nostartfiles - Wl,-nostdlib -Wl,-Map=$@ .map -Wl,-cref -Wl,--undefined=uxTopUsedPriority
265271
266272LDFLAGS += \
267273 -L$(BUILD ) /esp-idf/esp-idf/esp_system/ld \
268274 -Lesp-idf/components/esp_rom/$(IDF_TARGET ) /ld \
269275 -Lesp-idf/components/soc/$(IDF_TARGET ) /ld \
276+ -Lesp-idf/components/esp_hal_wdt/$(IDF_TARGET ) \
270277 -Tmemory.ld \
271278 -Tsections.ld \
272279 -T$(IDF_TARGET ) .peripherals.ld \
@@ -286,7 +293,8 @@ LDFLAGS += \
286293 -Tesp32.rom.newlib-reent-funcs.ld
287294
288295CHIP_COMPONENTS = \
289- esp_driver_dac
296+ esp_driver_dac \
297+ esp_hal_i2s esp_hal_lcd esp_hal_pcnt esp_hal_touch_sens esp_hal_twai
290298
291299else ifeq ($(IDF_TARGET),esp32c2)
292300LDFLAGS += \
@@ -296,14 +304,16 @@ LDFLAGS += \
296304 -Tesp32c2.rom.newlib.ld \
297305 -Tesp32c2.rom.newlib-nano.ld \
298306 -Tesp32c2.rom.version.ld \
299- -Tesp32c2.rom.systimer.ld
307+ -Tesp32c2.rom.systimer.ld \
308+ -Trom.wdt.ld
300309
301310CFLAGS += -DSOC_XTAL_FREQ_MHZ=CONFIG_XTAL_FREQ
302311
303312CHIP_COMPONENTS = \
304313 esp_driver_tsens
305314
306315else ifeq ($(IDF_TARGET),esp32c3)
316+ # esp32c2 has none of: esp_hal_i2s esp_hal_lcd esp_hal_pcnt esp_hal_touch_sens esp_hal_twai
307317LDFLAGS += \
308318 -Tesp32c3.rom.newlib.ld \
309319 -Tesp32c3.rom.libc.ld \
@@ -313,7 +323,8 @@ LDFLAGS += \
313323 -Tesp32c3.rom.bt_funcs.ld
314324
315325CHIP_COMPONENTS = \
316- esp_driver_tsens
326+ esp_driver_tsens \
327+ esp_hal_i2s esp_hal_twai
317328
318329else ifeq ($(IDF_TARGET),esp32c6)
319330LDFLAGS += \
@@ -324,11 +335,13 @@ LDFLAGS += \
324335 -Tesp32c6.rom.newlib.ld \
325336 -Tesp32c6.rom.coexist.ld \
326337 -Tesp32c6.rom.heap.ld \
327- -Tesp32c6.rom.systimer.ld
338+ -Tesp32c6.rom.systimer.ld \
339+ -Trom.wdt.ld
328340
329341
330342CHIP_COMPONENTS = \
331- esp_driver_tsens
343+ esp_driver_tsens \
344+ esp_hal_i2s esp_hal_pcnt esp_hal_twai
332345
333346else ifeq ($(IDF_TARGET),esp32c61)
334347LDFLAGS += \
@@ -340,32 +353,38 @@ LDFLAGS += \
340353 -Tesp32c61.rom.version.ld \
341354 -Tesp32c61.rom.coexist.ld \
342355 -Tesp32c61.rom.heap.ld \
343- -Tesp32c61.rom.systimer.ld
356+ -Tesp32c61.rom.systimer.ld \
357+ -Trom.wdt.ld
344358
345359
346360CHIP_COMPONENTS = \
347- esp_driver_tsens
361+ esp_driver_tsens \
362+ esp_hal_i2s
348363
349364else ifeq ($(IDF_TARGET),esp32p4)
350365LDFLAGS += \
351366 -Tesp32p4.rom.libc.ld \
352367 -Tesp32p4.rom.newlib.ld \
353- -Tesp32p4.rom.systimer.ld
368+ -Tesp32p4.rom.systimer.ld \
369+ -Trom.wdt.ld
354370
355371
356372CHIP_COMPONENTS = \
357373 esp_driver_tsens \
358- esp_driver_usb_serial_jtag
374+ esp_driver_usb_serial_jtag \
375+ esp_hal_i2s esp_hal_lcd esp_hal_pcnt esp_hal_touch_sens esp_hal_twai
359376
360377else ifeq ($(IDF_TARGET),esp32h2)
361378LDFLAGS += \
362379 -Tesp32h2.rom.heap.ld \
363380 -Tesp32h2.rom.libc.ld \
364381 -Tesp32h2.rom.newlib.ld \
365- -Tesp32h2.rom.systimer.ld
382+ -Tesp32h2.rom.systimer.ld \
383+ -Trom.wdt.ld
366384
367385CHIP_COMPONENTS = \
368- esp_driver_tsens
386+ esp_driver_tsens \
387+ esp_hal_i2s esp_hal_pcnt esp_hal_twai
369388
370389else ifeq ($(IDF_TARGET),esp32s2)
371390LDFLAGS += \
@@ -375,18 +394,21 @@ LDFLAGS += \
375394
376395CHIP_COMPONENTS = \
377396 esp_driver_dac \
378- esp_driver_tsens
397+ esp_driver_tsens \
398+ esp_hal_i2s esp_hal_lcd esp_hal_pcnt esp_hal_touch_sens esp_hal_twai
379399
380400else ifeq ($(IDF_TARGET),esp32s3)
381401LDFLAGS += \
382402 -Tesp32s3.rom.libc.ld \
383403 -Tesp32s3.rom.newlib.ld \
384404 -Tesp32s3.rom.version.ld \
385405 -Tesp32s3.rom.systimer.ld \
386- -Tesp32s3.rom.bt_funcs.ld
406+ -Tesp32s3.rom.bt_funcs.ld \
407+ -Trom.wdt.ld
387408
388409CHIP_COMPONENTS = \
389- esp_driver_tsens
410+ esp_driver_tsens \
411+ esp_hal_i2s esp_hal_lcd esp_hal_pcnt esp_hal_touch_sens esp_hal_twai
390412
391413endif
392414
@@ -737,7 +759,7 @@ ifeq ($(IDF_TARGET),esp32)
737759BINARY_BLOBS += esp-idf/components/esp_phy/lib/$(IDF_TARGET ) /librtc.a
738760endif
739761
740- ESP_IDF_COMPONENTS_LINK = $(IDF_TARGET_ARCH ) $(CHIP_COMPONENTS ) app_update bootloader_support driver esp_driver_gpio esp_driver_gptimer esp_driver_i2c 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_pm esp_ringbuf esp_rom esp_system esp_timer freertos hal heap log esp_libc nvs_flash pthread soc spi_flash vfs esp_stdio
762+ ESP_IDF_COMPONENTS_LINK = $(IDF_TARGET_ARCH ) $(CHIP_COMPONENTS ) app_update bootloader_support driver esp_driver_dma esp_driver_gpio esp_driver_gptimer esp_driver_i2c esp_driver_ledc esp_driver_spi esp_driver_uart esp_driver_usb_serial_jtag efuse esp_adc esp_app_format esp_common esp_event esp_gdbstub esp_hal_ana_conv esp_hal_clock esp_hal_dma esp_hal_gpio esp_hal_gpspi esp_hal_i2c esp_hal_ledc esp_hal_mspi esp_hal_pmu esp_hal_rmt esp_hal_security esp_hal_timg esp_hal_uart esp_hal_usb esp_hal_wdt esp_hw_support esp_mm esp_partition esp_pm esp_ringbuf esp_rom esp_system esp_timer freertos hal heap log esp_libc nvs_flash nvs_sec_provider pthread soc spi_flash vfs esp_stdio
741763ifneq ($(CIRCUITPY_WIFI ) ,0)
742764 ESP_IDF_COMPONENTS_LINK += esp_coex esp_netif esp_security esp-tls esp_wifi lwip mbedtls mdns wpa_supplicant esp_phy
743765endif
@@ -795,13 +817,17 @@ ifneq ($(CIRCUITPY_QSPIBUS),0)
795817 ESP_IDF_COMPONENTS_LINK += esp_lcd
796818endif
797819ifneq ($(CIRCUITPY_SDIOIO ) ,0)
798- ESP_IDF_COMPONENTS_LINK += sdmmc esp_driver_sdmmc
820+ ESP_IDF_COMPONENTS_LINK += sdmmc esp_driver_sdmmc esp_driver_sd_intf
799821endif
800822
801823ESP_IDF_COMPONENTS_EXPANDED = $(foreach component, $(ESP_IDF_COMPONENTS_LINK ) , $(BUILD ) /esp-idf/esp-idf/$(component ) /lib$(component ) .a)
802824
803825MBEDTLS_COMPONENTS_LINK = crypto tls x509
804826MBEDTLS_COMPONENTS_LINK_EXPANDED = $(foreach component, $(MBEDTLS_COMPONENTS_LINK ) , $(BUILD ) /esp-idf/esp-idf/mbedtls/mbedtls/library/libmbed$(component ) .a)
827+ MBEDTLS_COMPONENTS_LINK_EXPANDED += $(BUILD ) /esp-idf/esp-idf/mbedtls/mbedtls/library/libtfpsacrypto.a
828+ MBEDTLS_COMPONENTS_LINK_EXPANDED += $(BUILD ) /esp-idf/esp-idf/mbedtls/mbedtls/tf-psa-crypto/drivers/builtin/libmbed-builtin.a
829+ MBEDTLS_COMPONENTS_LINK_EXPANDED += $(BUILD ) /esp-idf/esp-idf/mbedtls/mbedtls/tf-psa-crypto/drivers/everest/libeverest.a
830+ MBEDTLS_COMPONENTS_LINK_EXPANDED += $(BUILD ) /esp-idf/esp-idf/mbedtls/mbedtls/tf-psa-crypto/drivers/p256-m/libp256m.a
805831
806832ifeq ($(IDF_TARGET_ARCH ) ,xtensa)
807833BINARY_BLOBS += esp-idf/components/xtensa/$(IDF_TARGET ) /libxt_hal.a
0 commit comments