Skip to content

Commit 25ad46d

Browse files
committed
Update to IDF 5.2.1
1 parent 50c504d commit 25ad46d

6 files changed

Lines changed: 43 additions & 47 deletions

File tree

ports/espressif/Makefile

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ INC += \
9797
-isystem esp-idf/components/esp_adc/include \
9898
-isystem esp-idf/components/esp_adc/$(IDF_TARGET)/include \
9999
-isystem esp-idf/components/esp_app_format/include \
100+
-isystem esp-idf/components/esp_bootloader_format/include \
100101
-isystem esp-idf/components/esp_common/include \
101102
-isystem esp-idf/components/esp_event/include \
102103
-isystem esp-idf/components/esp_hw_support/include \
@@ -110,12 +111,15 @@ INC += \
110111
-isystem esp-idf/components/esp_system/include \
111112
-isystem esp-idf/components/esp_timer/include \
112113
-isystem esp-idf/components/esp_wifi/include \
114+
-isystem esp-idf/components/freertos/config/include \
115+
-isystem esp-idf/components/freertos/config/include/freertos \
116+
-isystem esp-idf/components/freertos/config/$(IDF_TARGET_ARCH)/include \
113117
-isystem esp-idf/components/freertos/esp_additions/include \
114118
-isystem esp-idf/components/freertos/esp_additions/include/freertos \
115-
-isystem esp-idf/components/freertos/esp_additions/arch/$(IDF_TARGET_ARCH)/include \
116119
-isystem esp-idf/components/freertos/FreeRTOS-Kernel/include \
117120
-isystem esp-idf/components/freertos/FreeRTOS-Kernel/include/freertos \
118121
-isystem esp-idf/components/freertos/FreeRTOS-Kernel/portable/$(IDF_TARGET_ARCH)/include \
122+
-isystem esp-idf/components/freertos/FreeRTOS-Kernel/portable/$(IDF_TARGET_ARCH)/include/freertos \
119123
-isystem esp-idf/components/hal/include \
120124
-isystem esp-idf/components/hal/$(IDF_TARGET)/include \
121125
-isystem esp-idf/components/hal/platform_port/include \
@@ -134,6 +138,7 @@ INC += \
134138
-isystem esp-idf/components/soc/include \
135139
-isystem esp-idf/components/soc/$(IDF_TARGET)/include \
136140
-isystem esp-idf/components/spi_flash/include \
141+
-isystem esp-idf/components/usb/include \
137142
-isystem esp-idf/components/ulp/ulp_fsm/include \
138143
-isystem esp-idf/components/ulp/ulp_riscv/include \
139144
-isystem esp-idf/components/ulp/ulp_common/include \
@@ -498,6 +503,9 @@ endif
498503
ifneq ($(CIRCUITPY_PARALLELDISPLAYBUS),0)
499504
ESP_IDF_COMPONENTS_LINK += esp_lcd
500505
endif
506+
ifneq ($(CIRCUITPY_USB),0)
507+
ESP_IDF_COMPONENTS_LINK += usb
508+
endif
501509

502510
ESP_IDF_COMPONENTS_EXPANDED = $(foreach component, $(ESP_IDF_COMPONENTS_LINK), $(BUILD)/esp-idf/esp-idf/$(component)/lib$(component).a)
503511

@@ -579,7 +587,7 @@ esp-idf-stamp: $(BUILD)/esp-idf/config/sdkconfig.h
579587

