From 952118f6c3b593c9ebfd573cba7ce68374abc97b Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 14 Sep 2023 11:19:38 -0700 Subject: [PATCH] Update new boards. Reduce memory use in S2 --- .gitmodules | 2 +- .../adafruit_esp32s3_camera/mpconfigboard.mk | 3 +- .../mpconfigboard.mk | 6 +- .../adafruit_qualia_s3_rgb666/sdkconfig | 48 +++++------- .../arduino_nano_esp32s3/mpconfigboard.mk | 10 ++- .../boards/arduino_nano_esp32s3/sdkconfig | 42 ++-------- .../mpconfigboard.mk | 10 ++- .../sdkconfig | 42 ++-------- .../boards/espressif_esp32_eye/sdkconfig | 11 --- .../mpconfigboard.mk | 6 +- .../mpconfigboard.mk | 4 + .../sdkconfig | 64 ++++----------- .../boards/m5stack_atoms3u/sdkconfig | 12 ++- .../espressif/boards/m5stack_core2/sdkconfig | 6 -- .../boards/m5stack_m5paper/mpconfigboard.mk | 5 ++ .../boards/m5stack_m5paper/sdkconfig | 77 +++++++------------ .../boards/makerfabs_tft7/mpconfigboard.mk | 4 + .../espressif/boards/makerfabs_tft7/sdkconfig | 53 +++++-------- .../waveshare_esp32_s3_pico/mpconfigboard.mk | 4 + .../boards/waveshare_esp32_s3_pico/sdkconfig | 42 ++-------- ports/espressif/common-hal/ssl/SSLSocket.c | 11 ++- ports/espressif/common-hal/ssl/SSLSocket.h | 1 - ports/espressif/common-hal/wifi/__init__.c | 14 +++- .../esp-idf-config/sdkconfig-esp32s2.defaults | 11 +++ .../esp-idf-config/sdkconfig-psram.defaults | 11 --- .../esp-idf-config/sdkconfig.defaults | 7 +- ports/espressif/supervisor/port.c | 2 +- ports/espressif/tools/update_sdkconfig.py | 7 +- 28 files changed, 200 insertions(+), 315 deletions(-) diff --git a/.gitmodules b/.gitmodules index 80fcc99133..16fdbcf5a1 100644 --- a/.gitmodules +++ b/.gitmodules @@ -342,7 +342,7 @@ url = https://github.com/bablokb/circuitpython-pcf85063a [submodule "frozen/Adafruit_CircuitPython_Wave"] path = frozen/Adafruit_CircuitPython_Wave - url = http://github.com/adafruit/Adafruit_CircuitPython_Wave.git + url = https://github.com/adafruit/Adafruit_CircuitPython_Wave.git [submodule "ports/raspberrypi/lib/Pico-PIO-USB"] path = ports/raspberrypi/lib/Pico-PIO-USB url = https://github.com/sekigon-gonnoc/Pico-PIO-USB.git diff --git a/ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.mk b/ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.mk index 57087cf0e0..0b9deaaf10 100644 --- a/ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.mk @@ -5,9 +5,10 @@ USB_MANUFACTURER = "Adafruit" IDF_TARGET = esp32s3 +CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m -CIRCUITPY_ESP_FLASH_SIZE = 4MB + CIRCUITPY_ESP_PSRAM_SIZE = 2MB CIRCUITPY_ESP_PSRAM_MODE = qio CIRCUITPY_ESP_PSRAM_FREQ = 80m diff --git a/ports/espressif/boards/adafruit_qualia_s3_rgb666/mpconfigboard.mk b/ports/espressif/boards/adafruit_qualia_s3_rgb666/mpconfigboard.mk index 1bde6abfe4..3db489c5de 100644 --- a/ports/espressif/boards/adafruit_qualia_s3_rgb666/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_qualia_s3_rgb666/mpconfigboard.mk @@ -5,8 +5,12 @@ USB_MANUFACTURER = "Adafruit" IDF_TARGET = esp32s3 +CIRCUITPY_ESP_FLASH_SIZE = 16MB CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m -CIRCUITPY_ESP_FLASH_SIZE = 16MB + +CIRCUITPY_ESP_PSRAM_SIZE = 8MB +CIRCUITPY_ESP_PSRAM_MODE = opi +CIRCUITPY_ESP_PSRAM_FREQ = 80m CIRCUITPY_DOTCLOCKFRAMEBUFFER = 1 diff --git a/ports/espressif/boards/adafruit_qualia_s3_rgb666/sdkconfig b/ports/espressif/boards/adafruit_qualia_s3_rgb666/sdkconfig index 79d78825fc..e9dc0663bd 100644 --- a/ports/espressif/boards/adafruit_qualia_s3_rgb666/sdkconfig +++ b/ports/espressif/boards/adafruit_qualia_s3_rgb666/sdkconfig @@ -1,41 +1,29 @@ -CONFIG_ESP32S3_SPIRAM_SUPPORT=y # -# SPI RAM config +# Espressif IoT Development Framework Configuration +# +# +# Component config # -# CONFIG_SPIRAM_MODE_QUAD is not set -CONFIG_SPIRAM_MODE_OCT=y -CONFIG_SPIRAM_TYPE_AUTO=y -# end of SPI RAM config -CONFIG_DEFAULT_PSRAM_CLK_IO=30 # -# PSRAM Clock and CS IO for ESP32S3 +# ESP System Settings # -CONFIG_DEFAULT_PSRAM_CS_IO=26 -# end of PSRAM Clock and CS IO for ESP32S3 +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 -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -CONFIG_SPIRAM_SPEED_80M=y -# CONFIG_SPIRAM_SPEED_40M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="qualia" # end of LWIP -# -# CONFIG_ESP_CONSOLE_NONE is not set -CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 -CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_0=y -CONFIG_ESP_CONSOLE_UART_CUSTOM=y -CONFIG_ESP_CONSOLE_UART_NUM=0 -CONFIG_ESP_CONSOLE_UART_RX_GPIO=44 -CONFIG_ESP_CONSOLE_UART_TX_GPIO=43 -CONFIG_ESP_CONSOLE_UART=y + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/arduino_nano_esp32s3/mpconfigboard.mk b/ports/espressif/boards/arduino_nano_esp32s3/mpconfigboard.mk index c9af3af25e..c342e5e2cb 100644 --- a/ports/espressif/boards/arduino_nano_esp32s3/mpconfigboard.mk +++ b/ports/espressif/boards/arduino_nano_esp32s3/mpconfigboard.mk @@ -6,9 +6,17 @@ USB_MANUFACTURER = "Arduino" IDF_TARGET = esp32s3 +# This has a u-blox® NORA-W106-10B module. + +# This flash lives outside the module. CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m -CIRCUITPY_ESP_FLASH_SIZE = 8MB +CIRCUITPY_ESP_FLASH_SIZE = 16MB + +# This PSRAM is in the module. +CIRCUITPY_ESP_PSRAM_SIZE = 8MB +CIRCUITPY_ESP_PSRAM_MODE = opi +CIRCUITPY_ESP_PSRAM_FREQ = 80m INTERNAL_FLASH_FILESYSTEM = 0 QSPI_FLASH_FILESYSTEM = 1 diff --git a/ports/espressif/boards/arduino_nano_esp32s3/sdkconfig b/ports/espressif/boards/arduino_nano_esp32s3/sdkconfig index 2acf08a4a7..f5ef797681 100644 --- a/ports/espressif/boards/arduino_nano_esp32s3/sdkconfig +++ b/ports/espressif/boards/arduino_nano_esp32s3/sdkconfig @@ -1,43 +1,15 @@ # +# Espressif IoT Development Framework Configuration +# +# # Component config # -# -# ESP32S3-Specific -# -CONFIG_ESP32S3_SPIRAM_SUPPORT=y - -# -# SPI RAM config -# -# CONFIG_SPIRAM_MODE_QUAD is not set -CONFIG_SPIRAM_MODE_OCT=y -# CONFIG_SPIRAM_TYPE_AUTO is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM64=y -CONFIG_SPIRAM_SIZE=8388608 -# -# PSRAM Clock and CS IO for ESP32S3 -# -CONFIG_DEFAULT_PSRAM_CLK_IO=30 -CONFIG_DEFAULT_PSRAM_CS_IO=26 -# end of PSRAM Clock and CS IO for ESP32S3 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -CONFIG_SPIRAM_SPEED_80M=y -# CONFIG_SPIRAM_SPEED_40M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# end of SPI RAM config - -# end of ESP32S3-Specific - # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s3" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/mpconfigboard.mk b/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/mpconfigboard.mk index 925c4ab6e2..70b2abfede 100644 --- a/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/mpconfigboard.mk +++ b/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/mpconfigboard.mk @@ -6,9 +6,17 @@ USB_MANUFACTURER = "Arduino" IDF_TARGET = esp32s3 +# This has a u-blox® NORA-W106-10B module. + +# This flash lives outside the module. CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m -CIRCUITPY_ESP_FLASH_SIZE = 8MB +CIRCUITPY_ESP_FLASH_SIZE = 16MB + +# This PSRAM is in the module. +CIRCUITPY_ESP_PSRAM_SIZE = 8MB +CIRCUITPY_ESP_PSRAM_MODE = opi +CIRCUITPY_ESP_PSRAM_FREQ = 80m INTERNAL_FLASH_FILESYSTEM = 0 QSPI_FLASH_FILESYSTEM = 1 diff --git a/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/sdkconfig b/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/sdkconfig index 26a26b5fe8..b2e5c546b8 100644 --- a/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/sdkconfig +++ b/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/sdkconfig @@ -1,43 +1,15 @@ # +# Espressif IoT Development Framework Configuration +# +# # Component config # -# -# ESP32S3-Specific -# -CONFIG_ESP32S3_SPIRAM_SUPPORT=y - -# -# SPI RAM config -# -# CONFIG_SPIRAM_MODE_QUAD is not set -CONFIG_SPIRAM_MODE_OCT=y -# CONFIG_SPIRAM_TYPE_AUTO is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM64=y -CONFIG_SPIRAM_SIZE=8388608 -# -# PSRAM Clock and CS IO for ESP32S3 -# -CONFIG_DEFAULT_PSRAM_CLK_IO=30 -CONFIG_DEFAULT_PSRAM_CS_IO=26 -# end of PSRAM Clock and CS IO for ESP32S3 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -CONFIG_SPIRAM_SPEED_80M=y -# CONFIG_SPIRAM_SPEED_40M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# end of SPI RAM config - -# end of ESP32S3-Specific - # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="nano-esp32" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/espressif_esp32_eye/sdkconfig b/ports/espressif/boards/espressif_esp32_eye/sdkconfig index 0ff3ef839f..dc4ef1fc52 100644 --- a/ports/espressif/boards/espressif_esp32_eye/sdkconfig +++ b/ports/espressif/boards/espressif_esp32_eye/sdkconfig @@ -4,17 +4,6 @@ # # Component config # -# -# Hardware Settings -# -# -# Sleep Config -# -CONFIG_ESP_SLEEP_PSRAM_LEAKAGE_WORKAROUND=y -# end of Sleep Config - -# end of Hardware Settings - # # Camera configuration # diff --git a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/mpconfigboard.mk index 83a41e8f3f..51abedf36a 100644 --- a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/mpconfigboard.mk @@ -5,10 +5,10 @@ USB_MANUFACTURER = "Espressif" IDF_TARGET = esp32s2 -CIRCUITPY_ESP_FLASH_MODE = dio -CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB +CIRCUITPY_ESP_FLASH_MODE = qio +CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_PSRAM_SIZE = 2MB CIRCUITPY_ESP_PSRAM_MODE = qio -CIRCUITPY_ESP_PSRAM_FREQ = 40m +CIRCUITPY_ESP_PSRAM_FREQ = 80m diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8_hacktablet/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8_hacktablet/mpconfigboard.mk index 1bd9c0ac8d..99daa4ab98 100644 --- a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8_hacktablet/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8_hacktablet/mpconfigboard.mk @@ -9,4 +9,8 @@ CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 8MB +CIRCUITPY_ESP_PSRAM_SIZE = 8MB +CIRCUITPY_ESP_PSRAM_MODE = opi +CIRCUITPY_ESP_PSRAM_FREQ = 80m + CIRCUITPY_DOTCLOCKFRAMEBUFFER = 1 diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8_hacktablet/sdkconfig b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8_hacktablet/sdkconfig index 40da78d506..0452053c1e 100644 --- a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8_hacktablet/sdkconfig +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8_hacktablet/sdkconfig @@ -1,48 +1,21 @@ # +# Espressif IoT Development Framework Configuration +# +# # Component config # # -# ESP32S3-Specific +# ESP System Settings # -CONFIG_ESP32S3_SPIRAM_SUPPORT=y -# -# SPI RAM config -# -#CONFIG_SPIRAM_MODE_QUAD=y -### NEW ### -CONFIG_SPIRAM_MODE_OCT=y -CONFIG_SPIRAM_TYPE_AUTO=y -####### -# CONFIG_SPIRAM_MODE_OCT is not set -# CONFIG_SPIRAM_TYPE_AUTO is not set -#CONFIG_SPIRAM_TYPE_ESPPSRAM16=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set -#CONFIG_SPIRAM_SIZE=2097152 -CONFIG_SPIRAM_TYPE_ESPPSRAM64=y -CONFIG_SPIRAM_SIZE=8388608 -# -# PSRAM Clock and CS IO for ESP32S3 -# -CONFIG_DEFAULT_PSRAM_CLK_IO=30 -CONFIG_DEFAULT_PSRAM_CS_IO=26 -# end of PSRAM Clock and CS IO for ESP32S3 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -# CONFIG_SPIRAM_SPEED_120M is not set -CONFIG_SPIRAM_SPEED_80M=y -# CONFIG_SPIRAM_SPEED_40M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# end of SPI RAM config - -# end of ESP32S3-Specific +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 @@ -50,13 +23,6 @@ CONFIG_SPIRAM_MEMTEST=y CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s3-hacktablet" # end of LWIP -# CONFIG_ESP_CONSOLE_NONE is not set -CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 -CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_0=y -CONFIG_ESP_CONSOLE_UART_CUSTOM=y -CONFIG_ESP_CONSOLE_UART_NUM=0 -CONFIG_ESP_CONSOLE_UART_RX_GPIO=44 -CONFIG_ESP_CONSOLE_UART_TX_GPIO=43 -CONFIG_ESP_CONSOLE_UART=y - # end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/m5stack_atoms3u/sdkconfig b/ports/espressif/boards/m5stack_atoms3u/sdkconfig index 9d924272ec..f5ef797681 100644 --- a/ports/espressif/boards/m5stack_atoms3u/sdkconfig +++ b/ports/espressif/boards/m5stack_atoms3u/sdkconfig @@ -1,7 +1,15 @@ -CONFIG_ESP32S3_SPIRAM_SUPPORT=n - +# +# Espressif IoT Development Framework Configuration +# +# +# Component config +# # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s3" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/m5stack_core2/sdkconfig b/ports/espressif/boards/m5stack_core2/sdkconfig index b8a37f0d84..c8ac5f43ac 100644 --- a/ports/espressif/boards/m5stack_core2/sdkconfig +++ b/ports/espressif/boards/m5stack_core2/sdkconfig @@ -24,12 +24,6 @@ CONFIG_ESP32_REV_MIN_FULL=300 CONFIG_ESP_REV_MIN_FULL=300 # end of Chip revision -# -# Sleep Config -# -CONFIG_ESP_SLEEP_PSRAM_LEAKAGE_WORKAROUND=y -# end of Sleep Config - # end of Hardware Settings # diff --git a/ports/espressif/boards/m5stack_m5paper/mpconfigboard.mk b/ports/espressif/boards/m5stack_m5paper/mpconfigboard.mk index d3e2bb2aac..bacf270a66 100644 --- a/ports/espressif/boards/m5stack_m5paper/mpconfigboard.mk +++ b/ports/espressif/boards/m5stack_m5paper/mpconfigboard.mk @@ -6,4 +6,9 @@ IDF_TARGET = esp32 CIRCUITPY_ESP_FLASH_MODE = qio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 16MB + +CIRCUITPY_ESP_PSRAM_SIZE = 8MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 80m + CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/m5stack_m5paper/sdkconfig b/ports/espressif/boards/m5stack_m5paper/sdkconfig index afbee57d19..fbf94f2749 100644 --- a/ports/espressif/boards/m5stack_m5paper/sdkconfig +++ b/ports/espressif/boards/m5stack_m5paper/sdkconfig @@ -1,58 +1,37 @@ -CONFIG_ESP32_ECO3_CACHE_LOCK_FIX=y -CONFIG_ESP32_SPIRAM_SUPPORT=y +# +# Espressif IoT Development Framework Configuration +# +# +# Security features +# +CONFIG_SECURE_BOOT_V2_RSA_SUPPORTED=y +CONFIG_SECURE_BOOT_V2_PREFERRED=y +# end of Security features + +# +# Component config +# +# +# Hardware Settings +# +# +# Chip revision +# +# CONFIG_ESP32_REV_MIN_0 is not set CONFIG_ESP32_REV_MIN_3=y +CONFIG_ESP32_REV_MIN=3 +CONFIG_ESP32_REV_MIN_FULL=300 +CONFIG_ESP_REV_MIN_FULL=300 +# end of Chip revision -# -# SPI RAM config -# -CONFIG_SPIRAM_TYPE_AUTO=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -#CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set -CONFIG_SPIRAM_SIZE=8388608 -# end of SPI RAM config +# end of Hardware Settings -# -# PSRAM clock and cs IO for ESP32 -# -CONFIG_D0WD_PSRAM_CLK_IO=17 -CONFIG_D0WD_PSRAM_CS_IO=16 -# end of PSRAM clock and cs IO for ESP32 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -CONFIG_SPIRAM_SPEED_80M=y -# CONFIG_SPIRAM_SPEED_40M is not set -# CONFIG_SPIRAM_SPEED_26M is not set -# CONFIG_SPIRAM_SPEED_20M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="M5Paper" # end of LWIP -# Uncomment (remove ###) to send ESP_LOG output to TX/RX pins -### # -### # ESP System Settings -### # -### CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT=y -### # CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT is not set -### 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_CUSTOM_NUM_1 is not set -### CONFIG_ESP_CONSOLE_UART_NUM=0 -### CONFIG_ESP_CONSOLE_UART_TX_GPIO=17 -### CONFIG_ESP_CONSOLE_UART_RX_GPIO=16 -### CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 -### # CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_5 is not set -### # end of ESP System Settings +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/makerfabs_tft7/mpconfigboard.mk b/ports/espressif/boards/makerfabs_tft7/mpconfigboard.mk index e6efc34ef7..dbe7940c7e 100644 --- a/ports/espressif/boards/makerfabs_tft7/mpconfigboard.mk +++ b/ports/espressif/boards/makerfabs_tft7/mpconfigboard.mk @@ -9,4 +9,8 @@ CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 16MB +CIRCUITPY_ESP_PSRAM_SIZE = 8MB +CIRCUITPY_ESP_PSRAM_MODE = opi +CIRCUITPY_ESP_PSRAM_FREQ = 80m + CIRCUITPY_DOTCLOCKFRAMEBUFFER = 1 diff --git a/ports/espressif/boards/makerfabs_tft7/sdkconfig b/ports/espressif/boards/makerfabs_tft7/sdkconfig index 2514dd506b..e05ead7960 100644 --- a/ports/espressif/boards/makerfabs_tft7/sdkconfig +++ b/ports/espressif/boards/makerfabs_tft7/sdkconfig @@ -1,41 +1,28 @@ -CONFIG_ESP32S3_SPIRAM_SUPPORT=y # -# SPI RAM config +# Espressif IoT Development Framework Configuration # -# CONFIG_SPIRAM_MODE_QUAD is not set -CONFIG_SPIRAM_MODE_OCT=y -CONFIG_SPIRAM_TYPE_AUTO=y -# end of SPI RAM 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 -CONFIG_DEFAULT_PSRAM_CLK_IO=30 -# -# PSRAM Clock and CS IO for ESP32S3 -# -CONFIG_DEFAULT_PSRAM_CS_IO=26 -# end of PSRAM Clock and CS IO for ESP32S3 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -CONFIG_SPIRAM_SPEED_80M=y -# CONFIG_SPIRAM_SPEED_40M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -#CONFIG_SPIRAM_USE_MEMMAP=y -CONFIG_SPIRAM_USE_CAPS_ALLOC=y -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="matouch-tft" # end of LWIP -# -# CONFIG_ESP_CONSOLE_NONE is not set -CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 -CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_0=y -CONFIG_ESP_CONSOLE_UART_CUSTOM=y -CONFIG_ESP_CONSOLE_UART_NUM=0 -CONFIG_ESP_CONSOLE_UART_RX_GPIO=44 -CONFIG_ESP_CONSOLE_UART_TX_GPIO=43 -CONFIG_ESP_CONSOLE_UART=y + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/waveshare_esp32_s3_pico/mpconfigboard.mk b/ports/espressif/boards/waveshare_esp32_s3_pico/mpconfigboard.mk index 116a998b74..76b6eb2206 100644 --- a/ports/espressif/boards/waveshare_esp32_s3_pico/mpconfigboard.mk +++ b/ports/espressif/boards/waveshare_esp32_s3_pico/mpconfigboard.mk @@ -8,3 +8,7 @@ IDF_TARGET = esp32s3 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 16MB + +CIRCUITPY_ESP_PSRAM_SIZE = 2MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 80m diff --git a/ports/espressif/boards/waveshare_esp32_s3_pico/sdkconfig b/ports/espressif/boards/waveshare_esp32_s3_pico/sdkconfig index 3e366f0172..f5ef797681 100644 --- a/ports/espressif/boards/waveshare_esp32_s3_pico/sdkconfig +++ b/ports/espressif/boards/waveshare_esp32_s3_pico/sdkconfig @@ -1,43 +1,9 @@ # +# Espressif IoT Development Framework Configuration +# +# # Component config # -# -# ESP32S3-Specific -# -CONFIG_ESP32S3_SPIRAM_SUPPORT=y -# -# SPI RAM config -# -CONFIG_SPIRAM_MODE_QUAD=y -# CONFIG_SPIRAM_MODE_OCT is not set -# CONFIG_SPIRAM_TYPE_AUTO is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM16=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set -CONFIG_SPIRAM_SIZE=2097152 -# -# PSRAM Clock and CS IO for ESP32S3 -# -CONFIG_DEFAULT_PSRAM_CLK_IO=30 -CONFIG_DEFAULT_PSRAM_CS_IO=26 -# end of PSRAM Clock and CS IO for ESP32S3 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -# CONFIG_SPIRAM_SPEED_120M is not set -CONFIG_SPIRAM_SPEED_80M=y -# CONFIG_SPIRAM_SPEED_40M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# end of SPI RAM config - -# end of ESP32S3-Specific - # # LWIP # @@ -45,3 +11,5 @@ CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s3" # end of LWIP # end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/common-hal/ssl/SSLSocket.c b/ports/espressif/common-hal/ssl/SSLSocket.c index 9413fc7def..b94924000b 100644 --- a/ports/espressif/common-hal/ssl/SSLSocket.c +++ b/ports/espressif/common-hal/ssl/SSLSocket.c @@ -33,6 +33,7 @@ #include "shared/runtime/interrupt_char.h" #include "py/mperrno.h" #include "py/runtime.h" +#include "supervisor/port.h" #include "supervisor/shared/tick.h" #include "lwip/sockets.h" @@ -56,12 +57,16 @@ void common_hal_ssl_sslsocket_close(ssl_sslsocket_obj_t *self) { void common_hal_ssl_sslsocket_connect(ssl_sslsocket_obj_t *self, const char *host, size_t hostlen, uint32_t port) { + // Yield briefly so that the IDF can clean up memory before we need more. + port_yield(); int result = esp_tls_conn_new_sync(host, hostlen, port, &self->ssl_config, self->tls); self->sock->connected = result >= 0; if (result < 0) { int esp_tls_code; int flags; - esp_err_t err = esp_tls_get_and_clear_last_error(self->tls_error_handle, &esp_tls_code, &flags); + esp_tls_error_handle_t tls_error_handle; + esp_tls_get_error_handle(self->tls, &tls_error_handle); + esp_err_t err = esp_tls_get_and_clear_last_error(tls_error_handle, &esp_tls_code, &flags); if (err == ESP_ERR_MBEDTLS_SSL_SETUP_FAILED) { mp_raise_espidf_MemoryError(); @@ -155,7 +160,9 @@ mp_uint_t common_hal_ssl_sslsocket_send(ssl_sslsocket_obj_t *self, const uint8_t if (sent < 0) { int esp_tls_code; int flags; - esp_err_t err = esp_tls_get_and_clear_last_error(self->tls_error_handle, &esp_tls_code, &flags); + esp_tls_error_handle_t tls_error_handle; + esp_tls_get_error_handle(self->tls, &tls_error_handle); + esp_err_t err = esp_tls_get_and_clear_last_error(tls_error_handle, &esp_tls_code, &flags); if (err == ESP_ERR_MBEDTLS_SSL_SETUP_FAILED) { mp_raise_espidf_MemoryError(); diff --git a/ports/espressif/common-hal/ssl/SSLSocket.h b/ports/espressif/common-hal/ssl/SSLSocket.h index a7977db746..6b65a56223 100644 --- a/ports/espressif/common-hal/ssl/SSLSocket.h +++ b/ports/espressif/common-hal/ssl/SSLSocket.h @@ -38,7 +38,6 @@ typedef struct ssl_sslsocket_obj { mp_obj_base_t base; socketpool_socket_obj_t *sock; esp_tls_t *tls; - esp_tls_error_handle_t tls_error_handle; ssl_sslcontext_obj_t *ssl_context; esp_tls_cfg_t ssl_config; } ssl_sslsocket_obj_t; diff --git a/ports/espressif/common-hal/wifi/__init__.c b/ports/espressif/common-hal/wifi/__init__.c index 1ffc768002..769ed8ab04 100644 --- a/ports/espressif/common-hal/wifi/__init__.c +++ b/ports/espressif/common-hal/wifi/__init__.c @@ -32,6 +32,7 @@ #include "shared-bindings/wifi/Monitor.h" #include "shared-bindings/wifi/Radio.h" +#include "py/gc.h" #include "py/mpstate.h" #include "py/runtime.h" @@ -162,8 +163,8 @@ void common_hal_wifi_init(bool user_initiated) { if (!wifi_ever_inited) { ESP_ERROR_CHECK(esp_netif_init()); ESP_ERROR_CHECK(esp_event_loop_create_default()); + wifi_ever_inited = true; } - wifi_ever_inited = true; self->netif = esp_netif_create_default_wifi_sta(); self->ap_netif = esp_netif_create_default_wifi_ap(); @@ -201,9 +202,16 @@ void common_hal_wifi_init(bool user_initiated) { #endif esp_err_t result = esp_wifi_init(&config); if (result == ESP_ERR_NO_MEM) { - mp_raise_msg(&mp_type_MemoryError, translate("Failed to allocate Wifi memory")); + if (gc_alloc_possible()) { + mp_raise_msg(&mp_type_MemoryError, translate("Failed to allocate Wifi memory")); + } + ESP_LOGE(TAG, "Failed to allocate Wifi memory"); } else if (result != ESP_OK) { - raise_esp_error(result); + if (gc_alloc_possible()) { + raise_esp_error(result); + } + ESP_LOGE(TAG, "WiFi error code: %d", result); + return; } // set station mode to avoid the default SoftAP common_hal_wifi_radio_start_station(self); diff --git a/ports/espressif/esp-idf-config/sdkconfig-esp32s2.defaults b/ports/espressif/esp-idf-config/sdkconfig-esp32s2.defaults index 6f3d004785..09c5a69663 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-esp32s2.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-esp32s2.defaults @@ -46,6 +46,17 @@ CONFIG_ESP32S2_RTCDATA_IN_FAST_MEM=y # end of ESP System Settings +# +# Wi-Fi +# +CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=4 +CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=8 +CONFIG_ESP32_WIFI_CACHE_TX_BUFFER_NUM=16 +CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM=8 +CONFIG_ESP32_WIFI_RX_BA_WIN=4 +# CONFIG_ESP32_WIFI_NVS_ENABLED is not set +# end of Wi-Fi + # # Newlib # diff --git a/ports/espressif/esp-idf-config/sdkconfig-psram.defaults b/ports/espressif/esp-idf-config/sdkconfig-psram.defaults index d00b1f3d2a..f1bc476a9f 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-psram.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-psram.defaults @@ -4,17 +4,6 @@ # # Component config # -# -# Hardware Settings -# -# -# Sleep Config -# -# CONFIG_ESP_SLEEP_PSRAM_LEAKAGE_WORKAROUND is not set -# end of Sleep Config - -# end of Hardware Settings - # # ESP PSRAM # diff --git a/ports/espressif/esp-idf-config/sdkconfig.defaults b/ports/espressif/esp-idf-config/sdkconfig.defaults index 279c23c2c5..55a8e3cc06 100644 --- a/ports/espressif/esp-idf-config/sdkconfig.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig.defaults @@ -57,6 +57,12 @@ CONFIG_LWIP_TCP_RTO_TIME=3000 # mbedTLS # CONFIG_MBEDTLS_SSL_OUT_CONTENT_LEN=2048 +# +# mbedTLS v3.x related +# +# CONFIG_MBEDTLS_SSL_KEEP_PEER_CERTIFICATE is not set +# end of mbedTLS v3.x related + # # Certificate Bundle # @@ -65,7 +71,6 @@ CONFIG_MBEDTLS_CUSTOM_CERTIFICATE_BUNDLE=y CONFIG_MBEDTLS_CUSTOM_CERTIFICATE_BUNDLE_PATH="../../lib/certificates/data/roots.pem" # end of Certificate Bundle -CONFIG_MBEDTLS_TLS_CLIENT_ONLY=y # # TLS Key Exchange Methods # diff --git a/ports/espressif/supervisor/port.c b/ports/espressif/supervisor/port.c index 2d2089a587..d605dc2b79 100644 --- a/ports/espressif/supervisor/port.c +++ b/ports/espressif/supervisor/port.c @@ -251,7 +251,7 @@ safe_mode_t port_init(void) { // Send the ROM output out of the UART. This includes early logs. #if DEBUG - ets_install_uart_printf(); + esp_rom_install_uart_printf(); #endif heap = NULL; diff --git a/ports/espressif/tools/update_sdkconfig.py b/ports/espressif/tools/update_sdkconfig.py index 898c8979eb..42500412e0 100644 --- a/ports/espressif/tools/update_sdkconfig.py +++ b/ports/espressif/tools/update_sdkconfig.py @@ -163,6 +163,7 @@ def update(debug, board, update_all): board_make = pathlib.Path(f"boards/{board}/mpconfigboard.mk") psram_size = "0" + uf2_bootloader = None for line in board_make.read_text().split("\n"): if "=" not in line or line.startswith("#"): continue @@ -171,6 +172,8 @@ def update(debug, board, update_all): value = value.strip() if key == "IDF_TARGET": target = value + if uf2_bootloader is None: + uf2_bootloader = target not in ("esp32", "esp32c3") elif key == "CIRCUITPY_ESP_FLASH_SIZE": flash_size = value elif key == "CIRCUITPY_ESP_FLASH_MODE": @@ -183,6 +186,8 @@ def update(debug, board, update_all): psram_mode = value elif key == "CIRCUITPY_ESP_PSRAM_FREQ": psram_freq = value + elif key == "UF2_BOOTLOADER": + uf2_bootloader = not (value == "0") os.environ["IDF_TARGET"] = target os.environ[ @@ -209,7 +214,7 @@ def update(debug, board, update_all): size_options = "" if flash_size == "2MB": size_options = "-no-ota-no-uf2" - elif target in ("esp32", "esp32c3"): + elif not uf2_bootloader: # These boards don't have native USB. size_options = "-no-uf2" flash_size_config = pathlib.Path(