Skip to content

Commit e22eefa

Browse files
committed
First stab at 5.1 update
1 parent d6b284e commit e22eefa

16 files changed

Lines changed: 43 additions & 35 deletions

File tree

.gitmodules

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@
143143
[submodule "ports/espressif/esp-idf"]
144144
path = ports/espressif/esp-idf
145145
url = https://github.com/adafruit/esp-idf.git
146+
branch = circuitpython-v5.1
146147
[submodule "ports/espressif/esp-protocols"]
147148
path = ports/espressif/esp-protocols
148149
url = https://github.com/espressif/esp-protocols.git

ports/espressif/Makefile

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ IDF_TARGET_ARCH = xtensa
3232
CROSS_COMPILE = xtensa-$(IDF_TARGET)-elf-
3333
endif
3434

35+
ifeq ($(IDF_TARGET),esp32s3)
36+
BT_IDF_TARGET = esp32c3
37+
else
38+
BT_IDF_TARGET = $(IDF_TARGET)
39+
endif
40+
3541
#######################################
3642
# CFLAGS
3743
#######################################
@@ -52,19 +58,29 @@ INC += \
5258
-isystem esp-idf/components/app_update/include \
5359
-isystem esp-idf/components/bootloader_support/include \
5460
-isystem esp-idf/components/bootloader_support/bootloader_flash/include \
55-
-isystem esp-idf/components/bt/include/$(IDF_TARGET)/include \
61+
-isystem esp-idf/components/bt/include/$(BT_IDF_TARGET)/include \
5662
-isystem esp-idf/components/bt/host/nimble/esp-hci/include \
5763
-isystem esp-idf/components/bt/host/nimble/nimble/nimble/controller/include \
5864
-isystem esp-idf/components/bt/host/nimble/nimble/nimble/host/include \
5965
-isystem esp-idf/components/bt/host/nimble/nimble/nimble/host/services/gap/include \
6066
-isystem esp-idf/components/bt/host/nimble/nimble/nimble/include \
6167
-isystem esp-idf/components/bt/host/nimble/nimble/nimble/host/util/include \
68+
-isystem esp-idf/components/bt/host/nimble/nimble/nimble/transport/include \
6269
-isystem esp-idf/components/bt/host/nimble/nimble/porting/nimble/include \
6370
-isystem esp-idf/components/bt/host/nimble/nimble/porting/npl/freertos/include \
6471
-isystem esp-idf/components/bt/host/nimble/port/include \
6572
-isystem esp-idf/components/driver/include \
6673
-isystem esp-idf/components/driver/deprecated \
74+
-isystem esp-idf/components/driver/gpio/include \
75+
-isystem esp-idf/components/driver/i2c/include \
76+
-isystem esp-idf/components/driver/i2s/include \
6777
-isystem esp-idf/components/driver/$(IDF_TARGET)/include \
78+
-isystem esp-idf/components/driver/ledc/include \
79+
-isystem esp-idf/components/driver/spi/include \
80+
-isystem esp-idf/components/driver/temperature_sensor/include \
81+
-isystem esp-idf/components/driver/touch_sensor/include \
82+
-isystem esp-idf/components/driver/touch_sensor/$(IDF_TARGET)/include \
83+
-isystem esp-idf/components/driver/twai/include \
6884
-isystem esp-idf/components/efuse/include \
6985
-isystem esp-idf/components/efuse/$(IDF_TARGET)/include \
7086
-isystem esp-idf/components/$(IDF_TARGET)/include \
@@ -85,6 +101,7 @@ INC += \
85101
-isystem esp-idf/components/esp_wifi/include \
86102
-isystem esp-idf/components/freertos/esp_additions/include \
87103
-isystem esp-idf/components/freertos/esp_additions/include/freertos \
104+
-isystem esp-idf/components/freertos/esp_additions/arch/$(IDF_TARGET_ARCH)/include \
88105
-isystem esp-idf/components/freertos/FreeRTOS-Kernel/include \
89106
-isystem esp-idf/components/freertos/FreeRTOS-Kernel/include/freertos \
90107
-isystem esp-idf/components/freertos/FreeRTOS-Kernel/portable/$(IDF_TARGET_ARCH)/include \
@@ -95,7 +112,9 @@ INC += \
95112
-isystem esp-idf/components/log/include \
96113
-isystem esp-idf/components/lwip/include \
97114
-isystem esp-idf/components/lwip/lwip/src/include \
98-
-isystem esp-idf/components/lwip/port/esp32/include \
115+
-isystem esp-idf/components/lwip/port/include \
116+
-isystem esp-idf/components/lwip/port/esp32xx/include \
117+
-isystem esp-idf/components/lwip/port/freertos/include \
99118
-isystem esp-idf/components/mbedtls/esp_crt_bundle/include \
100119
-isystem esp-idf/components/mbedtls/mbedtls/include \
101120
-isystem esp-idf/components/mbedtls/port/include \
@@ -408,13 +427,13 @@ update-all-sdkconfigs: $(BUILD)/esp-idf/config/sdkconfig.h
408427
update-board-sdkconfig: $(BUILD)/esp-idf/config/sdkconfig.h
409428
python tools/update_sdkconfig.py --board=$(BOARD) --debug=$(DEBUG)
410429