580588
$(BUILD)/firmware.elf: $(OBJ) | esp-idf-stamp $(IDF_CMAKE_TARGETS)
581589
$(STEPECHO) "LINK $@"
582-
$(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
590+
$(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
583591

584592
$(BUILD)/circuitpython-firmware.bin: $(BUILD)/firmware.elf | tools/build_memory_info.py
585593
$(STEPECHO) "Create $@"

ports/espressif/common-hal/busio/UART.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,11 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self,
151151
uart_config.flow_ctrl = UART_HW_FLOWCTRL_CTS;
152152
}
153153

154-
if (receiver_buffer_size <= UART_FIFO_LEN) {
155-
receiver_buffer_size = UART_FIFO_LEN + 8;
154+
if (receiver_buffer_size <= UART_HW_FIFO_LEN(self->uart_num)) {
155+
receiver_buffer_size = UART_HW_FIFO_LEN(self->uart_num) + 8;
156156
}
157157

158-
uart_config.rx_flow_ctrl_thresh = UART_FIFO_LEN - 8;
158+
uart_config.rx_flow_ctrl_thresh = UART_HW_FIFO_LEN(self->uart_num) - 8;
159159
// Install the driver before we change the settings.
160160
if (uart_driver_install(self->uart_num, receiver_buffer_size, 0, 20, &self->event_queue, 0) != ESP_OK ||
161161
uart_set_mode(self->uart_num, mode) != ESP_OK) {

ports/espressif/esp-idf

Submodule esp-idf updated 5967 files

ports/espressif/mpconfigport.mk

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,19 @@ CIRCUITPY_USB = 0
5656
else ifeq ($(IDF_TARGET),esp32c3)
5757
# Modules
5858
CIRCUITPY_ALARM = 0
59-
CIRCUITPY_AUDIOBUSIO = 0
6059
CIRCUITPY_BLEIO ?= 0
61-
CIRCUITPY_COUNTIO = 0
6260
CIRCUITPY_ESPCAMERA = 0
6361
CIRCUITPY_ESPULP = 0
64-
CIRCUITPY_FREQUENCYIO = 0
6562
CIRCUITPY_MEMORYMAP = 0
63+
64+
# No I80 support from the IDF
6665
CIRCUITPY_PARALLELDISPLAYBUS = 0
66+
67+
# No PCNT peripheral
68+
CIRCUITPY_FREQUENCYIO = 0
69+
CIRCUITPY_COUNTIO = 0
6770
CIRCUITPY_ROTARYIO = 0
71+
6872
CIRCUITPY_TOUCHIO ?= 1
6973
CIRCUITPY_TOUCHIO_USE_NATIVE = 0
7074
# Features
@@ -74,13 +78,18 @@ CIRCUITPY_ESP_USB_SERIAL_JTAG ?= 1
7478
else ifeq ($(IDF_TARGET),esp32c6)
7579
# Modules
7680
CIRCUITPY_ALARM = 0
77-
CIRCUITPY_AUDIOBUSIO = 0
7881
CIRCUITPY_BLEIO ?= 0
7982
CIRCUITPY_ESPCAMERA = 0
8083
CIRCUITPY_ESPULP = 0
8184
CIRCUITPY_MEMORYMAP = 0
82-
CIRCUITPY_PARALLELDISPLAYBUS = 0
8385
CIRCUITPY_RGBMATRIX = 0
86+
87+
# No space for this
88+
CIRCUITPY_AUDIOBUSIO = 0
89+
90+
# No I80 support from the IDF
91+
CIRCUITPY_PARALLELDISPLAYBUS = 0
92+
8493
CIRCUITPY_TOUCHIO ?= 1
8594
CIRCUITPY_TOUCHIO_USE_NATIVE = 0
8695
# Features
@@ -90,16 +99,15 @@ CIRCUITPY_ESP_USB_SERIAL_JTAG ?= 1
9099
else ifeq ($(IDF_TARGET),esp32h2)
91100
# Modules
92101
CIRCUITPY_ALARM = 0
93-
# Turn off analogio because calibration is currently supported.
94-
# https://github.com/espressif/esp-idf/issues/11038
95-
CIRCUITPY_ANALOGIO = 0
96-
CIRCUITPY_AUDIOBUSIO = 0
97102
CIRCUITPY_BLEIO ?= 1
98103
CIRCUITPY_ESPCAMERA = 0
99104
CIRCUITPY_ESPULP = 0
100105
CIRCUITPY_MEMORYMAP = 0
101-
CIRCUITPY_PARALLELDISPLAYBUS = 0
102106
CIRCUITPY_RGBMATRIX = 0
107+
108+
# No I80 support from the IDF
109+
CIRCUITPY_PARALLELDISPLAYBUS = 0
110+
103111
CIRCUITPY_TOUCHIO ?= 1
104112
CIRCUITPY_TOUCHIO_USE_NATIVE = 0
105113
CIRCUITPY_HASHLIB_MBEDTLS_ONLY = 0

ports/espressif/supervisor/usb.c

Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@
3232
#include "shared/readline/readline.h"
3333

3434
#include "hal/gpio_ll.h"
35-
#include "hal/usb_hal.h"
35+
36+
#include "esp_err.h"
37+
#include "esp_private/usb_phy.h"
3638
#include "soc/usb_periph.h"
3739

3840
#include "driver/gpio.h"
@@ -60,6 +62,8 @@
6062
StackType_t usb_device_stack[USBD_STACK_SIZE];
6163
StaticTask_t usb_device_taskdef;
6264

65+
static usb_phy_handle_t phy_hdl;
66+
6367
// USB Device Driver task
6468
// This top level thread process all usb events and invoke callbacks
6569
STATIC void usb_device_task(void *param) {
@@ -76,37 +80,13 @@ STATIC void usb_device_task(void *param) {
7680
}
7781
}
7882

79-
static void configure_pins(usb_hal_context_t *usb) {
80-
/* usb_periph_iopins currently configures USB_OTG as USB Device.
81-
* Introduce additional parameters in usb_hal_context_t when adding support
82-
* for USB Host.
83-
*/
84-
for (const usb_iopin_dsc_t *iopin = usb_periph_iopins; iopin->pin != -1; ++iopin) {
85-
if ((usb->use_external_phy) || (iopin->ext_phy_only == 0)) {
86-
gpio_pad_select_gpio(iopin->pin);
87-
if (iopin->is_output) {
88-
gpio_matrix_out(iopin->pin, iopin->func, false, false);
89-
} else {
90-
gpio_matrix_in(iopin->pin, iopin->func, false);
91-
gpio_pad_input_enable(iopin->pin);
92-
}
93-
gpio_pad_unhold(iopin->pin);
94-
}
95-
}
96-
if (!usb->use_external_phy) {
97-
gpio_set_drive_capability(USBPHY_DP_NUM, GPIO_DRIVE_CAP_3);
98-
gpio_set_drive_capability(USBPHY_DP_NUM, GPIO_DRIVE_CAP_3);
99-
}
100-
}
101-
10283
void init_usb_hardware(void) {
103-
periph_module_reset(PERIPH_USB_MODULE);
104-
periph_module_enable(PERIPH_USB_MODULE);
105-
usb_hal_context_t hal = {
106-
.use_external_phy = false // use built-in PHY
84+
// Configure USB PHY
85+
usb_phy_config_t phy_conf = {
86+
.controller = USB_PHY_CTRL_OTG,
87+
.otg_mode = USB_OTG_MODE_DEVICE,
10788
};
108-
usb_hal_init(&hal);
109-
configure_pins(&hal);
89+
usb_new_phy(&phy_conf, &phy_hdl);
11090

11191
// Pin the USB task to the same core as CircuitPython. This way we leave
11292
// the other core for networking.

0 commit comments

Comments
 (0)