Skip to content

Commit 4bec776

Browse files
authored
Merge pull request #3519 from hathach/fix-idf-latest
fix espressif latest idf
2 parents 66c2566 + e1fc85c commit 4bec776

File tree

10 files changed

+42
-16
lines changed

10 files changed

+42
-16
lines changed

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,4 +152,4 @@
152152
url = https://github.com/adafruit/Adafruit_CircuitPython_RFM69.git
153153
[submodule "ports/esp32s2/esp-idf"]
154154
path = ports/esp32s2/esp-idf
155-
url = https://github.com/hierophect/esp-idf.git
155+
url = https://github.com/espressif/esp-idf.git

ports/esp32s2/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ menuconfig: $(BUILD)/esp-idf/config
271271
$(HEADER_BUILD)/qstr.i.last: | $(BUILD)/esp-idf/config/sdkconfig.h
272272

273273
# Order here matters
274-
ESP_IDF_COMPONENTS_LINK = freertos log esp_system esp32s2 bootloader_support pthread esp_timer vfs spi_flash app_update esp_common esp32s2 heap newlib driver xtensa soc esp_ringbuf esp_wifi esp_event wpa_supplicant mbedtls efuse nvs_flash esp_netif lwip esp_rom esp-tls
274+
ESP_IDF_COMPONENTS_LINK = freertos log hal esp_system esp32s2 bootloader_support pthread esp_timer vfs spi_flash app_update esp_common esp32s2 heap newlib driver xtensa soc esp_ringbuf esp_wifi esp_event wpa_supplicant mbedtls efuse nvs_flash esp_netif lwip esp_rom esp-tls
275275

276276
ESP_IDF_COMPONENTS_INCLUDE = driver freertos log soc
277277