411-
BINARY_WIFI_BLOBS = libcoexist.a libcore.a libespnow.a libmesh.a libnet80211.a libpp.a libsmartconfig.a libwapi.a
412-
BINARY_BLOBS = esp-idf/components/esp_phy/lib/$(IDF_TARGET)/libphy.a $(addprefix esp-idf/components/esp_wifi/lib/$(IDF_TARGET)/, $(BINARY_WIFI_BLOBS))
430+
BINARY_WIFI_BLOBS = libcore.a libespnow.a libmesh.a libnet80211.a libpp.a libsmartconfig.a libwapi.a
431+
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))
413432
ifeq ($(IDF_TARGET),esp32)
414433
BINARY_BLOBS += esp-idf/components/esp_phy/lib/$(IDF_TARGET)/librtc.a
415434
endif
416435

417-
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
436+
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
418437
ifneq ($(CIRCUITPY_BLEIO),0)
419438
ESP_IDF_COMPONENTS_LINK += bt
420439
ifeq ($(IDF_TARGET),esp32)

ports/espressif/bindings/espnow/Peer.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,13 @@ STATIC mp_obj_t espnow_peer_make_new(const mp_obj_type_t *type, size_t n_args, s
7979
self->peer_info.ifidx = (wifi_interface_t)mp_arg_validate_int_range(args[ARG_interface].u_int, 0, 1, MP_QSTR_interface);
8080

8181
self->peer_info.encrypt = args[ARG_encrypted].u_bool;
82+
self->lmk_set = false;
8283

8384
const mp_obj_t lmk = args[ARG_lmk].u_obj;
8485
if (lmk != mp_const_none) {
86+
self->lmk_set = true;
8587
memcpy(self->peer_info.lmk, common_hal_espnow_get_bytes_len(lmk, ESP_NOW_KEY_LEN), ESP_NOW_KEY_LEN);
86-
} else if (self->peer_info.encrypt && !self->peer_info.lmk) {
88+
} else if (self->peer_info.encrypt) {
8789
mp_raise_ValueError_varg(translate("%q is %q"), MP_QSTR_lmk, MP_QSTR_None);
8890
}
8991

@@ -196,7 +198,7 @@ STATIC mp_obj_t espnow_peer_set_encrypted(const mp_obj_t self_in, const mp_obj_t
196198

197199
self->peer_info.encrypt = mp_obj_is_true(value);
198200

199-
if (!self->peer_info.lmk) {
201+
if (!self->lmk_set) {
200202
mp_raise_ValueError_varg(translate("%q is %q"), MP_QSTR_lmk, MP_QSTR_None);
201203
}
202204

ports/espressif/bindings/espnow/Peer.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
typedef struct {
3333
mp_obj_base_t base;
3434
esp_now_peer_info_t peer_info;
35+
bool lmk_set;
3536
} espnow_peer_obj_t;
3637

3738
extern const mp_obj_type_t espnow_peer_type;

ports/espressif/boards/adafruit_qualia_s3_rgb666/mpconfigboard.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@
3232
#define DEFAULT_I2C_BUS_SDA (&pin_GPIO8)
3333
#define DEFAULT_I2C_BUS_SCL (&pin_GPIO18)
3434

35-
// UART pins attached to the USB-serial converter chip
36-
#define CIRCUITPY_CONSOLE_UART_TX (&pin_GPIO43)
37-
#define CIRCUITPY_CONSOLE_UART_RX (&pin_GPIO44)
38-
3935
#define MICROPY_HW_NEOPIXEL (&pin_GPIO4) // also DBLTAP
4036

4137
#define DOUBLE_TAP_PIN (&pin_GPIO4) // also NEOPIXEL

ports/espressif/boards/adafruit_qualia_s3_rgb666/sdkconfig

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,6 @@
55
# Component config
66
#
77

8-
#
9-
# ESP System Settings
10-
#
11-
CONFIG_ESP_CONSOLE_UART_CUSTOM=y
12-
# CONFIG_ESP_CONSOLE_NONE is not set
13-
CONFIG_ESP_CONSOLE_UART=y
14-
CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_0=y
15-
CONFIG_ESP_CONSOLE_UART_NUM=0
16-
CONFIG_ESP_CONSOLE_UART_TX_GPIO=43
17-
CONFIG_ESP_CONSOLE_UART_RX_GPIO=44
18-
CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200
19-
# end of ESP System Settings
20-
218
#
229
# LWIP
2310
#

ports/espressif/common-hal/alarm/__init__.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@
5151
#include "esp_sleep.h"
5252

5353
#include "soc/rtc_cntl_reg.h"
54-
#include "components/driver/include/driver/gpio.h"
55-
#include "components/driver/include/driver/uart.h"
54+
#include "components/driver/gpio/include/driver/gpio.h"
55+
#include "components/driver/uart/include/driver/uart.h"
5656

5757
// Singleton instance of SleepMemory.
5858
const alarm_sleep_memory_obj_t alarm_sleep_memory_obj = {
@@ -213,6 +213,8 @@ void NORETURN common_hal_alarm_enter_deep_sleep(void) {
213213
// The ESP-IDF caches the deep sleep settings and applies them before sleep.
214214
// We don't need to worry about resetting them in the interim.
215215
esp_deep_sleep_start();
216+
217+
reset_into_safe_mode(SAFE_MODE_HARD_FAULT);
216218
}
217219

218220
void common_hal_alarm_gc_collect(void) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#include "py/mperrno.h"
2929
#include "py/runtime.h"
3030

31-
#include "components/driver/include/driver/i2c.h"
31+
#include "components/driver/i2c/include/driver/i2c.h"
3232

3333
#include "shared-bindings/microcontroller/__init__.h"
3434
#include "shared-bindings/microcontroller/Pin.h"

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#include "shared-bindings/microcontroller/Pin.h"
2929
#include "shared-bindings/busio/UART.h"
3030

31-
#include "components/driver/include/driver/uart.h"
31+
#include "components/driver/uart/include/driver/uart.h"
3232

3333
#include "mpconfigport.h"
3434
#include "shared/readline/readline.h"

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#include "py/runtime.h"
2929
#include "supervisor/shared/translate/translate.h"
3030

31-
#include "components/driver/include/driver/gpio.h"
31+
#include "components/driver/gpio/include/driver/gpio.h"
3232

3333
#include "components/hal/include/hal/gpio_hal.h"
3434

0 commit comments

Comments
 (0)