Skip to content

Upgrade ESP-IDF v5.3.2 to v5.4.1 #10267

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
May 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/actions/deps/ports/espressif/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ runs:
run: |
echo >> $GITHUB_ENV "IDF_PATH=$GITHUB_WORKSPACE/ports/espressif/esp-idf"
echo >> $GITHUB_ENV "IDF_TOOLS_PATH=$GITHUB_WORKSPACE/.idf_tools"
echo >> $GITHUB_ENV "ESP_ROM_ELF_DIR=$GITHUB_WORKSPACE/.idf_tools"
shell: bash

- name: Get IDF commit
Expand Down
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
[submodule "ports/espressif/esp-idf"]
path = ports/espressif/esp-idf
url = https://github.com/adafruit/esp-idf.git
branch = circuitpython-v5.3.2
branch = circuitpython-v5.4.1
[submodule "ports/espressif/esp-protocols"]
path = ports/espressif/esp-protocols
url = https://github.com/adafruit/esp-protocols.git
Expand Down
67 changes: 0 additions & 67 deletions lib/mbedtls_config/mbedtls_config_port.h

This file was deleted.

28 changes: 16 additions & 12 deletions ports/espressif/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ INC += \
-isystem esp-idf/components/esp_psram/include \
-isystem esp-idf/components/esp_ringbuf/include \
-isystem esp-idf/components/esp_rom/include \
-isystem esp-idf/components/esp_rom/$(IDF_TARGET)/include \
-isystem esp-idf/components/esp_rom/$(IDF_TARGET)/include/$(IDF_TARGET) \
-isystem esp-idf/components/esp_security/include \
-isystem esp-idf/components/esp_system/include \
-isystem esp-idf/components/esp_timer/include \
-isystem esp-idf/components/esp_wifi/include \
Expand Down Expand Up @@ -115,6 +118,7 @@ INC += \
-isystem esp-idf/components/sdmmc/include \
-isystem esp-idf/components/soc/include \
-isystem esp-idf/components/soc/$(IDF_TARGET)/include \
-isystem esp-idf/components/soc/$(IDF_TARGET)/register \
-isystem esp-idf/components/spi_flash/include \
-isystem esp-idf/components/usb/include \
-isystem esp-idf/components/ulp/ulp_fsm/include \
Expand Down Expand Up @@ -171,12 +175,12 @@ ifeq ($(DEBUG), 1)
OPTIMIZATION_FLAGS ?= -Og
CFLAGS += -DDEBUG
endif
# You may want to enable these flags to make setting breakpoints easier.
# CFLAGS += -fno-inline -fno-ipa-sra
# You may want to enable these flags to make setting breakpoints easier.
# CFLAGS += -fno-inline -fno-ipa-sra
else
CFLAGS += -DNDEBUG
# RISC-V is larger than xtensa
# Use -Os for RISC-V when it overflows
# RISC-V is larger than xtensa
# Use -Os for RISC-V when it overflows
ifeq ($(IDF_TARGET_ARCH),riscv)
OPTIMIZATION_FLAGS ?= -Os
else
Expand Down Expand Up @@ -238,7 +242,6 @@ ifeq ($(IDF_TARGET),esp32)
LDFLAGS += \
-Tesp32.rom.newlib-data.ld \
-Tesp32.rom.newlib-funcs.ld \
-Tesp32.rom.newlib-time.ld \
-Tesp32.rom.spiflash_legacy.ld

CHIP_COMPONENTS = \
Expand All @@ -261,7 +264,6 @@ CHIP_COMPONENTS = \
else ifeq ($(IDF_TARGET),esp32c3)
LDFLAGS += \
-Tesp32c3.rom.newlib.ld \
-Tesp32c3.rom.newlib-time.ld \
-Tesp32c3.rom.version.ld \
-Tesp32c3.rom.eco3.ld \
-Tesp32c3.rom.bt_funcs.ld
Expand Down Expand Up @@ -308,7 +310,6 @@ else ifeq ($(IDF_TARGET),esp32s2)
LDFLAGS += \
-Tesp32s2.rom.newlib-data.ld \
-Tesp32s2.rom.newlib-funcs.ld \
-Tesp32s2.rom.newlib-time.ld \
-Tesp32s2.rom.spiflash_legacy.ld