@@ -283,11 +283,11 @@ ESP_IDF_WIFI_COMPONENTS_EXPANDED = $(foreach component, $(ESP_IDF_WIFI_COMPONENT
283283
MBEDTLS_COMPONENTS_LINK = crypto tls x509
284284
MBEDTLS_COMPONENTS_LINK_EXPANDED = $(foreach component, $(MBEDTLS_COMPONENTS_LINK), $(BUILD)/esp-idf/esp-idf/mbedtls/mbedtls/library/libmbed$(component).a)
285285

286-
BINARY_BLOBS = esp-idf/components/xtensa/esp32s2/libhal.a
286+
BINARY_BLOBS = esp-idf/components/xtensa/esp32s2/libxt_hal.a
287287
BINARY_WIFI_BLOBS = libcoexist.a libcore.a libespnow.a libmesh.a libnet80211.a libpp.a librtc.a libsmartconfig.a libphy.a
288288
BINARY_BLOBS += $(addprefix esp-idf/components/esp_wifi/lib/esp32s2/, $(BINARY_WIFI_BLOBS))
289289

290-
ESP_IDF_COMPONENTS_EXPANDED += $(BUILD)/esp-idf/esp-idf/soc/soc/esp32s2/libsoc_esp32s2.a esp-idf/components/xtensa/esp32s2/libhal.a
290+
ESP_IDF_COMPONENTS_EXPANDED += $(BUILD)/esp-idf/esp-idf/soc/soc/esp32s2/libsoc_esp32s2.a esp-idf/components/xtensa/esp32s2/libxt_hal.a
291291
ESP_AUTOGEN_LD = $(BUILD)/esp-idf/esp-idf/esp32s2/esp32s2_out.ld $(BUILD)/esp-idf/esp-idf/esp32s2/ld/esp32s2.project.ld
292292

293293
FLASH_FLAGS = --flash_mode $(CIRCUITPY_ESP_FLASH_MODE) --flash_freq $(CIRCUITPY_ESP_FLASH_FREQ) --flash_size $(CIRCUITPY_ESP_FLASH_SIZE)

ports/esp32s2/common-hal/busio/I2C.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
#include "common-hal/microcontroller/Pin.h"
3131

32-
#include "components/soc/include/hal/i2c_types.h"
32+
#include "components/hal/include/hal/i2c_types.h"
3333
#include "FreeRTOS.h"
3434
#include "freertos/semphr.h"
3535
#include "py/obj.h"

ports/esp32s2/common-hal/busio/SPI.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
#include "common-hal/microcontroller/Pin.h"
3131

3232
#include "components/driver/include/driver/spi_common_internal.h"
33-
#include "components/soc/include/hal/spi_hal.h"
34-
#include "components/soc/include/hal/spi_types.h"
33+
#include "components/hal/include/hal/spi_hal.h"
34+
#include "components/hal/include/hal/spi_types.h"
3535
#include "py/obj.h"
3636

3737
typedef struct {

ports/esp32s2/common-hal/busio/UART.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
#include "common-hal/microcontroller/Pin.h"
3131

32-
#include "components/soc/include/hal/uart_types.h"
32+
#include "components/hal/include/hal/uart_types.h"
3333
#include "py/obj.h"
3434

3535
typedef struct {

ports/esp32s2/common-hal/digitalio/DigitalInOut.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
#include "components/driver/include/driver/gpio.h"
3232

33-
#include "components/soc/include/hal/gpio_hal.h"
33+
#include "components/hal/include/hal/gpio_hal.h"
3434

3535
void common_hal_digitalio_digitalinout_never_reset(
3636
digitalio_digitalinout_obj_t *self) {

ports/esp32s2/common-hal/microcontroller/Pin.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
#include "py/mphal.h"
3333

3434
#include "components/driver/include/driver/gpio.h"
35-
#include "components/soc/include/hal/gpio_hal.h"
35+
#include "components/hal/include/hal/gpio_hal.h"
3636

3737
#ifdef MICROPY_HW_NEOPIXEL
3838
bool neopixel_in_use;

ports/esp32s2/esp-idf

Submodule esp-idf updated 662 files

ports/esp32s2/peripherals/pins.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
#include "esp32s2_peripherals_config.h"
3636
#include "esp-idf/config/sdkconfig.h"
37-
#include "components/soc/include/hal/gpio_types.h"
37+
#include "components/hal/include/hal/gpio_types.h"
3838

3939
typedef struct {
4040
PIN_PREFIX_FIELDS

ports/esp32s2/supervisor/usb.c

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
#include "components/driver/include/driver/periph_ctrl.h"
3434
#include "components/driver/include/driver/gpio.h"
3535
#include "components/esp_rom/include/esp32s2/rom/gpio.h"
36+
#include "components/esp_rom/include/esp_rom_gpio.h"
37+
#include "components/hal/esp32s2/include/hal/gpio_ll.h"
3638

3739
#include "freertos/FreeRTOS.h"
3840
#include "freertos/task.h"
@@ -68,17 +70,41 @@ void usb_device_task(void* param)
6870
}
6971
}
7072

73+
static void configure_pins (usb_hal_context_t *usb)
74+
{
75+
/* usb_periph_iopins currently configures USB_OTG as USB Device.
76+
* Introduce additional parameters in usb_hal_context_t when adding support
77+
* for USB Host.
78+
*/
79+
for ( const usb_iopin_dsc_t *iopin = usb_periph_iopins; iopin->pin != -1; ++iopin ) {
80+
if ( (usb->use_external_phy) || (iopin->ext_phy_only == 0) ) {
81+
esp_rom_gpio_pad_select_gpio(iopin->pin);
82+
if ( iopin->is_output ) {
83+
esp_rom_gpio_connect_out_signal(iopin->pin, iopin->func, false, false);
84+
}
85+
else {
86+
esp_rom_gpio_connect_in_signal(iopin->pin, iopin->func, false);
87+
if ( (iopin->pin != GPIO_FUNC_IN_LOW) && (iopin->pin != GPIO_FUNC_IN_HIGH) ) {
88+
gpio_ll_input_enable(&GPIO, iopin->pin);
89+
}
90+
}
91+
esp_rom_gpio_pad_unhold(iopin->pin);
92+
}
93+
}
94+
if ( !usb->use_external_phy ) {
95+
gpio_set_drive_capability(USBPHY_DM_NUM, GPIO_DRIVE_CAP_3);
96+
gpio_set_drive_capability(USBPHY_DP_NUM, GPIO_DRIVE_CAP_3);
97+
}
98+
}
99+
71100
void init_usb_hardware(void) {
72101
periph_module_reset(PERIPH_USB_MODULE);
73102
periph_module_enable(PERIPH_USB_MODULE);
74103
usb_hal_context_t hal = {
75104
.use_external_phy = false // use built-in PHY
76105
};
77106
usb_hal_init(&hal);
78-
79-
// Initialize the pin drive strength.
80-
gpio_set_drive_capability(USBPHY_DM_NUM, GPIO_DRIVE_CAP_3);
81-
gpio_set_drive_capability(USBPHY_DP_NUM, GPIO_DRIVE_CAP_3);
107+
configure_pins(&hal);
82108

83109
(void) xTaskCreateStatic(usb_device_task,
84110
"usbd",

0 commit comments

Comments
 (0)