First stab at 5.1 update

This commit is contained in:
Scott Shawcroft 2023-09-15 16:19:34 -07:00
parent d6b284ebb0
commit e22eefabd7
No known key found for this signature in database
GPG Key ID: 0DFD512649C052DA
16 changed files with 43 additions and 35 deletions

1
.gitmodules vendored
View File

@ -143,6 +143,7 @@
[submodule "ports/espressif/esp-idf"] [submodule "ports/espressif/esp-idf"]
path = ports/espressif/esp-idf path = ports/espressif/esp-idf
url = https://github.com/adafruit/esp-idf.git url = https://github.com/adafruit/esp-idf.git
branch = circuitpython-v5.1
[submodule "ports/espressif/esp-protocols"] [submodule "ports/espressif/esp-protocols"]
path = ports/espressif/esp-protocols path = ports/espressif/esp-protocols
url = https://github.com/espressif/esp-protocols.git url = https://github.com/espressif/esp-protocols.git

View File

@ -32,6 +32,12 @@ IDF_TARGET_ARCH = xtensa
CROSS_COMPILE = xtensa-$(IDF_TARGET)-elf- CROSS_COMPILE = xtensa-$(IDF_TARGET)-elf-
endif endif
ifeq ($(IDF_TARGET),esp32s3)
BT_IDF_TARGET = esp32c3
else
BT_IDF_TARGET = $(IDF_TARGET)
endif
####################################### #######################################
# CFLAGS # CFLAGS
####################################### #######################################
@ -52,19 +58,29 @@ INC += \
-isystem esp-idf/components/app_update/include \ -isystem esp-idf/components/app_update/include \
-isystem esp-idf/components/bootloader_support/include \ -isystem esp-idf/components/bootloader_support/include \
-isystem esp-idf/components/bootloader_support/bootloader_flash/include \ -isystem esp-idf/components/bootloader_support/bootloader_flash/include \
-isystem esp-idf/components/bt/include/$(IDF_TARGET)/include \ -isystem esp-idf/components/bt/include/$(BT_IDF_TARGET)/include \
-isystem esp-idf/components/bt/host/nimble/esp-hci/include \ -isystem esp-idf/components/bt/host/nimble/esp-hci/include \
-isystem esp-idf/components/bt/host/nimble/nimble/nimble/controller/include \ -isystem esp-idf/components/bt/host/nimble/nimble/nimble/controller/include \
-isystem esp-idf/components/bt/host/nimble/nimble/nimble/host/include \ -isystem esp-idf/components/bt/host/nimble/nimble/nimble/host/include \
-isystem esp-idf/components/bt/host/nimble/nimble/nimble/host/services/gap/include \ -isystem esp-idf/components/bt/host/nimble/nimble/nimble/host/services/gap/include \
-isystem esp-idf/components/bt/host/nimble/nimble/nimble/include \ -isystem esp-idf/components/bt/host/nimble/nimble/nimble/include \
-isystem esp-idf/components/bt/host/nimble/nimble/nimble/host/util/include \ -isystem esp-idf/components/bt/host/nimble/nimble/nimble/host/util/include \
-isystem esp-idf/components/bt/host/nimble/nimble/nimble/transport/include \
-isystem esp-idf/components/bt/host/nimble/nimble/porting/nimble/include \ -isystem esp-idf/components/bt/host/nimble/nimble/porting/nimble/include \
-isystem esp-idf/components/bt/host/nimble/nimble/porting/npl/freertos/include \ -isystem esp-idf/components/bt/host/nimble/nimble/porting/npl/freertos/include \
-isystem esp-idf/components/bt/host/nimble/port/include \ -isystem esp-idf/components/bt/host/nimble/port/include \
-isystem esp-idf/components/driver/include \ -isystem esp-idf/components/driver/include \
-isystem esp-idf/components/driver/deprecated \ -isystem esp-idf/components/driver/deprecated \
-isystem esp-idf/components/driver/gpio/include \
-isystem esp-idf/components/driver/i2c/include \
-isystem esp-idf/components/driver/i2s/include \
-isystem esp-idf/components/driver/$(IDF_TARGET)/include \ -isystem esp-idf/components/driver/$(IDF_TARGET)/include \
-isystem esp-idf/components/driver/ledc/include \
-isystem esp-idf/components/driver/spi/include \
-isystem esp-idf/components/driver/temperature_sensor/include \
-isystem esp-idf/components/driver/touch_sensor/include \
-isystem esp-idf/components/driver/touch_sensor/$(IDF_TARGET)/include \
-isystem esp-idf/components/driver/twai/include \
-isystem esp-idf/components/efuse/include \ -isystem esp-idf/components/efuse/include \
-isystem esp-idf/components/efuse/$(IDF_TARGET)/include \ -isystem esp-idf/components/efuse/$(IDF_TARGET)/include \
-isystem esp-idf/components/$(IDF_TARGET)/include \ -isystem esp-idf/components/$(IDF_TARGET)/include \
@ -85,6 +101,7 @@ INC += \
-isystem esp-idf/components/esp_wifi/include \ -isystem esp-idf/components/esp_wifi/include \
-isystem esp-idf/components/freertos/esp_additions/include \ -isystem esp-idf/components/freertos/esp_additions/include \
-isystem esp-idf/components/freertos/esp_additions/include/freertos \ -isystem esp-idf/components/freertos/esp_additions/include/freertos \
-isystem esp-idf/components/freertos/esp_additions/arch/$(IDF_TARGET_ARCH)/include \
-isystem esp-idf/components/freertos/FreeRTOS-Kernel/include \ -isystem esp-idf/components/freertos/FreeRTOS-Kernel/include \
-isystem esp-idf/components/freertos/FreeRTOS-Kernel/include/freertos \ -isystem esp-idf/components/freertos/FreeRTOS-Kernel/include/freertos \
-isystem esp-idf/components/freertos/FreeRTOS-Kernel/portable/$(IDF_TARGET_ARCH)/include \ -isystem esp-idf/components/freertos/FreeRTOS-Kernel/portable/$(IDF_TARGET_ARCH)/include \
@ -95,7 +112,9 @@ INC += \
-isystem esp-idf/components/log/include \ -isystem esp-idf/components/log/include \
-isystem esp-idf/components/lwip/include \ -isystem esp-idf/components/lwip/include \
-isystem esp-idf/components/lwip/lwip/src/include \ -isystem esp-idf/components/lwip/lwip/src/include \
-isystem esp-idf/components/lwip/port/esp32/include \ -isystem esp-idf/components/lwip/port/include \
-isystem esp-idf/components/lwip/port/esp32xx/include \
-isystem esp-idf/components/lwip/port/freertos/include \
-isystem esp-idf/components/mbedtls/esp_crt_bundle/include \ -isystem esp-idf/components/mbedtls/esp_crt_bundle/include \
-isystem esp-idf/components/mbedtls/mbedtls/include \ -isystem esp-idf/components/mbedtls/mbedtls/include \
-isystem esp-idf/components/mbedtls/port/include \ -isystem esp-idf/components/mbedtls/port/include \
@ -408,13 +427,13 @@ update-all-sdkconfigs: $(BUILD)/esp-idf/config/sdkconfig.h
update-board-sdkconfig: $(BUILD)/esp-idf/config/sdkconfig.h update-board-sdkconfig: $(BUILD)/esp-idf/config/sdkconfig.h
python tools/update_sdkconfig.py --board=$(BOARD) --debug=$(DEBUG) python tools/update_sdkconfig.py --board=$(BOARD) --debug=$(DEBUG)
BINARY_WIFI_BLOBS = libcoexist.a libcore.a libespnow.a libmesh.a libnet80211.a libpp.a libsmartconfig.a libwapi.a BINARY_WIFI_BLOBS = libcore.a libespnow.a libmesh.a libnet80211.a libpp.a libsmartconfig.a libwapi.a
BINARY_BLOBS = esp-idf/components/esp_phy/lib/$(IDF_TARGET)/libphy.a $(addprefix esp-idf/components/esp_wifi/lib/$(IDF_TARGET)/, $(BINARY_WIFI_BLOBS)) BINARY_BLOBS = esp-idf/components/esp_coex/lib/$(IDF_TARGET)/libcoexist.a esp-idf/components/esp_phy/lib/$(IDF_TARGET)/libphy.a $(addprefix esp-idf/components/esp_wifi/lib/$(IDF_TARGET)/, $(BINARY_WIFI_BLOBS))
ifeq ($(IDF_TARGET),esp32) ifeq ($(IDF_TARGET),esp32)
BINARY_BLOBS += esp-idf/components/esp_phy/lib/$(IDF_TARGET)/librtc.a BINARY_BLOBS += esp-idf/components/esp_phy/lib/$(IDF_TARGET)/librtc.a
endif endif
ESP_IDF_COMPONENTS_LINK = $(IDF_TARGET_ARCH) app_update bootloader_support driver efuse esp_adc esp_app_format esp_common esp_event esp_hw_support esp_netif esp_partition esp_phy esp_pm esp_ringbuf esp_rom esp_system esp_timer esp-tls esp_wifi freertos hal heap log lwip mbedtls mdns newlib nvs_flash pthread soc spi_flash vfs wpa_supplicant ESP_IDF_COMPONENTS_LINK = $(IDF_TARGET_ARCH) app_update bootloader_support driver efuse esp_adc esp_app_format esp_coex esp_common esp_event esp_hw_support esp_mm esp_netif esp_partition esp_phy esp_pm esp_ringbuf esp_rom esp_system esp_timer esp-tls esp_wifi freertos hal heap log lwip mbedtls mdns newlib nvs_flash pthread soc spi_flash vfs wpa_supplicant
ifneq ($(CIRCUITPY_BLEIO),0) ifneq ($(CIRCUITPY_BLEIO),0)
ESP_IDF_COMPONENTS_LINK += bt ESP_IDF_COMPONENTS_LINK += bt
ifeq ($(IDF_TARGET),esp32) ifeq ($(IDF_TARGET),esp32)

