Merge pull request #3519 from hathach/fix-idf-latest

fix espressif latest idf
This commit is contained in:
hierophect 2020-10-08 12:22:24 -04:00 committed by GitHub
commit 4bec77652b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 42 additions and 16 deletions

2
.gitmodules vendored
View File

@ -152,4 +152,4 @@
url = https://github.com/adafruit/Adafruit_CircuitPython_RFM69.git url = https://github.com/adafruit/Adafruit_CircuitPython_RFM69.git
[submodule "ports/esp32s2/esp-idf"] [submodule "ports/esp32s2/esp-idf"]
path = ports/esp32s2/esp-idf path = ports/esp32s2/esp-idf
url = https://github.com/hierophect/esp-idf.git url = https://github.com/espressif/esp-idf.git

View File

@ -271,7 +271,7 @@ menuconfig: $(BUILD)/esp-idf/config
$(HEADER_BUILD)/qstr.i.last: | $(BUILD)/esp-idf/config/sdkconfig.h $(HEADER_BUILD)/qstr.i.last: | $(BUILD)/esp-idf/config/sdkconfig.h
# Order here matters # Order here matters
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 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
ESP_IDF_COMPONENTS_INCLUDE = driver freertos log soc ESP_IDF_COMPONENTS_INCLUDE = driver freertos log soc
@ -283,11 +283,11 @@ ESP_IDF_WIFI_COMPONENTS_EXPANDED = $(foreach component, $(ESP_IDF_WIFI_COMPONENT
MBEDTLS_COMPONENTS_LINK = crypto tls x509 MBEDTLS_COMPONENTS_LINK = crypto tls x509
MBEDTLS_COMPONENTS_LINK_EXPANDED = $(foreach component, $(MBEDTLS_COMPONENTS_LINK), $(BUILD)/esp-idf/esp-idf/mbedtls/mbedtls/library/libmbed$(component).a) MBEDTLS_COMPONENTS_LINK_EXPANDED = $(foreach component, $(MBEDTLS_COMPONENTS_LINK), $(BUILD)/esp-idf/esp-idf/mbedtls/mbedtls/library/libmbed$(component).a)
BINARY_BLOBS = esp-idf/components/xtensa/esp32s2/libhal.a BINARY_BLOBS = esp-idf/components/xtensa/esp32s2/libxt_hal.a
BINARY_WIFI_BLOBS = libcoexist.a libcore.a libespnow.a libmesh.a libnet80211.a libpp.a librtc.a libsmartconfig.a libphy.a BINARY_WIFI_BLOBS = libcoexist.a libcore.a libespnow.a libmesh.a libnet80211.a libpp.a librtc.a libsmartconfig.a libphy.a
BINARY_BLOBS += $(addprefix esp-idf/components/esp_wifi/lib/esp32s2/, $(BINARY_WIFI_BLOBS)) BINARY_BLOBS += $(addprefix esp-idf/components/esp_wifi/lib/esp32s2/, $(BINARY_WIFI_BLOBS))
ESP_IDF_COMPONENTS_EXPANDED += $(BUILD)/esp-idf/esp-idf/soc/soc/esp32s2/libsoc_esp32s2.a esp-idf/components/xtensa/esp32s2/libhal.a ESP_IDF_COMPONENTS_EXPANDED += $(BUILD)/esp-idf/esp-idf/soc/soc/esp32s2/libsoc_esp32s2.a esp-idf/components/xtensa/esp32s2/libxt_hal.a
ESP_AUTOGEN_LD = $(BUILD)/esp-idf/esp-idf/esp32s2/esp32s2_out.ld $(BUILD)/esp-idf/esp-idf/esp32s2/ld/esp32s2.project.ld ESP_AUTOGEN_LD = $(BUILD)/esp-idf/esp-idf/esp32s2/esp32s2_out.ld $(BUILD)/esp-idf/esp-idf/esp32s2/ld/esp32s2.project.ld
FLASH_FLAGS = --flash_mode $(CIRCUITPY_ESP_FLASH_MODE) --flash_freq $(CIRCUITPY_ESP_FLASH_FREQ) --flash_size $(CIRCUITPY_ESP_FLASH_SIZE) FLASH_FLAGS = --flash_mode $(CIRCUITPY_ESP_FLASH_MODE) --flash_freq $(CIRCUITPY_ESP_FLASH_FREQ) --flash_size $(CIRCUITPY_ESP_FLASH_SIZE)

View File

@ -29,7 +29,7 @@
#include "common-hal/microcontroller/Pin.h" #include "common-hal/microcontroller/Pin.h"
#include "components/soc/include/hal/i2c_types.h" #include "components/hal/include/hal/i2c_types.h"
#include "FreeRTOS.h" #include "FreeRTOS.h"
#include "freertos/semphr.h" #include "freertos/semphr.h"
#include "py/obj.h" #include "py/obj.h"

View File

@ -30,8 +30,8 @@
#include "common-hal/microcontroller/Pin.h" #include "common-hal/microcontroller/Pin.h"
#include "components/driver/include/driver/spi_common_internal.h" #include "components/driver/include/driver/spi_common_internal.h"
#include "components/soc/include/hal/spi_hal.h" #include "components/hal/include/hal/spi_hal.h"
#include "components/soc/include/hal/spi_types.h" #include "components/hal/include/hal/spi_types.h"
#include "py/obj.h" #include "py/obj.h"
typedef struct { typedef struct {

View File

@ -29,7 +29,7 @@
#include "common-hal/microcontroller/Pin.h" #include "common-hal/microcontroller/Pin.h"
#include "components/soc/include/hal/uart_types.h" #include "components/hal/include/hal/uart_types.h"
#include "py/obj.h" #include "py/obj.h"
typedef struct { typedef struct {

View File

@ -30,7 +30,7 @@
#include "components/driver/include/driver/gpio.h" #include "components/driver/include/driver/gpio.h"
#include "components/soc/include/hal/gpio_hal.h" #include "components/hal/include/hal/gpio_hal.h"
void common_hal_digitalio_digitalinout_never_reset( void common_hal_digitalio_digitalinout_never_reset(
digitalio_digitalinout_obj_t *self) { digitalio_digitalinout_obj_t *self) {

View File

@ -32,7 +32,7 @@
#include "py/mphal.h" #include "py/mphal.h"
#include "components/driver/include/driver/gpio.h" #include "components/driver/include/driver/gpio.h"
#include "components/soc/include/hal/gpio_hal.h" #include "components/hal/include/hal/gpio_hal.h"
#ifdef MICROPY_HW_NEOPIXEL #ifdef MICROPY_HW_NEOPIXEL
bool neopixel_in_use; bool neopixel_in_use;

@ -1 +1 @@
Subproject commit a7f77798816661f7c4ae198f3878bc92a9274f82 Subproject commit 8bc19ba893e5544d571a753d82b44a84799b94b1

View File

@ -34,7 +34,7 @@
#include "esp32s2_peripherals_config.h" #include "esp32s2_peripherals_config.h"
#include "esp-idf/config/sdkconfig.h" #include "esp-idf/config/sdkconfig.h"
#include "components/soc/include/hal/gpio_types.h" #include "components/hal/include/hal/gpio_types.h"
typedef struct { typedef struct {
PIN_PREFIX_FIELDS PIN_PREFIX_FIELDS

View File

@ -33,6 +33,8 @@
#include "components/driver/include/driver/periph_ctrl.h" #include "components/driver/include/driver/periph_ctrl.h"
#include "components/driver/include/driver/gpio.h" #include "components/driver/include/driver/gpio.h"
#include "components/esp_rom/include/esp32s2/rom/gpio.h" #include "components/esp_rom/include/esp32s2/rom/gpio.h"
#include "components/esp_rom/include/esp_rom_gpio.h"
#include "components/hal/esp32s2/include/hal/gpio_ll.h"
#include "freertos/FreeRTOS.h" #include "freertos/FreeRTOS.h"
#include "freertos/task.h" #include "freertos/task.h"
@ -68,6 +70,33 @@ void usb_device_task(void* param)
} }
} }
static void configure_pins (usb_hal_context_t *usb)
{
/* usb_periph_iopins currently configures USB_OTG as USB Device.
* Introduce additional parameters in usb_hal_context_t when adding support
* for USB Host.
*/
for ( const usb_iopin_dsc_t *iopin = usb_periph_iopins; iopin->pin != -1; ++iopin ) {
if ( (usb->use_external_phy) || (iopin->ext_phy_only == 0) ) {
esp_rom_gpio_pad_select_gpio(iopin->pin);
if ( iopin->is_output ) {
esp_rom_gpio_connect_out_signal(iopin->pin, iopin->func, false, false);
}
else {
esp_rom_gpio_connect_in_signal(iopin->pin, iopin->func, false);
if ( (iopin->pin != GPIO_FUNC_IN_LOW) && (iopin->pin != GPIO_FUNC_IN_HIGH) ) {
gpio_ll_input_enable(&GPIO, iopin->pin);
}
}
esp_rom_gpio_pad_unhold(iopin->pin);
}
}
if ( !usb->use_external_phy ) {
gpio_set_drive_capability(USBPHY_DM_NUM, GPIO_DRIVE_CAP_3);
gpio_set_drive_capability(USBPHY_DP_NUM, GPIO_DRIVE_CAP_3);
}
}
void init_usb_hardware(void) { void init_usb_hardware(void) {
periph_module_reset(PERIPH_USB_MODULE); periph_module_reset(PERIPH_USB_MODULE);
periph_module_enable(PERIPH_USB_MODULE); periph_module_enable(PERIPH_USB_MODULE);
@ -75,10 +104,7 @@ void init_usb_hardware(void) {
.use_external_phy = false // use built-in PHY .use_external_phy = false // use built-in PHY
}; };
usb_hal_init(&hal); usb_hal_init(&hal);
configure_pins(&hal);
// Initialize the pin drive strength.
gpio_set_drive_capability(USBPHY_DM_NUM, GPIO_DRIVE_CAP_3);
gpio_set_drive_capability(USBPHY_DP_NUM, GPIO_DRIVE_CAP_3);
(void) xTaskCreateStatic(usb_device_task, (void) xTaskCreateStatic(usb_device_task,
"usbd", "usbd",