CHIP_COMPONENTS = \
Expand Down Expand Up @@ -392,7 +393,7 @@ SRC_C += \
peripherals/$(IDF_TARGET)/pins.c

ifeq ($(CIRCUITPY_SSL),1)
SRC_C += lib/mbedtls_config/crt_bundle.c
SRC_C += common-hal/ssl/crt_bundle.c
endif

SRC_C += $(wildcard common-hal/espidf/*.c)
Expand Down Expand Up @@ -603,7 +604,7 @@ endif

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 newlib nvs_flash pthread soc spi_flash vfs esp_vfs_console
ifneq ($(CIRCUITPY_WIFI),0)
ESP_IDF_COMPONENTS_LINK += esp_coex esp_netif esp-tls esp_wifi lwip mbedtls mdns wpa_supplicant esp_phy
ESP_IDF_COMPONENTS_LINK += esp_coex esp_netif esp_security esp-tls esp_wifi lwip mbedtls mdns wpa_supplicant esp_phy
endif
ifneq ($(CIRCUITPY_BLEIO_NATIVE),0)
BLE_IMPL_esp32 := esp32
Expand All @@ -614,10 +615,10 @@ ifneq ($(CIRCUITPY_BLEIO_NATIVE),0)
BLE_IMPL_esp32h2 := libble
BLE_IMPL = $(BLE_IMPL_$(IDF_TARGET))

ESP_IDF_COMPONENTS_LINK += bt esp_phy
ESP_IDF_COMPONENTS_LINK += bt esp_phy esp_security
ifeq ($(BLE_IMPL),esp32)
# BLE will hang the ESP32 and trigger an interrupt watchdog without this undefined symbol at
# link because a weak version of the interrupt that BLE uses will be linked incorrectly.
# BLE will hang the ESP32 and trigger an interrupt watchdog without this undefined symbol at
# link because a weak version of the interrupt that BLE uses will be linked incorrectly.
REGISTRATION_FUNCTIONS += -u ld_include_hli_vectors_bt
BINARY_BLOBS += esp-idf/components/bt/controller/lib_esp32/$(IDF_TARGET)/libbtdm_app.a
endif
Expand All @@ -636,6 +637,9 @@ ifneq ($(CIRCUITPY_BLEIO_NATIVE),0)
endif
endif
endif
ifeq ($(IDF_TARGET),esp32p4)
ESP_IDF_COMPONENTS_LINK += esp_security
endif
ifneq ($(CIRCUITPY_ESPULP),0)
ESP_IDF_COMPONENTS_LINK += ulp
endif
Expand Down
1 change: 1 addition & 0 deletions ports/espressif/boards/mixgo_ce_udisk/mpconfigboard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ CIRCUITPY_ESP_FLASH_FREQ = 80m
CIRCUITPY_ESP_FLASH_SIZE = 4MB

CIRCUITPY_AESIO = 0
CIRCUITPY_CANIO = 0
CIRCUITPY_CODEOP = 0
CIRCUITPY_ESPCAMERA = 0

Expand Down
37 changes: 37 additions & 0 deletions ports/espressif/common-hal/ssl/crt_bundle.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// This file is part of the CircuitPython project: https://circuitpython.org
//
// SPDX-FileCopyrightText: Copyright (c) 2025 Dan Halbert for Adafruit Industries
//
// SPDX-License-Identifier: MIT

// In ESP-IDF v5.4, Espressif changed the format of the in-flash cert bundle, which
// made lib/mbedtls_config/crt_bundle.c no longer work. Rather than update that,
// just wrap those functions and use the ESP-IDF versions.

#include "py/mperrno.h"
#include "mbedtls/x509_crt.h"
#include "lib/mbedtls_config/crt_bundle.h"
#include "esp_crt_bundle.h"

static int convert_esp_err(esp_err_t ret) {
switch (ret) {
case ESP_OK:
return 0;
default:
// Right now esp_crt_bundle.c doesn't return very specific errors.
case ESP_ERR_INVALID_ARG:
return -MP_EINVAL;
}
}

int crt_bundle_attach(mbedtls_ssl_config *ssl_conf) {
return convert_esp_err(esp_crt_bundle_attach(ssl_conf));
}

void crt_bundle_detach(mbedtls_ssl_config *conf) {
esp_crt_bundle_detach(conf);
}

int crt_bundle_set(const uint8_t *x509_bundle, size_t bundle_size) {
return convert_esp_err(esp_crt_bundle_set(x509_bundle, bundle_size));
}
2 changes: 1 addition & 1 deletion ports/espressif/esp-idf
Submodule esp-idf updated 6990 files
6 changes: 6 additions & 0 deletions ports/espressif/esp-idf-config/sdkconfig-esp32s2.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ CONFIG_ULP_COPROC_TYPE_RISCV=y # Note: enabling both ULPs simultaneously only w
CONFIG_ULP_COPROC_RESERVE_MEM=8176
# end of Ultra Low Power (ULP) Co-processor

#
# FreeRTOS
#
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y
# end of FreeRTOS

# end of Component config

# end of Espressif IoT Development Framework Configuration
13 changes: 0 additions & 13 deletions ports/espressif/esp-idf-config/sdkconfig-flash-120m.defaults
Original file line number Diff line number Diff line change
@@ -1,15 +1,2 @@
CONFIG_ESPTOOLPY_FLASHFREQ_120M=y
# CONFIG_ESPTOOLPY_FLASHFREQ_80M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_64M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_60M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_48M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_40M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_32M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_30M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_26M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_24M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_20M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_16M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_15M is not set
CONFIG_ESPTOOLPY_FLASHFREQ_80M_DEFAULT=y
CONFIG_SPI_FLASH_UNDER_HIGH_FREQ=y
13 changes: 0 additions & 13 deletions ports/espressif/esp-idf-config/sdkconfig-flash-40m.defaults
Original file line number Diff line number Diff line change
@@ -1,14 +1 @@
# CONFIG_ESPTOOLPY_FLASHFREQ_120M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_80M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_64M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_60M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_48M is not set
CONFIG_ESPTOOLPY_FLASHFREQ_40M=y
# CONFIG_ESPTOOLPY_FLASHFREQ_32M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_30M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_26M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_24M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_20M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_16M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_15M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_80M_DEFAULT is not set
13 changes: 0 additions & 13 deletions ports/espressif/esp-idf-config/sdkconfig-flash-48m.defaults
Original file line number Diff line number Diff line change
@@ -1,14 +1 @@
# CONFIG_ESPTOOLPY_FLASHFREQ_120M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_80M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_64M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_60M is not set
CONFIG_ESPTOOLPY_FLASHFREQ_48M=y
# CONFIG_ESPTOOLPY_FLASHFREQ_40M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_32M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_30M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_26M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_24M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_20M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_16M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_15M is not set
CONFIG_ESPTOOLPY_FLASHFREQ_48M_DEFAULT=y
13 changes: 0 additions & 13 deletions ports/espressif/esp-idf-config/sdkconfig-flash-60m.defaults
Original file line number Diff line number Diff line change
@@ -1,14 +1 @@
# CONFIG_ESPTOOLPY_FLASHFREQ_120M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_80M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_64M is not set
CONFIG_ESPTOOLPY_FLASHFREQ_60M=y
# CONFIG_ESPTOOLPY_FLASHFREQ_48M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_40M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_32M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_30M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_26M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_24M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_20M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_16M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_15M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_80M_DEFAULT is not set
13 changes: 0 additions & 13 deletions ports/espressif/esp-idf-config/sdkconfig-flash-80m.defaults
Original file line number Diff line number Diff line change
@@ -1,14 +1 @@
# CONFIG_ESPTOOLPY_FLASHFREQ_120M is not set
CONFIG_ESPTOOLPY_FLASHFREQ_80M=y
# CONFIG_ESPTOOLPY_FLASHFREQ_64M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_60M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_48M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_40M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_32M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_30M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_26M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_24M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_20M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_16M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_15M is not set
CONFIG_ESPTOOLPY_FLASHFREQ_80M_DEFAULT=y
3 changes: 3 additions & 0 deletions ports/espressif/mpconfigport.mk
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@ CIRCUITPY_TOUCHIO_USE_NATIVE = 0
CIRCUITPY_USB_DEVICE = 0
CIRCUITPY_ESP_USB_SERIAL_JTAG ?= 1

# Remove temporarily until 10265 is merged
CIRCUITPY_ULAB = 0

else ifeq ($(IDF_TARGET),esp32h2)
# Modules
CIRCUITPY_ESPCAMERA = 0
Expand Down
20 changes: 1 addition & 19 deletions ports/espressif/mphalport.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,7 @@
#include "py/mphal.h"
#include "supervisor/cpu.h"

#if defined(CONFIG_IDF_TARGET_ESP32)
#include "components/esp_rom/include/esp32/rom/ets_sys.h"
#elif defined(CONFIG_IDF_TARGET_ESP32C2)
#include "components/esp_rom/include/esp32c2/rom/ets_sys.h"
#elif defined(CONFIG_IDF_TARGET_ESP32P4)
#include "components/esp_rom/include/esp32p4/rom/ets_sys.h"
#elif defined(CONFIG_IDF_TARGET_ESP32C3)
#include "components/esp_rom/include/esp32c3/rom/ets_sys.h"
#elif defined(CONFIG_IDF_TARGET_ESP32C6)
#include "components/esp_rom/include/esp32c6/rom/ets_sys.h"
#elif defined(CONFIG_IDF_TARGET_ESP32H2)
#include "components/esp_rom/include/esp32h2/rom/ets_sys.h"
#elif defined(CONFIG_IDF_TARGET_ESP32S2)
#include "components/esp_rom/include/esp32s2/rom/ets_sys.h"
#elif defined(CONFIG_IDF_TARGET_ESP32S3)
#include "components/esp_rom/include/esp32s3/rom/ets_sys.h"
#else
#error Unknown CONFIG_IDF_TARGET_xxx
#endif
#include "rom/ets_sys.h"

#include "esp_attr.h"

Expand Down
4 changes: 2 additions & 2 deletions ports/espressif/supervisor/port.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ static void _never_reset_spi_ram_flash(void) {

const uint32_t spiconfig = esp_rom_efuse_get_flash_gpio_info();
if (spiconfig == ESP_ROM_EFUSE_FLASH_DEFAULT_SPI) {
never_reset_pin_number(SPI_IOMUX_PIN_NUM_CLK);
never_reset_pin_number(SPI_IOMUX_PIN_NUM_CS);
never_reset_pin_number(MSPI_IOMUX_PIN_NUM_CLK);
never_reset_pin_number(MSPI_IOMUX_PIN_NUM_CS0);
never_reset_pin_number(PSRAM_SPIQ_SD0_IO);
never_reset_pin_number(PSRAM_SPID_SD1_IO);
never_reset_pin_number(PSRAM_SPIWP_SD3_IO);
Expand Down
10 changes: 1 addition & 9 deletions ports/espressif/supervisor/usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,7 @@
#include "driver/gpio.h"
#include "esp_private/periph_ctrl.h"

#if defined(CONFIG_IDF_TARGET_ESP32C3)
#include "components/esp_rom/include/esp32c3/rom/gpio.h"
#elif defined(CONFIG_IDF_TARGET_ESP32C6)
#include "components/esp_rom/include/esp32c6/rom/gpio.h"
#elif defined(CONFIG_IDF_TARGET_ESP32S2)
#include "components/esp_rom/include/esp32s2/rom/gpio.h"
#elif defined(CONFIG_IDF_TARGET_ESP32S3)
#include "components/esp_rom/include/esp32s3/rom/gpio.h"
#endif
#include "rom/gpio.h"

#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
Expand Down
2 changes: 1 addition & 1 deletion shared-module/ssl/SSLSocket.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
static void mbedtls_debug(void *ctx, int level, const char *file, int line, const char *str) {
(void)ctx;
(void)level;
mp_printf(&mp_plat_print, "DBG:%s:%04d: %s\n", file, line, str);
mp_printf(&mp_plat_print, "DBG:%s:%04d: %s", file, line, str);
}
#define DEBUG_PRINT(fmt, ...) mp_printf(&mp_plat_print, "DBG:%s:%04d: " fmt "\n", __FILE__, __LINE__,##__VA_ARGS__)
#else
Expand Down
Loading