View File

@ -79,11 +79,13 @@ STATIC mp_obj_t espnow_peer_make_new(const mp_obj_type_t *type, size_t n_args, s
self->peer_info.ifidx = (wifi_interface_t)mp_arg_validate_int_range(args[ARG_interface].u_int, 0, 1, MP_QSTR_interface); self->peer_info.ifidx = (wifi_interface_t)mp_arg_validate_int_range(args[ARG_interface].u_int, 0, 1, MP_QSTR_interface);
self->peer_info.encrypt = args[ARG_encrypted].u_bool; self->peer_info.encrypt = args[ARG_encrypted].u_bool;
self->lmk_set = false;
const mp_obj_t lmk = args[ARG_lmk].u_obj; const mp_obj_t lmk = args[ARG_lmk].u_obj;
if (lmk != mp_const_none) { if (lmk != mp_const_none) {
self->lmk_set = true;
memcpy(self->peer_info.lmk, common_hal_espnow_get_bytes_len(lmk, ESP_NOW_KEY_LEN), ESP_NOW_KEY_LEN); memcpy(self->peer_info.lmk, common_hal_espnow_get_bytes_len(lmk, ESP_NOW_KEY_LEN), ESP_NOW_KEY_LEN);
} else if (self->peer_info.encrypt && !self->peer_info.lmk) { } else if (self->peer_info.encrypt) {
mp_raise_ValueError_varg(translate("%q is %q"), MP_QSTR_lmk, MP_QSTR_None); mp_raise_ValueError_varg(translate("%q is %q"), MP_QSTR_lmk, MP_QSTR_None);
} }
@ -196,7 +198,7 @@ STATIC mp_obj_t espnow_peer_set_encrypted(const mp_obj_t self_in, const mp_obj_t
self->peer_info.encrypt = mp_obj_is_true(value); self->peer_info.encrypt = mp_obj_is_true(value);
if (!self->peer_info.lmk) { if (!self->lmk_set) {
mp_raise_ValueError_varg(translate("%q is %q"), MP_QSTR_lmk, MP_QSTR_None); mp_raise_ValueError_varg(translate("%q is %q"), MP_QSTR_lmk, MP_QSTR_None);
} }

View File

@ -32,6 +32,7 @@
typedef struct { typedef struct {
mp_obj_base_t base; mp_obj_base_t base;
esp_now_peer_info_t peer_info; esp_now_peer_info_t peer_info;
bool lmk_set;
} espnow_peer_obj_t; } espnow_peer_obj_t;
extern const mp_obj_type_t espnow_peer_type; extern const mp_obj_type_t espnow_peer_type;

View File

@ -32,10 +32,6 @@
#define DEFAULT_I2C_BUS_SDA (&pin_GPIO8) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO8)
#define DEFAULT_I2C_BUS_SCL (&pin_GPIO18) #define DEFAULT_I2C_BUS_SCL (&pin_GPIO18)
// UART pins attached to the USB-serial converter chip
#define CIRCUITPY_CONSOLE_UART_TX (&pin_GPIO43)
#define CIRCUITPY_CONSOLE_UART_RX (&pin_GPIO44)
#define MICROPY_HW_NEOPIXEL (&pin_GPIO4) // also DBLTAP #define MICROPY_HW_NEOPIXEL (&pin_GPIO4) // also DBLTAP
#define DOUBLE_TAP_PIN (&pin_GPIO4) // also NEOPIXEL #define DOUBLE_TAP_PIN (&pin_GPIO4) // also NEOPIXEL

View File

@ -5,19 +5,6 @@
# Component config # Component config
# #
#
# ESP System Settings
#
CONFIG_ESP_CONSOLE_UART_CUSTOM=y
# CONFIG_ESP_CONSOLE_NONE is not set
CONFIG_ESP_CONSOLE_UART=y
CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_0=y
CONFIG_ESP_CONSOLE_UART_NUM=0
CONFIG_ESP_CONSOLE_UART_TX_GPIO=43
CONFIG_ESP_CONSOLE_UART_RX_GPIO=44
CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200
# end of ESP System Settings
# #
# LWIP # LWIP
# #

View File

@ -51,8 +51,8 @@
#include "esp_sleep.h" #include "esp_sleep.h"
#include "soc/rtc_cntl_reg.h" #include "soc/rtc_cntl_reg.h"
#include "components/driver/include/driver/gpio.h" #include "components/driver/gpio/include/driver/gpio.h"
#include "components/driver/include/driver/uart.h" #include "components/driver/uart/include/driver/uart.h"
// Singleton instance of SleepMemory. // Singleton instance of SleepMemory.
const alarm_sleep_memory_obj_t alarm_sleep_memory_obj = { const alarm_sleep_memory_obj_t alarm_sleep_memory_obj = {
@ -213,6 +213,8 @@ void NORETURN common_hal_alarm_enter_deep_sleep(void) {
// The ESP-IDF caches the deep sleep settings and applies them before sleep. // The ESP-IDF caches the deep sleep settings and applies them before sleep.
// We don't need to worry about resetting them in the interim. // We don't need to worry about resetting them in the interim.
esp_deep_sleep_start(); esp_deep_sleep_start();
reset_into_safe_mode(SAFE_MODE_HARD_FAULT);
} }
void common_hal_alarm_gc_collect(void) { void common_hal_alarm_gc_collect(void) {

View File

@ -28,7 +28,7 @@
#include "py/mperrno.h" #include "py/mperrno.h"
#include "py/runtime.h" #include "py/runtime.h"
#include "components/driver/include/driver/i2c.h" #include "components/driver/i2c/include/driver/i2c.h"
#include "shared-bindings/microcontroller/__init__.h" #include "shared-bindings/microcontroller/__init__.h"
#include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/microcontroller/Pin.h"

View File

@ -28,7 +28,7 @@
#include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/microcontroller/Pin.h"
#include "shared-bindings/busio/UART.h" #include "shared-bindings/busio/UART.h"
#include "components/driver/include/driver/uart.h" #include "components/driver/uart/include/driver/uart.h"
#include "mpconfigport.h" #include "mpconfigport.h"
#include "shared/readline/readline.h" #include "shared/readline/readline.h"

View File

@ -28,7 +28,7 @@
#include "py/runtime.h" #include "py/runtime.h"
#include "supervisor/shared/translate/translate.h" #include "supervisor/shared/translate/translate.h"
#include "components/driver/include/driver/gpio.h" #include "components/driver/gpio/include/driver/gpio.h"
#include "components/hal/include/hal/gpio_hal.h" #include "components/hal/include/hal/gpio_hal.h"

View File

@ -48,7 +48,7 @@
#include "common-hal/espidf/__init__.h" #include "common-hal/espidf/__init__.h"
#include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/microcontroller/Pin.h"
#include "py/runtime.h" #include "py/runtime.h"
#include "components/driver/include/driver/gpio.h" #include "components/driver/gpio/include/driver/gpio.h"
#include "components/esp_rom/include/esp_rom_gpio.h" #include "components/esp_rom/include/esp_rom_gpio.h"
#include "components/hal/esp32s3/include/hal/lcd_ll.h" #include "components/hal/esp32s3/include/hal/lcd_ll.h"
#include "components/hal/include/hal/gpio_hal.h" #include "components/hal/include/hal/gpio_hal.h"

View File

@ -30,7 +30,7 @@
#include "py/mphal.h" #include "py/mphal.h"
#include "components/driver/include/driver/gpio.h" #include "components/driver/gpio/include/driver/gpio.h"
#include "components/hal/include/hal/gpio_hal.h" #include "components/hal/include/hal/gpio_hal.h"
STATIC uint64_t _never_reset_pin_mask; STATIC uint64_t _never_reset_pin_mask;

View File

@ -28,7 +28,7 @@
#define MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_PWMIO_PWMOUT_H #define MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_PWMIO_PWMOUT_H
#include "common-hal/microcontroller/Pin.h" #include "common-hal/microcontroller/Pin.h"
#include "components/driver/include/driver/ledc.h" #include "components/driver/ledc/include/driver/ledc.h"
typedef struct { typedef struct {
mp_obj_base_t base; mp_obj_base_t base;

@ -1 +1 @@
Subproject commit 75035312ed9427557acfee1cd32af2b8e1f13f72 Subproject commit 8f3f2cc8cfb2e4371870b0c5a974d40468114a9e

@ -1 +1 @@
Subproject commit 6f0c9319c5b09ce12ef81e6428d3b6f23a9487e5 Subproject commit fb07ab7f0007549d38081cfc6d83348780526a28

View File

@ -284,7 +284,7 @@ safe_mode_t port_init(void) {
#endif #endif
#if ENABLE_JTAG #if ENABLE_JTAG
ESP_LOGI(TAG, "Marking JTAG pins never_reset") ESP_LOGI(TAG, "Marking JTAG pins never_reset");
// JTAG // JTAG
#ifdef CONFIG_IDF_TARGET_ESP32C3 #ifdef CONFIG_IDF_TARGET_ESP32C3
common_hal_never_reset_pin(&pin_GPIO4); common_hal_never_reset_pin(&pin_GPIO4);