From c6b19bb70ce559edb5918f4cec4e77e50dd4a406 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 10 Oct 2026 17:50:13 +0200 Subject: [PATCH] Initial ESP32-S31 support (#25130) * ESP32-S31 support (#588) * Arduino IDF 6.1 based framework only for S31 * code review changes Thei for tasmota_types.h --- boards/esp32s31-qio_opi.json | 59 ++ boards/esp32s31ser-qio_opi.json | 57 ++ include/esp32x_fixes.h | 4 +- lib/default/Ext-printf/src/ext_printf.cpp | 24 +- .../WiFiHelper/src/WiFiHelper_ESP32.cpp | 11 +- lib/lib_audio/ESP8266SAM/src/sam.c | 2 +- lib/lib_audio/mp3_shine_esp32/src/layer3.cpp | 16 +- .../src/internal/NeoEspBitBangMethod.cpp | 3 + .../TasmotaLED/src/TasmotaLEDPusherRMT.cpp | 6 + .../TasmotaLED/src/TasmotaLEDPusherSPI.cpp | 6 + .../TasmotaOneWire-2.3.3/OneWire.cpp | 29 + lib/lib_display/UDisplay/include/uDisplay.h | 4 + .../include/uDisplay_SPI_controller.h | 4 + .../UDisplay/include/uDisplay_panel.h | 2 +- lib/lib_display/UDisplay/src/uDisplay.cpp | 15 + .../UDisplay/src/uDisplay_DSI_panel.cpp | 16 +- .../UDisplay/src/uDisplay_SPI_controller.cpp | 36 +- .../QuickESPNow/src/QuickEspNow_esp32.h | 8 +- .../bearssl-esp8266/src/ec/_ec_c25519_m15.c | 9 +- .../bearssl-esp8266/src/ec/_ec_p256_m15.c | 2 +- .../src/esp8266toEsp32.cpp | 4 +- .../berry_tasmota/src/be_crc32_module.c | 7 + .../draw/sw/blend/helium/lv_blend_helium.S | 5 + .../esp32_partition_app3904k_fs11392k.csv | 6 + .../esp32_partition_app3904k_fs11456k.csv | 6 + pins_arduino/esp32s31/pins_arduino.h | 94 +++ pio-tools/name-firmware.py | 4 +- platformio_tasmota_env32.ini | 33 + sdkconfig.defaults | 710 +++++++++++------- tasmota/idf_component.yml | 2 +- tasmota/include/tasmota.h | 33 +- tasmota/include/tasmota_compat.h | 11 + .../include/tasmota_configurations_ESP32.h | 4 +- tasmota/include/tasmota_globals.h | 2 + tasmota/include/tasmota_template.h | 121 ++- tasmota/include/tasmota_types.h | 32 +- tasmota/tasmota.ino | 9 +- tasmota/tasmota_support/settings.ino | 6 + tasmota/tasmota_support/support.ino | 18 +- tasmota/tasmota_support/support_command.ino | 8 +- .../support_crash_recorder.ino | 23 +- tasmota/tasmota_support/support_esp32.ino | 7 + tasmota/tasmota_support/support_wifi.ino | 22 +- .../xdrv_01_9_webserver.ino | 8 +- .../xdrv_07_ufs_domoticz.ino | 4 +- .../tasmota_xdrv_driver/xdrv_10_scripter.ino | 2 + .../xdrv_121_gpioviewer.ino | 5 + .../xdrv_82_esp32_ethernet.ino | 6 + .../xdrv_84_esp32_hosted.ino | 7 + .../xdrv_91_esp32_twai.ino | 2 +- .../xsns_52_esp32_ibeacon_ble.ino | 2 +- .../xsns_62_esp32_mi_ble.ino | 2 +- 52 files changed, 1172 insertions(+), 346 deletions(-) create mode 100644 boards/esp32s31-qio_opi.json create mode 100644 boards/esp32s31ser-qio_opi.json create mode 100644 partitions/esp32_partition_app3904k_fs11392k.csv create mode 100644 partitions/esp32_partition_app3904k_fs11456k.csv create mode 100644 pins_arduino/esp32s31/pins_arduino.h diff --git a/boards/esp32s31-qio_opi.json b/boards/esp32s31-qio_opi.json new file mode 100644 index 000000000..8629f4c04 --- /dev/null +++ b/boards/esp32s31-qio_opi.json @@ -0,0 +1,59 @@ +{ + "build": { + "arduino": { + "memory_type": "qio_opi" + }, + "core": "esp32", + "extra_flags": [ + "-DARDUINO_TASMOTA", + "-DBOARD_HAS_PSRAM", + "-DARDUINO_USB_MODE=1", + "-DUSE_USB_CDC_CONSOLE", + "-DESP32_16M", + "-DESP32S31" + ], + "f_cpu": "320000000L", + "f_flash": "80000000L", + "flash_mode": "qio", + "psram_type": "opi", + "mcu": "esp32s31", + "variant": "esp32s31", + "partitions": "partitions/esp32_partition_app3904k_fs11392k.csv" + }, + "connectivity": [ + "bluetooth", + "wifi" + ], + "debug": { + "default_tool": "esp-builtin", + "onboard_tools": [ + "esp-builtin" + ], + "openocd_target": "esp32s31.cfg" + }, + "frameworks": [ + "arduino", + "espidf" + ], + "name": "Espressif ESP32-S31 (16 MB Flash Quad, 16 MB PSRAM Octal)", + "upload": { + "arduino": { + "flash_extra_images": [ + [ + "0x10000", + "tasmota32s31-safeboot.bin" + ] + ] + }, + "flash_size": "16MB", + "maximum_ram_size": 327680, + "maximum_size": 16777216, + "require_upload_port": true, + "speed": 2000000 + }, + "download": { + "speed": 2000000 + }, + "url": "https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s31/esp32-s31-function-coreboard-1/index.html", + "vendor": "Espressif" +} \ No newline at end of file diff --git a/boards/esp32s31ser-qio_opi.json b/boards/esp32s31ser-qio_opi.json new file mode 100644 index 000000000..07e73aad8 --- /dev/null +++ b/boards/esp32s31ser-qio_opi.json @@ -0,0 +1,57 @@ +{ + "build": { + "arduino": { + "memory_type": "qio_opi" + }, + "core": "esp32", + "extra_flags": [ + "-DARDUINO_TASMOTA", + "-DBOARD_HAS_PSRAM", + "-DESP32_16M", + "-DESP32S31" + ], + "f_cpu": "320000000L", + "f_flash": "80000000L", + "flash_mode": "qio", + "psram_type": "opi", + "mcu": "esp32s31", + "variant": "esp32s31", + "partitions": "partitions/esp32_partition_app3904k_fs11392k.csv" + }, + "connectivity": [ + "bluetooth", + "wifi" + ], + "debug": { + "default_tool": "esp-builtin", + "onboard_tools": [ + "esp-builtin" + ], + "openocd_target": "esp32s31.cfg" + }, + "frameworks": [ + "arduino", + "espidf" + ], + "name": "Espressif ESP32-S31 (16 MB Flash Quad, 16 MB PSRAM Octal)", + "upload": { + "arduino": { + "flash_extra_images": [ + [ + "0x10000", + "tasmota32s31ser-safeboot.bin" + ] + ] + }, + "flash_size": "16MB", + "maximum_ram_size": 327680, + "maximum_size": 16777216, + "require_upload_port": true, + "speed": 2000000 + }, + "download": { + "speed": 2000000 + }, + "url": "https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32s31/esp32-s31-function-coreboard-1/index.html", + "vendor": "Espressif" +} \ No newline at end of file diff --git a/include/esp32x_fixes.h b/include/esp32x_fixes.h index 1ceb15b3e..cafb01074 100644 --- a/include/esp32x_fixes.h +++ b/include/esp32x_fixes.h @@ -52,13 +52,13 @@ #define HSPI_HOST SPI3_HOST #define VSPI_HOST SPI3_HOST -#elif CONFIG_IDF_TARGET_ESP32S3 +#elif CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32S31 // SPI_HOST (SPI1_HOST) is not supported by the SPI Master and SPI Slave driver on ESP32-S2 and later #define SPI_HOST SPI1_HOST #define FSPI_HOST SPI2_HOST #define HSPI_HOST SPI3_HOST #define VSPI_HOST SPI3_HOST -// SPI_MOSI_DLEN_REG is not defined anymore in esp32s3 +// SPI_MOSI_DLEN_REG is not defined anymore on S3/S31 #define SPI_MOSI_DLEN_REG(x) SPI_MS_DLEN_REG(x) #elif CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32P4 diff --git a/lib/default/Ext-printf/src/ext_printf.cpp b/lib/default/Ext-printf/src/ext_printf.cpp index 65ff73212..7890f01f6 100644 --- a/lib/default/Ext-printf/src/ext_printf.cpp +++ b/lib/default/Ext-printf/src/ext_printf.cpp @@ -21,6 +21,9 @@ #include #include #include +#ifdef ESP32 +#include "esp_memory_utils.h" +#endif // ESP32 /*********************************************************************************************\ * va_list extended support @@ -255,7 +258,14 @@ char * copyStr(const char * str) { } const char ext_invalid_mem[] PROGMEM = "<--INVALID-->"; -const uint32_t min_valid_ptr = 0x3F000000; // addresses below this line are invalid + +static bool ext_ptr_is_readable(uint32_t ptr) { +#ifdef ESP32 + return esp_ptr_byte_accessible((const void *)(uintptr_t)ptr); +#else // ESP32 + return ptr >= 0x3F000000; +#endif // ESP32 +} int32_t ext_vsnprintf_P(char * out_buf, size_t buf_len, const char * fmt_P, va_list va) { va_list va_cpy; @@ -315,7 +325,7 @@ int32_t ext_vsnprintf_P(char * out_buf, size_t buf_len, const char * fmt_P, va_l case 'H': // Hex, decimals indicates the length, default 2 { if (decimals < 0) { decimals = 0; } - if (cur_val < min_valid_ptr) { new_val_str = ext_invalid_mem; } + if (!ext_ptr_is_readable(cur_val)) { new_val_str = ext_invalid_mem; } else if (decimals > 0) { char * hex_char = (char*) malloc(decimals*2 + 2); if (hex_char == nullptr) { goto free_allocs; } @@ -329,7 +339,7 @@ int32_t ext_vsnprintf_P(char * out_buf, size_t buf_len, const char * fmt_P, va_l case 'B': // Pointer to SBuffer { - if (cur_val < min_valid_ptr) { new_val_str = ext_invalid_mem; } + if (!ext_ptr_is_readable(cur_val)) { new_val_str = ext_invalid_mem; } else { const SBuffer & buf = *(const SBuffer*)cur_val; size_t buf_len = (&buf != nullptr) ? buf.len() : 0; @@ -358,7 +368,7 @@ int32_t ext_vsnprintf_P(char * out_buf, size_t buf_len, const char * fmt_P, va_l case 'V': // 2-byte values, decimals indicates the length, default 2 { if (decimals < 0) { decimals = 0; } - if (cur_val < min_valid_ptr) { new_val_str = ext_invalid_mem; } + if (!ext_ptr_is_readable(cur_val)) { new_val_str = ext_invalid_mem; } else if (decimals > 0) { uint32_t val_size = decimals*6 + 2; char * val_char = (char*) malloc(val_size); @@ -402,7 +412,7 @@ int32_t ext_vsnprintf_P(char * out_buf, size_t buf_len, const char * fmt_P, va_l // Note: float MUST be passed by address, because C alsays promoted float to double when in vararg case 'f': // input is `float`, printed to float with 2 decimals { - if (cur_val < min_valid_ptr) { new_val_str = ext_invalid_mem; } + if (!ext_ptr_is_readable(cur_val)) { new_val_str = ext_invalid_mem; } else { bool truncate = false; if (decimals < 0) { @@ -438,7 +448,7 @@ int32_t ext_vsnprintf_P(char * out_buf, size_t buf_len, const char * fmt_P, va_l // '%_X' outputs a 64 bits unsigned int to uppercase HEX with 16 digits case 'X': // input is `uint64_t*`, printed as 16 hex digits (no prefix 0x) { - if (cur_val < min_valid_ptr) { new_val_str = ext_invalid_mem; } + if (!ext_ptr_is_readable(cur_val)) { new_val_str = ext_invalid_mem; } else { if ((decimals < 0) || (decimals > 16)) { decimals = 16; } U64toHex(*(uint64_t*)cur_val, hex, decimals); @@ -452,7 +462,7 @@ int32_t ext_vsnprintf_P(char * out_buf, size_t buf_len, const char * fmt_P, va_l // '%_U' outputs a 64 bits unsigned int to decimal case 'U': // input is `uint64_t*`, printed as decimal { - if (cur_val < min_valid_ptr) { new_val_str = ext_invalid_mem; } + if (!ext_ptr_is_readable(cur_val)) { new_val_str = ext_invalid_mem; } else { U64toStr(*(uint64_t*)cur_val, hex); new_val_str = copyStr(hex); diff --git a/lib/default/WiFiHelper/src/WiFiHelper_ESP32.cpp b/lib/default/WiFiHelper/src/WiFiHelper_ESP32.cpp index 5aa0ba89d..6876d5ec8 100644 --- a/lib/default/WiFiHelper/src/WiFiHelper_ESP32.cpp +++ b/lib/default/WiFiHelper/src/WiFiHelper_ESP32.cpp @@ -212,7 +212,12 @@ bool WiFiHelper::setPhyMode(WiFiPhyMode_t mode) { Thus you are more likely to experience disturbances. The response speed and stability is better at HT20 for ESP units. */ + // IDF < 6: WIFI_BW_HT20 / IDF >= 6: renamed to WIFI_BW20 +#if ESP_IDF_VERSION_MAJOR < 6 esp_wifi_set_bandwidth(WIFI_IF_STA, WIFI_BW_HT20); +#else + esp_wifi_set_bandwidth(WIFI_IF_STA, WIFI_BW20); +#endif /* ESPEasy: Set to use "Long GI" making it more resilliant to reflections @@ -405,13 +410,13 @@ int WiFiHelper::hostByName(const char* aHostname, IPAddress& aResult) String WiFiHelper::macAddress(void) { uint8_t mac[6] = {0,0,0,0,0,0}; char macStr[18] = { 0 }; -#ifdef CONFIG_SOC_HAS_WIFI +#if defined(SOC_WIFI_SUPPORTED) || defined(CONFIG_SOC_HAS_WIFI) esp_read_mac(mac, ESP_MAC_WIFI_STA); // Local WiFi station MAC address #elif CONFIG_ESP_WIFI_REMOTE_ENABLED WiFi.macAddress(mac); // Remote WiFi station MAC address (devices without WiFi but hostedMCU) -#else // No CONFIG_SOC_HAS_WIFI +#else // defined(SOC_WIFI_SUPPORTED) || defined(CONFIG_SOC_HAS_WIFI) esp_read_mac(mac, ESP_MAC_BASE); // Local hardware base MAC address -#endif // CONFIG_SOC_HAS_WIFI +#endif // defined(SOC_WIFI_SUPPORTED) || defined(CONFIG_SOC_HAS_WIFI) snprintf(macStr, sizeof(macStr), "%02X:%02X:%02X:%02X:%02X:%02X", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); return String(macStr); } diff --git a/lib/lib_audio/ESP8266SAM/src/sam.c b/lib/lib_audio/ESP8266SAM/src/sam.c index c20d8dd2a..c1266224f 100644 --- a/lib/lib_audio/ESP8266SAM/src/sam.c +++ b/lib/lib_audio/ESP8266SAM/src/sam.c @@ -64,7 +64,7 @@ int GetBufferLength(){return bufferpos;}; void Init(); int Parser1(); void Parser2(); -int SAMMain(); +int SAMMain( void (*cb)(void *, unsigned char), void *cbdata ); void CopyStress(); void SetPhonemeLength(); void AdjustLengths(); diff --git a/lib/lib_audio/mp3_shine_esp32/src/layer3.cpp b/lib/lib_audio/mp3_shine_esp32/src/layer3.cpp index 16fd65d37..9dd135c81 100755 --- a/lib/lib_audio/mp3_shine_esp32/src/layer3.cpp +++ b/lib/lib_audio/mp3_shine_esp32/src/layer3.cpp @@ -10,6 +10,7 @@ #include "l3loop.h" #include "bitstream.h" #include "l3bitstream.h" +#include "esp_cpu.h" #include "esp_heap_caps.h" #include "esp_system.h" #include "freertos/FreeRTOS.h" @@ -226,8 +227,7 @@ Counters 2664123380 : 2664123448 : 2666717886 : 2668665908 : 2668859025 static unsigned char *shine_encode_buffer_internal(shine_global_config *config, int *written, int stride) { - counter[0] = portGET_RUN_TIME_COUNTER_VALUE(); // TASMOTA more portable solution - // counter[0] = xthal_get_ccount(); + counter[0] = (uint32_t)esp_cpu_get_cycle_count(); if(config->mpeg.frac_slots_per_frame) { config->mpeg.padding = (config->mpeg.slot_lag <= (config->mpeg.frac_slots_per_frame - 1.0)); config->mpeg.slot_lag += (config->mpeg.padding - config->mpeg.frac_slots_per_frame); @@ -235,22 +235,18 @@ static unsigned char *shine_encode_buffer_internal(shine_global_config *config, config->mpeg.bits_per_frame = 8*(config->mpeg.whole_slots_per_frame + config->mpeg.padding); config->mean_bits = (config->mpeg.bits_per_frame - config->sideinfo_len)/config->mpeg.granules_per_frame; - counter[1] = portGET_RUN_TIME_COUNTER_VALUE(); // TASMOTA more portable solution - // counter[1] = xthal_get_ccount(); + counter[1] = (uint32_t)esp_cpu_get_cycle_count(); /* apply mdct to the polyphase output */ // put on core 1 shine_mdct_sub(config, stride); - counter[2] = portGET_RUN_TIME_COUNTER_VALUE(); // TASMOTA more portable solution - // counter[2] = xthal_get_ccount(); + counter[2] = (uint32_t)esp_cpu_get_cycle_count(); /* bit and noise allocation */ //put on core 0 shine_iteration_loop(config); - counter[3] = portGET_RUN_TIME_COUNTER_VALUE(); // TASMOTA more portable solution - // counter[3] = xthal_get_ccount(); + counter[3] = (uint32_t)esp_cpu_get_cycle_count(); /* write the frame to the bitstream */ shine_format_bitstream(config); - counter[4] = portGET_RUN_TIME_COUNTER_VALUE(); // TASMOTA more portable solution - // counter[4] = xthal_get_ccount(); + counter[4] = (uint32_t)esp_cpu_get_cycle_count(); /* Return data. */ *written = config->bs.data_position; config->bs.data_position = 0; diff --git a/lib/lib_basic/NeoPixelBus/src/internal/NeoEspBitBangMethod.cpp b/lib/lib_basic/NeoPixelBus/src/internal/NeoEspBitBangMethod.cpp index 60f79f992..25b31ad48 100644 --- a/lib/lib_basic/NeoPixelBus/src/internal/NeoEspBitBangMethod.cpp +++ b/lib/lib_basic/NeoPixelBus/src/internal/NeoEspBitBangMethod.cpp @@ -32,6 +32,9 @@ License along with NeoPixel. If not, see #if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C2) && !defined(CONFIG_IDF_TARGET_ESP32C5) && !defined(CONFIG_IDF_TARGET_ESP32C6) #if !defined(ARDUINO_ARCH_ESP8266) #include "soc/gpio_periph.h" +#if __has_include("soc/gpio_struct.h") +#include "soc/gpio_struct.h" +#endif #endif static inline uint32_t getCycleCount(void) diff --git a/lib/lib_basic/TasmotaLED/src/TasmotaLEDPusherRMT.cpp b/lib/lib_basic/TasmotaLED/src/TasmotaLEDPusherRMT.cpp index 592efc047..1283fb64e 100644 --- a/lib/lib_basic/TasmotaLED/src/TasmotaLEDPusherRMT.cpp +++ b/lib/lib_basic/TasmotaLED/src/TasmotaLEDPusherRMT.cpp @@ -25,6 +25,12 @@ #if TASMOTALED_HARDWARE_RMT #include #include +#include "esp_idf_version.h" +#if ESP_IDF_VERSION_MAJOR >= 6 +// IDF 6.x: gpio_matrix_out() renamed to gpio_matrix_output() in esp_private/gpio.h +#include +#define gpio_matrix_out(gpio, signal, out_inv, oen_inv) gpio_matrix_output((gpio_num_t)(gpio), signal, out_inv, oen_inv) +#endif //************************************************************************************************************** // enable AddLog support within a C++ library diff --git a/lib/lib_basic/TasmotaLED/src/TasmotaLEDPusherSPI.cpp b/lib/lib_basic/TasmotaLED/src/TasmotaLEDPusherSPI.cpp index c2ebb2eb0..ed92b321d 100644 --- a/lib/lib_basic/TasmotaLED/src/TasmotaLEDPusherSPI.cpp +++ b/lib/lib_basic/TasmotaLED/src/TasmotaLEDPusherSPI.cpp @@ -24,6 +24,12 @@ #if TASMOTALED_HARDWARE_SPI #include +#include "esp_idf_version.h" +#if ESP_IDF_VERSION_MAJOR >= 6 +// IDF 6.x: gpio_matrix_out() renamed to gpio_matrix_output() in esp_private/gpio.h +#include +#define gpio_matrix_out(gpio, signal, out_inv, oen_inv) gpio_matrix_output((gpio_num_t)(gpio), signal, out_inv, oen_inv) +#endif //************************************************************************************************************** // enable AddLog support within a C++ library diff --git a/lib/lib_basic/TasmotaOneWire-2.3.3/OneWire.cpp b/lib/lib_basic/TasmotaOneWire-2.3.3/OneWire.cpp index d44584540..bb10c732a 100644 --- a/lib/lib_basic/TasmotaOneWire-2.3.3/OneWire.cpp +++ b/lib/lib_basic/TasmotaOneWire-2.3.3/OneWire.cpp @@ -226,6 +226,10 @@ bool directRead(IO_REG_TYPE mask) #if ESP_IDF_VERSION_MAJOR >= 5 #include "soc/gpio_periph.h" #endif // ESP_IDF_VERSION_MAJOR >= 5 +#if __has_include("soc/gpio_struct.h") +// IDF 6.x: GPIO register struct no longer exported via gpio_periph.h +#include "soc/gpio_struct.h" +#endif #define PIN_TO_BASEREG(pin) (0) #define PIN_TO_BITMASK(pin) (pin) #define IO_REG_TYPE uint32_t @@ -237,6 +241,11 @@ IO_REG_TYPE directRead(IO_REG_TYPE pin) { #if SOC_GPIO_PIN_COUNT <= 32 || CONFIG_IDF_TARGET_ESP32P4 return (GPIO.in.val >> pin) & 0x1; +#elif CONFIG_IDF_TARGET_ESP32S31 + if ( pin < 32 ) + return (GPIO.in.val >> pin) & 0x1; + else + return (GPIO.in1.val >> (pin - 32)) & 0x1; #else // ESP32 with over 32 gpios if ( pin < 32 ) return (GPIO.in >> pin) & 0x1; @@ -252,6 +261,11 @@ void directWriteLow(IO_REG_TYPE pin) { #if SOC_GPIO_PIN_COUNT <= 32 || CONFIG_IDF_TARGET_ESP32P4 GPIO.out_w1tc.val = ((uint32_t)1 << pin); +#elif CONFIG_IDF_TARGET_ESP32S31 + if ( pin < 32 ) + GPIO.out_w1tc.val = ((uint32_t)1 << pin); + else + GPIO.out1_w1tc.val = ((uint32_t)1 << (pin - 32)); #else // ESP32 with over 32 gpios if ( pin < 32 ) GPIO.out_w1tc = ((uint32_t)1 << pin); @@ -265,6 +279,11 @@ void directWriteHigh(IO_REG_TYPE pin) { #if SOC_GPIO_PIN_COUNT <= 32 || CONFIG_IDF_TARGET_ESP32P4 GPIO.out_w1ts.val = ((uint32_t)1 << pin); +#elif CONFIG_IDF_TARGET_ESP32S31 + if ( pin < 32 ) + GPIO.out_w1ts.val = ((uint32_t)1 << pin); + else + GPIO.out1_w1ts.val = ((uint32_t)1 << (pin - 32)); #else // ESP32 with over 32 gpios if ( pin < 32 ) GPIO.out_w1ts = ((uint32_t)1 << pin); @@ -282,6 +301,11 @@ void directModeInput(IO_REG_TYPE pin) // Input #if SOC_GPIO_PIN_COUNT <= 32 || CONFIG_IDF_TARGET_ESP32P4 GPIO.enable_w1tc.val = ((uint32_t)1 << (pin)); +#elif CONFIG_IDF_TARGET_ESP32S31 + if ( pin < 32 ) + GPIO.enable_w1tc.val = ((uint32_t)1 << pin); + else + GPIO.enable1_w1tc.val = ((uint32_t)1 << (pin - 32)); #else // ESP32 with over 32 gpios if ( pin < 32 ) GPIO.enable_w1tc = ((uint32_t)1 << pin); @@ -300,6 +324,11 @@ void directModeOutput(IO_REG_TYPE pin) // Output #if SOC_GPIO_PIN_COUNT <= 32 || CONFIG_IDF_TARGET_ESP32P4 GPIO.enable_w1ts.val = ((uint32_t)1 << (pin)); +#elif CONFIG_IDF_TARGET_ESP32S31 + if ( pin < 32 ) + GPIO.enable_w1ts.val = ((uint32_t)1 << pin); + else + GPIO.enable1_w1ts.val = ((uint32_t)1 << (pin - 32)); #else // ESP32 with over 32 gpios if ( pin < 32 ) GPIO.enable_w1ts = ((uint32_t)1 << pin); diff --git a/lib/lib_display/UDisplay/include/uDisplay.h b/lib/lib_display/UDisplay/include/uDisplay.h index 5fc53591b..0d3ac97ee 100644 --- a/lib/lib_display/UDisplay/include/uDisplay.h +++ b/lib/lib_display/UDisplay/include/uDisplay.h @@ -29,6 +29,10 @@ #define USE_ESP32_S3 #endif #include "soc/gpio_periph.h" +#if __has_include("soc/gpio_struct.h") +// IDF 6.x: GPIO register struct no longer exported via gpio_periph.h +#include "soc/gpio_struct.h" +#endif #include // #include "driver/spi_master.h" #endif diff --git a/lib/lib_display/UDisplay/include/uDisplay_SPI_controller.h b/lib/lib_display/UDisplay/include/uDisplay_SPI_controller.h index e93f34ad9..d99ede467 100644 --- a/lib/lib_display/UDisplay/include/uDisplay_SPI_controller.h +++ b/lib/lib_display/UDisplay/include/uDisplay_SPI_controller.h @@ -10,6 +10,10 @@ #include "esp32-hal-spi.h" #include "driver/spi_master.h" #include "soc/gpio_periph.h" +#if __has_include("soc/gpio_struct.h") +// IDF 6.x: GPIO register struct no longer exported via gpio_periph.h +#include "soc/gpio_struct.h" +#endif #endif #ifndef ESP32 diff --git a/lib/lib_display/UDisplay/include/uDisplay_panel.h b/lib/lib_display/UDisplay/include/uDisplay_panel.h index fd35ca9ce..65ab6d1fa 100644 --- a/lib/lib_display/UDisplay/include/uDisplay_panel.h +++ b/lib/lib_display/UDisplay/include/uDisplay_panel.h @@ -4,7 +4,7 @@ #pragma once -#if CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32S31 #include "esp_cache.h" #define CACHE_WRITEBACK_ADDR(addr, size) esp_cache_msync((void*)addr, size, ESP_CACHE_MSYNC_FLAG_DIR_C2M) #else diff --git a/lib/lib_display/UDisplay/src/uDisplay.cpp b/lib/lib_display/UDisplay/src/uDisplay.cpp index 1de0ee144..bf05b323d 100644 --- a/lib/lib_display/UDisplay/src/uDisplay.cpp +++ b/lib/lib_display/UDisplay/src/uDisplay.cpp @@ -313,10 +313,18 @@ uDisplay::uDisplay(char *lp) : Renderer(800, 600) { // Parse data pins directly into RGB config // Note: byte order may be swapped later based on lvgl_param.swap_color for (uint32_t cnt = 0; cnt < 8; cnt++) { + #if ESP_IDF_VERSION_MAJOR < 6 panel_config->rgb.data_gpio_nums[cnt + 8] = next_val(&lp1); + #else + panel_config->rgb.data_gpio_nums[cnt + 8] = (gpio_num_t)next_val(&lp1); + #endif } for (uint32_t cnt = 0; cnt < 8; cnt++) { + #if ESP_IDF_VERSION_MAJOR < 6 panel_config->rgb.data_gpio_nums[cnt] = next_val(&lp1); + #else + panel_config->rgb.data_gpio_nums[cnt] = (gpio_num_t)next_val(&lp1); + #endif } spi_speed = next_val(&lp1); #endif //SOC_LCD_RGB_SUPPORTED @@ -1326,13 +1334,20 @@ if (interface == _UDSP_SPI) { panel_config->rgb.timings.h_res = gxs; panel_config->rgb.timings.v_res = gys; panel_config->rgb.data_width = 16; // RGB565 in parallel mode, thus 16bit in width +#if ESP_IDF_VERSION_MAJOR < 6 + // sram_trans_align / psram_trans_align removed in IDF 6.x panel_config->rgb.sram_trans_align = 8; panel_config->rgb.psram_trans_align = 64; +#endif // Handle byte swapping by swapping the low and high byte pin assignments if (lvgl_param.swap_color) { for (uint32_t cnt = 0; cnt < 8; cnt++) { + #if ESP_IDF_VERSION_MAJOR < 6 int8_t temp = panel_config->rgb.data_gpio_nums[cnt]; + #else + gpio_num_t temp = panel_config->rgb.data_gpio_nums[cnt]; + #endif panel_config->rgb.data_gpio_nums[cnt] = panel_config->rgb.data_gpio_nums[cnt + 8]; panel_config->rgb.data_gpio_nums[cnt + 8] = temp; } diff --git a/lib/lib_display/UDisplay/src/uDisplay_DSI_panel.cpp b/lib/lib_display/UDisplay/src/uDisplay_DSI_panel.cpp index b863d3262..0fb4b7571 100644 --- a/lib/lib_display/UDisplay/src/uDisplay_DSI_panel.cpp +++ b/lib/lib_display/UDisplay/src/uDisplay_DSI_panel.cpp @@ -8,6 +8,7 @@ #include "esp_lcd_panel_ops.h" #include "esp_lcd_mipi_dsi.h" #include "esp_ldo_regulator.h" +#include "esp_idf_version.h" #include "driver/gpio.h" #include #include "esp_rom_sys.h" @@ -70,7 +71,12 @@ DSIPanel::DSIPanel(const DSIPanelConfig& config) dpi_config.dpi_clk_src = MIPI_DSI_DPI_CLK_SRC_DEFAULT; dpi_config.dpi_clock_freq_mhz = cfg.pixel_clock_hz / 1000000; dpi_config.virtual_channel = 0; +#if ESP_IDF_VERSION_MAJOR >= 6 + dpi_config.in_color_format = LCD_COLOR_FMT_RGB565; + dpi_config.out_color_format = LCD_COLOR_FMT_RGB565; +#else dpi_config.pixel_format = LCD_COLOR_PIXEL_FORMAT_RGB565; +#endif dpi_config.num_fbs = 1; dpi_config.video_timing.h_size = cfg.width; dpi_config.video_timing.v_size = cfg.height; @@ -80,8 +86,10 @@ DSIPanel::DSIPanel(const DSIPanelConfig& config) dpi_config.video_timing.vsync_back_porch = cfg.timing.v_back_porch; dpi_config.video_timing.vsync_pulse_width = cfg.timing.v_sync_pulse; dpi_config.video_timing.vsync_front_porch = cfg.timing.v_front_porch; +#if ESP_IDF_VERSION_MAJOR < 6 dpi_config.flags.use_dma2d = 1; - +#endif + AddLog(3, "DSI: DPI config: clk=%dMHz res=%dx%d", dpi_config.dpi_clock_freq_mhz, cfg.width, cfg.height); AddLog(3, "DSI: H timing: BP=%d PW=%d FP=%d", cfg.timing.h_back_porch, cfg.timing.h_sync_pulse, cfg.timing.h_front_porch); AddLog(3, "DSI: V timing: BP=%d PW=%d FP=%d", cfg.timing.v_back_porch, cfg.timing.v_sync_pulse, cfg.timing.v_front_porch); @@ -94,6 +102,12 @@ DSIPanel::DSIPanel(const DSIPanelConfig& config) return; } AddLog(3, "DSI: DPI panel created"); +#if ESP_IDF_VERSION_MAJOR >= 6 + ret = esp_lcd_dpi_panel_enable_dma2d(panel_handle); + if (ret != ESP_OK) { + AddLog(3, "DSI: Failed to enable DMA2D: %d", ret); + } +#endif // Step 6: Reset via GPIO (from config) if (cfg.reset_pin >= 0) { diff --git a/lib/lib_display/UDisplay/src/uDisplay_SPI_controller.cpp b/lib/lib_display/UDisplay/src/uDisplay_SPI_controller.cpp index 06b00a56f..f5b69e67f 100644 --- a/lib/lib_display/UDisplay/src/uDisplay_SPI_controller.cpp +++ b/lib/lib_display/UDisplay/src/uDisplay_SPI_controller.cpp @@ -9,7 +9,24 @@ #define GPIO_SET_SLOW(A) digitalWrite(A, HIGH) #define GPIO_CLR_SLOW(A) digitalWrite(A, LOW) #else // ESP32 -#if CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32S31 +static inline void uDisplayGpioClear(uint32_t pin) { + if (pin < 32) { + GPIO.out_w1tc.val = (1U << pin); + } else { + GPIO.out1_w1tc.val = (1U << (pin - 32)); + } +} +static inline void uDisplayGpioSet(uint32_t pin) { + if (pin < 32) { + GPIO.out_w1ts.val = (1U << pin); + } else { + GPIO.out1_w1ts.val = (1U << (pin - 32)); + } +} +#define GPIO_CLR(A) uDisplayGpioClear(A) +#define GPIO_SET(A) uDisplayGpioSet(A) +#elif CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32P4 #define GPIO_CLR(A) GPIO.out_w1tc.val = (1 << A) #define GPIO_SET(A) GPIO.out_w1ts.val = (1 << A) #else // plain ESP32 or S3 @@ -272,12 +289,16 @@ void SPIController::hw_write9(uint8_t val, uint8_t dc) { else regvalue &= 0x7f; if (val & 1) regvalue |= 0x8000; - REG_SET_BIT(SPI_USER_REG(3), SPI_USR_MOSI); - REG_WRITE(SPI_MOSI_DLEN_REG(3), 9 - 1); - uint32_t *dp = (uint32_t*)SPI_W0_REG(3); + uint8_t spi_index = 3; +#if CONFIG_IDF_TARGET_ESP32S31 + if (spi_config.bus_nr == 1) spi_index = 2; +#endif + REG_SET_BIT(SPI_USER_REG(spi_index), SPI_USR_MOSI); + REG_WRITE(SPI_MOSI_DLEN_REG(spi_index), 9 - 1); + uint32_t *dp = (uint32_t*)SPI_W0_REG(spi_index); *dp = regvalue; - REG_SET_BIT(SPI_CMD_REG(3), SPI_USR); - while (REG_GET_FIELD(SPI_CMD_REG(3), SPI_USR)); + REG_SET_BIT(SPI_CMD_REG(spi_index), SPI_USR); + while (REG_GET_FIELD(SPI_CMD_REG(spi_index), SPI_USR)); } } #else @@ -319,6 +340,9 @@ bool SPIController::initDMA(uint16_t width, uint16_t flushlines, uint8_t data) { } if (spi_config.bus_nr == 1){ AddLog(3,"DSP: dma spi 1"); +#if CONFIG_IDF_TARGET_ESP32S31 + spi_host = FSPI_HOST; +#endif } else if (spi_config.bus_nr == 2){ AddLog(3,"DSP: dma spi 2"); spi_host = HSPI_HOST; diff --git a/lib/lib_div/QuickESPNow/src/QuickEspNow_esp32.h b/lib/lib_div/QuickESPNow/src/QuickEspNow_esp32.h index 8de3c9c5b..94b96ea01 100644 --- a/lib/lib_div/QuickESPNow/src/QuickEspNow_esp32.h +++ b/lib/lib_div/QuickESPNow/src/QuickEspNow_esp32.h @@ -115,7 +115,13 @@ public: uint8_t getMaxMessageLength () override { return ESPNOW_MAX_MESSAGE_LENGTH; } void enableTransmit (bool enable) override; bool setChannel (uint8_t channel, wifi_second_chan_t ch2 = WIFI_SECOND_CHAN_NONE); - bool setWiFiBandwidth (wifi_interface_t iface = WIFI_IF_AP, wifi_bandwidth_t bw = WIFI_BW_HT20); + bool setWiFiBandwidth (wifi_interface_t iface = WIFI_IF_AP, wifi_bandwidth_t bw = +#if ESP_IDF_VERSION_MAJOR < 6 + WIFI_BW_HT20 +#else + WIFI_BW20 // IDF 6.x: WIFI_BW_HT20 renamed to WIFI_BW20 +#endif + ); bool readyToSendData (); protected: diff --git a/lib/lib_ssl/bearssl-esp8266/src/ec/_ec_c25519_m15.c b/lib/lib_ssl/bearssl-esp8266/src/ec/_ec_c25519_m15.c index c1aac2e16..995d85238 100644 --- a/lib/lib_ssl/bearssl-esp8266/src/ec/_ec_c25519_m15.c +++ b/lib/lib_ssl/bearssl-esp8266/src/ec/_ec_c25519_m15.c @@ -31,10 +31,16 @@ # error "No ESP capability header found" #endif -#if SOC_MPI_SUPPORTED +#if SOC_MPI_SUPPORTED && __has_include("rom/bigint.h") #include "rom/bigint.h" #include "t_inner.h" +#ifdef CONFIG_IDF_TARGET_ESP32 +// dport_access.h provides DPORT_STALL_OTHER_CPU_START/END for ESP32 dual-core safety. +// Must be included at file scope — picolibc's stdio.h (IDF 6.x) contains static inlines +// that are invalid inside a function body. +#include "dport_access.h" +#endif #define WORDS 8 /* 8×32-bit limbs */ @@ -133,7 +139,6 @@ static inline void field_mul(uint32_t *dst, const uint32_t *a, const uint32_t *b ets_bigint_getz(dst, WORDS); ets_bigint_disable(); #else -#include "dport_access.h" uint32_t ram_a[16] __attribute__((aligned(16))); uint32_t ram_b[16] __attribute__((aligned(16))); uint32_t ram_tmp[16] __attribute__((aligned(16))); diff --git a/lib/lib_ssl/bearssl-esp8266/src/ec/_ec_p256_m15.c b/lib/lib_ssl/bearssl-esp8266/src/ec/_ec_p256_m15.c index c7e04bfe1..60c724a25 100644 --- a/lib/lib_ssl/bearssl-esp8266/src/ec/_ec_p256_m15.c +++ b/lib/lib_ssl/bearssl-esp8266/src/ec/_ec_p256_m15.c @@ -31,7 +31,7 @@ # error "No ESP capability header found" #endif -#if SOC_MPI_SUPPORTED +#if SOC_MPI_SUPPORTED && __has_include("rom/bigint.h") #include #include "rom/bigint.h" diff --git a/lib/libesp32/ESP32-to-ESP8266-compat/src/esp8266toEsp32.cpp b/lib/libesp32/ESP32-to-ESP8266-compat/src/esp8266toEsp32.cpp index 9cfd9b997..56c6f6b8d 100644 --- a/lib/libesp32/ESP32-to-ESP8266-compat/src/esp8266toEsp32.cpp +++ b/lib/libesp32/ESP32-to-ESP8266-compat/src/esp8266toEsp32.cpp @@ -50,8 +50,8 @@ enum LoggingLevels {LOG_LEVEL_NONE, LOG_LEVEL_ERROR, LOG_LEVEL_INFO, LOG_LEVEL_D // replicated from `tasmota.h` #if CONFIG_IDF_TARGET_ESP32 const uint8_t MAX_PWMS = 16; // ESP32: 16 ledc PWM channels in total - TODO for now -#elif CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 -const uint8_t MAX_PWMS = 8; // ESP32S2/S3: 8 ledc PWM channels in total +#elif CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32S31 +const uint8_t MAX_PWMS = 8; // ESP32S2/S3/S31: 8 ledc PWM channels in total #elif CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C6 const uint8_t MAX_PWMS = 6; // ESP32C2/C3/C6: 6 ledc PWM channels in total #else diff --git a/lib/libesp32/berry_tasmota/src/be_crc32_module.c b/lib/libesp32/berry_tasmota/src/be_crc32_module.c index ec9f436b1..7270d8af3 100644 --- a/lib/libesp32/berry_tasmota/src/be_crc32_module.c +++ b/lib/libesp32/berry_tasmota/src/be_crc32_module.c @@ -8,7 +8,14 @@ #include "be_constobj.h" #include "be_mapping.h" +#if __has_include("rom/crc.h") #include "rom/crc.h" +#else +#include "esp_rom_crc.h" +#define crc32_le esp_rom_crc32_le +#define crc16_le esp_rom_crc16_le +#define crc8_le esp_rom_crc8_le +#endif static uint32_t c_crc32(uint32_t crc, const uint8_t* buf, size_t size) { return crc32_le(crc, buf, size); diff --git a/lib/libesp32_lvgl/lvgl/src/draw/sw/blend/helium/lv_blend_helium.S b/lib/libesp32_lvgl/lvgl/src/draw/sw/blend/helium/lv_blend_helium.S index 971680e3d..0ddf33bf4 100644 --- a/lib/libesp32_lvgl/lvgl/src/draw/sw/blend/helium/lv_blend_helium.S +++ b/lib/libesp32_lvgl/lvgl/src/draw/sw/blend/helium/lv_blend_helium.S @@ -3,6 +3,9 @@ * */ +/* ARM Helium/MVE SIMD implementation - only compiled on ARM targets */ +#if defined(__arm__) || defined(__ARM_ARCH) + #ifndef __ASSEMBLY__ #define __ASSEMBLY__ #endif @@ -711,3 +714,5 @@ export_set argb8888, argb8888, 32, 32, normal #endif /*LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_HELIUM && defined(__ARM_FEATURE_MVE) && __ARM_FEATURE_MVE && LV_USE_NATIVE_HELIUM_ASM*/ + +#endif /* defined(__arm__) || defined(__ARM_ARCH) */ diff --git a/partitions/esp32_partition_app3904k_fs11392k.csv b/partitions/esp32_partition_app3904k_fs11392k.csv new file mode 100644 index 000000000..dda7622e5 --- /dev/null +++ b/partitions/esp32_partition_app3904k_fs11392k.csv @@ -0,0 +1,6 @@ +# Name, Type, SubType, Offset, Size, Flags +nvs, data, nvs, 0x9000, 0x5000, +otadata, data, ota, 0xe000, 0x2000, +safeboot, app, factory, 0x10000, 0x100000, +app0, app, ota_0, 0x110000, 0x3D0000, +spiffs, data, spiffs, 0x4E0000,0xB20000, diff --git a/partitions/esp32_partition_app3904k_fs11456k.csv b/partitions/esp32_partition_app3904k_fs11456k.csv new file mode 100644 index 000000000..0a2deff59 --- /dev/null +++ b/partitions/esp32_partition_app3904k_fs11456k.csv @@ -0,0 +1,6 @@ +# Name, Type, SubType, Offset, Size, Flags +nvs, data, nvs, 0x9000, 0x5000, +otadata, data, ota, 0xe000, 0x2000, +safeboot, app, factory, 0x10000, 0xF0000, +app0, app, ota_0, 0x100000, 0x3D0000, +spiffs, data, spiffs, 0x4D0000,0xB30000, diff --git a/pins_arduino/esp32s31/pins_arduino.h b/pins_arduino/esp32s31/pins_arduino.h new file mode 100644 index 000000000..1d0e66e0f --- /dev/null +++ b/pins_arduino/esp32s31/pins_arduino.h @@ -0,0 +1,94 @@ +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include +#include "soc/soc_caps.h" + +#define USB_VID 0x303a +#define USB_PID 0x1001 + +#define PIN_RGB_LED 60 +// BUILTIN_LED can be used in new Arduino API digitalWrite() like in Blink.ino +static const uint8_t LED_BUILTIN = SOC_GPIO_PIN_COUNT + PIN_RGB_LED; +#define BUILTIN_LED LED_BUILTIN +#define LED_BUILTIN LED_BUILTIN +#define RGB_BUILTIN LED_BUILTIN +#define RGB_BRIGHTNESS 64 + +static const uint8_t TX = 58; +static const uint8_t RX = 59; + +static const uint8_t SDA = 2; +static const uint8_t SCL = 3; + +static const uint8_t SS = 37; +static const uint8_t MOSI = 38; +static const uint8_t MISO = 39; +static const uint8_t SCK = 40; + +static const uint8_t A0 = 42; +static const uint8_t A1 = 43; +static const uint8_t A2 = 44; +static const uint8_t A3 = 45; +static const uint8_t A4 = 46; +static const uint8_t A5 = 47; +static const uint8_t A6 = 48; +static const uint8_t A7 = 49; +static const uint8_t A8 = 50; +static const uint8_t A9 = 51; +static const uint8_t A10 = 52; +static const uint8_t A11 = 53; +static const uint8_t A12 = 54; +static const uint8_t A13 = 55; +static const uint8_t A14 = 56; +static const uint8_t A15 = 57; + +static const uint8_t T0 = 6; +static const uint8_t T1 = 7; +static const uint8_t T2 = 8; +static const uint8_t T3 = 9; +static const uint8_t T4 = 10; +static const uint8_t T5 = 11; +static const uint8_t T6 = 12; +static const uint8_t T7 = 13; +static const uint8_t T8 = 14; +static const uint8_t T9 = 15; +static const uint8_t T10 = 16; +static const uint8_t T11 = 17; +static const uint8_t T12 = 18; +static const uint8_t T13 = 19; + +/* ESP32-S31 EV Function board specific definitions */ +#define ETH_PHY_TYPE ETH_PHY_YT8531DC +#define ETH_PHY_ADDR -1 +#define ETH_PHY_IRQ 4 +#define ETH_PHY_MDC 5 +#define ETH_PHY_MDIO 6 +#define ETH_PHY_POWER 7 +#define ETH_RMII_TX0 8 +#define ETH_RMII_TX1 9 +#define ETH_RMII_TX2 10 +#define ETH_RMII_TX3 11 +#define ETH_RMII_TX_CTL 12 +#define ETH_RMII_TX_CLK 13 +#define ETH_RMII_RX_CLK 14 +#define ETH_RMII_RX_CTL 15 +#define ETH_RMII_RX3 16 +#define ETH_RMII_RX2 17 +#define ETH_RMII_RX1 18 +#define ETH_RMII_RX0 19 +#define ETH_CLK_MODE EMAC_CLK_EXT_IN + +#define BOARD_HAS_SDMMC +#define BOARD_SDMMC_SLOT 0 + +#define SCL1 50 +#define SDA1 51 +#define I2S_MCLK 52 +#define I2S_SCLK 53 +#define I2S_DOUT 54 +#define I2S_LRCK 55 +#define I2S_DIN 56 +#define PA_CTRL 57 + +#endif /* Pins_Arduino_h */ \ No newline at end of file diff --git a/pio-tools/name-firmware.py b/pio-tools/name-firmware.py index 63490f515..d8732d244 100644 --- a/pio-tools/name-firmware.py +++ b/pio-tools/name-firmware.py @@ -19,8 +19,8 @@ def bin_map_copy(source, target, env): if env["PIOPLATFORM"] == "espressif32": if("safeboot" in firmware_name): SAFEBOOT_SIZE = firsttarget.stat().st_size - if SAFEBOOT_SIZE > 851967: - print(Fore.RED + "!!! Tasmota safeboot size is too big with {} bytes. Max size is 851967 bytes !!! ".format( + if SAFEBOOT_SIZE > 983039: + print(Fore.RED + "!!! Tasmota safeboot size is too big with {} bytes. Max size is 983039 bytes !!! ".format( SAFEBOOT_SIZE ) ) diff --git a/platformio_tasmota_env32.ini b/platformio_tasmota_env32.ini index 3903937ba..c583b2a31 100644 --- a/platformio_tasmota_env32.ini +++ b/platformio_tasmota_env32.ini @@ -146,6 +146,28 @@ build_flags = ${env:tasmota32_base.build_flags} lib_extra_dirs = lib/lib_ssl, lib/libesp32 lib_ignore = ${safeboot_flags.lib_ignore} +[env:tasmota32s31-safeboot] +platform = https://github.com/Jason2866/platform-espressif32.git#IDF61 +extends = env:tasmota32_base +board = esp32s31-qio_opi +board_build.app_partition_name = safeboot +build_flags = ${env:tasmota32_base.build_flags} + -DFIRMWARE_SAFEBOOT + -DOTA_URL='"http://ota.tasmota.com/tasmota32/release/tasmota32s31-safeboot.bin"' +lib_extra_dirs = lib/lib_ssl, lib/libesp32 +lib_ignore = ${safeboot_flags.lib_ignore} + +[env:tasmota32s31ser-safeboot] +platform = https://github.com/Jason2866/platform-espressif32.git#IDF61 +extends = env:tasmota32_base +board = esp32s31ser-qio_opi +board_build.app_partition_name = safeboot +build_flags = ${env:tasmota32_base.build_flags} + -DFIRMWARE_SAFEBOOT + -DOTA_URL='"http://ota.tasmota.com/tasmota32/release/tasmota32s31ser-safeboot.bin"' +lib_extra_dirs = lib/lib_ssl, lib/libesp32 +lib_ignore = ${safeboot_flags.lib_ignore} + [env:tasmota32c5-safeboot] extends = env:tasmota32_base board = esp32c5 @@ -399,6 +421,17 @@ lib_ignore = ${env:tasmota32_base.lib_ignore} Micro-RTSP epdiy +[env:tasmota32s31] +platform = https://github.com/Jason2866/platform-espressif32.git#IDF61 +extends = env:tasmota32_base +board = esp32s31-qio_opi +build_flags = ${env:tasmota32_base.build_flags} + -DFIRMWARE_TASMOTA32 + -DOTA_URL='"http://ota.tasmota.com/tasmota32/release/tasmota32s31.bin"' +lib_ignore = ${env:tasmota32_base.lib_ignore} + Micro-RTSP + epdiy + [env:tasmota32-webcam] extends = env:tasmota32_base board = esp32-fix diff --git a/sdkconfig.defaults b/sdkconfig.defaults index cdecdb7b7..1e974a2d4 100644 --- a/sdkconfig.defaults +++ b/sdkconfig.defaults @@ -1,286 +1,470 @@ -CONFIG_AUTOSTART_ARDUINO=y # CONFIG_WS2812_LED_ENABLE is not set -CONFIG_APP_BUILD_TYPE_APP_2NDBOOT=y + +# +# Build type +# CONFIG_APP_REPRODUCIBLE_BUILD=y -CONFIG_COMPILER_HIDE_PATHS_MACROS=y +# end of Build type + +# +# Bootloader config +# + +# +# Log +# +CONFIG_BOOTLOADER_LOG_LEVEL_NONE=y +# end of Log + +CONFIG_BOOTLOADER_SKIP_VALIDATE_ALWAYS=y +# end of Bootloader config + +# +# Application manager +# CONFIG_APP_EXCLUDE_PROJECT_VER_VAR=y CONFIG_APP_EXCLUDE_PROJECT_NAME_VAR=y -# CONFIG_APP_COMPILE_TIME_DATE is not set -CONFIG_BOOTLOADER_LOG_LEVEL_NONE=y +# end of Application manager + +# +# Boot ROM Behavior +# CONFIG_BOOT_ROM_LOG_ALWAYS_OFF=y -CONFIG_BOOTLOADER_SKIP_VALIDATE_ALWAYS=y +# end of Boot ROM Behavior + +# +# Serial flasher config +# +CONFIG_ESPTOOLPY_FLASHMODE_QIO=y +# end of Serial flasher config + +# +# Arduino Configuration +# +CONFIG_AUTOSTART_ARDUINO=y + +# +# Debug Log Configuration +# CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL_NONE=y -CONFIG_I2S_SUPPRESS_DEPRECATE_WARN=y -CONFIG_I2S_ISR_IRAM_SAFE=y -CONFIG_RMT_SUPPRESS_DEPRECATE_WARN=y -CONFIG_TEMP_SENSOR_SUPPRESS_DEPRECATE_WARN=y -CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y +# end of Debug Log Configuration +# end of Arduino Configuration + +# +# Compiler options +# CONFIG_COMPILER_OPTIMIZATION_SIZE=y +CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE=y +CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y +CONFIG_COMPILER_SAVE_RESTORE_LIBCALLS=y CONFIG_COMPILER_DISABLE_DEFAULT_ERRORS=y CONFIG_COMPILER_DISABLE_GCC12_WARNINGS=y CONFIG_COMPILER_DISABLE_GCC13_WARNINGS=y CONFIG_COMPILER_DISABLE_GCC14_WARNINGS=y -CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE=y -CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y -CONFIG_COMPILER_STACK_CHECK_MODE_NONE=y -# CONFIG_COMPILER_CXX_EXCEPTIONS is not set -# CONFIG_COMPILER_WARN_WRITE_STRINGS is not set -# CONFIG_ESP_ERR_TO_NAME_LOOKUP is not set -# CONFIG_ESP_EVENT_POST_FROM_IRAM_ISR is not set -CONFIG_COMPILER_SAVE_RESTORE_LIBCALLS=y -# CONFIG_ESP_HTTPS_SERVER_ENABLE is not set -# CONFIG_ESP_HTTP_CLIENT_ENABLE_HTTPS is not set -# CONFIG_ESP_HTTP_CLIENT_ENABLE_BASIC_AUTH is not set -CONFIG_RINGBUF_PLACE_FUNCTIONS_INTO_FLASH=y -CONFIG_ESP_SYSTEM_ESP32_SRAM1_REGION_AS_IRAM=y -CONFIG_ESP_INT_WDT_TIMEOUT_MS=300 -CONFIG_ESP_IPC_TASK_STACK_SIZE=1024 -CONFIG_ESP_MAIN_TASK_STACK_SIZE=4096 -CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=2048 -CONFIG_ESP_TASK_WDT_PANIC=y -# CONFIG_ESP_SYSTEM_HW_STACK_GUARD is not set -CONFIG_ESP_TIMER_TASK_STACK_SIZE=4096 -CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y -CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE=y -# CONFIG_ESP_WIFI_MBEDTLS_CRYPTO is not set -# CONFIG_ESP_WIFI_FTM_ENABLE is not set -# CONFIG_ESP_WIFI_GMAC_SUPPORT is not set -# CONFIG_ESP_WIFI_CSI_ENABLED is not set -# CONFIG_ESP_WIFI_ENABLE_WPA3_SAE is not set -# CONFIG_ESP_WIFI_ENABLE_SAE_PK is not set -# CONFIG_ESP_WIFI_ENTERPRISE_SUPPORT is not set -# CONFIG_ESP_WIFI_MBEDTLS_TLS_CLIENT is not set -# CONFIG_ESP_WIFI_SOFTAP_SAE_SUPPORT is not set -# CONFIG_ESP_WIFI_ENABLE_WPA3_OWE_STA is not set -CONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM=0 -# CONFIG_ESP_WIFI_IRAM_OPT is not set -# CONFIG_ESP_WIFI_RX_IRAM_OPT is not set -CONFIG_ESP_WIFI_STATIC_RX_BUFFER_NUM=8 -CONFIG_ESP_WIFI_STATIC_TX_BUFFER_NUM=8 -CONFIG_ESP_WIFI_CACHE_TX_BUFFER_NUM=16 -CONFIG_ESP_PHY_REDUCE_TX_POWER=y -CONFIG_ETH_TRANSMIT_MUTEX=y -CONFIG_ETH_SPI_ETHERNET_DM9051=y -CONFIG_ETH_SPI_ETHERNET_W5500=y -CONFIG_ETH_SPI_ETHERNET_KSZ8851SNL=y -CONFIG_FATFS_CODEPAGE_850=y -CONFIG_FATFS_LFN_STACK=y -# CONFIG_FATFS_API_ENCODING_ANSI_OEM is not set -CONFIG_FATFS_API_ENCODING_UTF_8=y -# CONFIG_FMB_CONTROLLER_SLAVE_ID_SUPPORT is not set -CONFIG_FMB_TIMER_PORT_ENABLED=y -CONFIG_FREERTOS_HZ=1000 -# CONFIG_FREERTOS_ENABLE_BACKWARD_COMPATIBILITY is not set -# CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION is not set -# CONFIG_FREERTOS_ENABLE_TASK_SNAPSHOT is not set -CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=2304 -# CONFIG_FREERTOS_FPU_IN_ISR is not set -CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y -CONFIG_FREERTOS_PLACE_SNAPSHOT_FUNS_INTO_FLASH=y -CONFIG_HAL_ASSERTION_DISABLE=y -CONFIG_HEAP_POISONING_LIGHT=y -CONFIG_HTTPD_MAX_REQ_HDR_LEN=1024 -CONFIG_HTTPD_WS_SUPPORT=y -CONFIG_LOG_DEFAULT_LEVEL_NONE=y -# CONFIG_LOG_COLORS is not set -CONFIG_LWIP_LOCAL_HOSTNAME="tasmota" -CONFIG_LWIP_MAX_SOCKETS=16 -CONFIG_LWIP_SO_RCVBUF=y -CONFIG_LWIP_IP_FORWARD=y -CONFIG_LWIP_IPV4_NAPT=y -# CONFIG_LWIP_DHCP_DOES_ARP_CHECK is not set -CONFIG_LWIP_TCP_SYNMAXRTX=6 -CONFIG_LWIP_TCP_MSS=1436 -CONFIG_LWIP_TCP_RTO_TIME=3000 -CONFIG_LWIP_TCP_MSL=6000 -CONFIG_LWIP_TCP_FIN_WAIT_TIMEOUT=2000 -CONFIG_LWIP_TCPIP_TASK_STACK_SIZE=2560 -CONFIG_LWIP_TCPIP_TASK_AFFINITY_CPU0=y -CONFIG_LWIP_IPV6_AUTOCONFIG=y -CONFIG_LWIP_IPV6_RDNSS_MAX_DNS_SERVERS=2 -CONFIG_LWIP_MAX_SOCKETS=16 -CONFIG_LWIP_DHCP_RESTORE_LAST_IP=n -CONFIG_LWIP_DHCP_OPTIONS_LEN=128 -CONFIG_LWIP_SNTP_MAX_SERVERS=3 -# CONFIG_LWIP_DHCP_GET_NTP_SRV is not set -CONFIG_LWIP_SNTP_UPDATE_DELAY=10800000 -CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=48 -CONFIG_LWIP_TCP_RECVMBOX_SIZE=16 -CONFIG_LWIP_UDP_RECVMBOX_SIZE=64 -CONFIG_NEWLIB_NANO_FORMAT=y -# CONFIG_DAC_DMA_AUTO_16BIT_ALIGN is not set - -CONFIG_MBEDTLS_CERTIFICATE_BUNDLE=y -CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_FULL=y -CONFIG_MBEDTLS_TLS_DISABLED=y -# CONFIG_MBEDTLS_TLS_ENABLED is not set -# CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN is not set -CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_MAX_CERTS=10 -# CONFIG_MBEDTLS_SSL_KEEP_PEER_CERTIFICATE is not set -# CONFIG_MBEDTLS_PKCS7_C is not set -# CONFIG_MBEDTLS_ERROR_STRINGS is not set +CONFIG_COMPILER_DISABLE_GCC15_WARNINGS=y +# end of Compiler options # -# Symmetric Ciphers +# Component config # -CONFIG_MBEDTLS_AES_C=y -# CONFIG_MBEDTLS_CAMELLIA_C is not set -# CONFIG_MBEDTLS_DES_C is not set -# CONFIG_MBEDTLS_BLOWFISH_C is not set -# CONFIG_MBEDTLS_XTEA_C is not set -# CONFIG_MBEDTLS_CCM_C is not set -# CONFIG_MBEDTLS_GCM_C is not set -# CONFIG_MBEDTLS_NIST_KW_C is not set -# end of Symmetric Ciphers - - -# -# TLS Key Exchange Methods -# - -CONFIG_MBEDTLS_KEY_EXCHANGE_RSA=y -# CONFIG_MBEDTLS_PSK_MODES is not set -# CONFIG_MBEDTLS_KEY_EXCHANGE_ELLIPTIC_CURVE is not set -# CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_RSA is not set -# CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA is not set -# CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA is not set -# CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_RSA is not set - -CONFIG_MBEDTLS_SSL_PROTO_TLS1_2=y -# CONFIG_MBEDTLS_SSL_RENEGOTIATION is not set -# CONFIG_MBEDTLS_SSL_PROTO_GMTSSL1_1 is not set -# CONFIG_MBEDTLS_SSL_PROTO_DTLS is not set -# CONFIG_MBEDTLS_SSL_ALPN is not set -# CONFIG_MBEDTLS_CLIENT_SSL_SESSION_TICKETS is not set - -CONFIG_MBEDTLS_CMAC_C=y -CONFIG_MBEDTLS_ROM_MD5=y -CONFIG_MBEDTLS_HARDWARE_ECC=y -CONFIG_MBEDTLS_HARDWARE_AES=y -CONFIG_MBEDTLS_HARDWARE_MPI=y -CONFIG_MBEDTLS_HARDWARE_SHA=y -# CONFIG_MBEDTLS_ECC_OTHER_CURVES_SOFT_FALLBACK is not set -# CONFIG_MBEDTLS_HAVE_TIME is not set -# CONFIG_MBEDTLS_ECDSA_DETERMINISTIC is not set -# CONFIG_MBEDTLS_SHA512_C is not set -# CONFIG_MBEDTLS_RIPEMD160_C is not set - -# -# Certificates -# -# CONFIG_MBEDTLS_PEM_PARSE_C is not set -# CONFIG_MBEDTLS_PEM_WRITE_C is not set -# CONFIG_MBEDTLS_X509_CRL_PARSE_C is not set -# CONFIG_MBEDTLS_X509_CSR_PARSE_C is not set -# end of Certificates - -CONFIG_MBEDTLS_ECP_C=y -CONFIG_MBEDTLS_ECDH_C=y -CONFIG_MBEDTLS_ECDSA_C=y -CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED=y -# CONFIG_MBEDTLS_DHM_C is not set -# CONFIG_MBEDTLS_ECJPAKE_C is not set -# CONFIG_MBEDTLS_CLIENT_SSL_SESSION_TICKETS is not set -# CONFIG_MBEDTLS_SERVER_SSL_SESSION_TICKETS is not set -# CONFIG_MBEDTLS_ECP_DP_SECP192R1_ENABLED is not set -# CONFIG_MBEDTLS_ECP_DP_SECP224R1_ENABLED is not set -# CONFIG_MBEDTLS_ECP_DP_BP256R1_ENABLED is not set -# CONFIG_MBEDTLS_ECP_DP_SECP384R1_ENABLED is not set -# CONFIG_MBEDTLS_ECP_DP_SECP521R1_ENABLED is not set -# CONFIG_MBEDTLS_ECP_DP_SECP192K1_ENABLED is not set -# CONFIG_MBEDTLS_ECP_DP_SECP224K1_ENABLED is not set -# CONFIG_MBEDTLS_ECP_DP_SECP256K1_ENABLED is not set -# CONFIG_MBEDTLS_ECP_DP_BP384R1_ENABLED is not set -# CONFIG_MBEDTLS_ECP_DP_BP512R1_ENABLED is not set -# CONFIG_MBEDTLS_ECP_DP_CURVE25519_ENABLED is not set -# CONFIG_MBEDTLS_ECP_FIXED_POINT_OPTIM is not set -# CONFIG_MBEDTLS_ECP_NIST_OPTIM is not set -# CONFIG_MBEDTLS_SSL_PROTO_GMTSSL1_1 is not set -# CONFIG_MBEDTLS_SSL_PROTO_DTLS is not set - -CONFIG_OPENSSL_ASSERT_DO_NOTHING=y -CONFIG_PTHREAD_TASK_STACK_SIZE_DEFAULT=2048 -CONFIG_SPI_FLASH_DANGEROUS_WRITE_ALLOWED=y -# CONFIG_SPI_FLASH_ENABLE_ENCRYPTED_READ_WRITE is not set -CONFIG_SPI_FLASH_YIELD_DURING_ERASE=y -CONFIG_SPI_FLASH_ERASE_YIELD_DURATION_MS=10 -CONFIG_SPI_FLASH_ERASE_YIELD_TICKS=2 -CONFIG_SPI_FLASH_WRITE_CHUNK_SIZE=4096 -# CONFIG_UNITY_ENABLE_FLOAT is not set -# CONFIG_UNITY_ENABLE_DOUBLE is not set -# CONFIG_UNITY_ENABLE_IDF_TEST_RUNNER is not set -# CONFIG_USE_WAKENET is not set -# CONFIG_USE_MULTINET is not set -# CONFIG_MBEDTLS_FS_IO is not set -# CONFIG_VFS_SUPPORT_SELECT is not set -# CONFIG_VFS_SUPPRESS_SELECT_DEBUG_OUTPUT is not set -# CONFIG_VFS_SUPPORT_TERMIOS is not set -# CONFIG_SPI_MASTER_ISR_IN_IRAM is not set -# CONFIG_SPI_SLAVE_ISR_IN_IRAM is not set -CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=4096 -CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=0 - -CONFIG_WIFI_PROV_SCAN_MAX_ENTRIES=1 -CONFIG_DSP_MAX_FFT_SIZE_1024=y - -CONFIG_LITTLEFS_MAX_PARTITIONS=2 -CONFIG_LITTLEFS_MULTIVERSION=y -CONFIG_LITTLEFS_DISK_VERSION_2_0=y - -# -# Disable Cameras not used -# -# CONFIG_OV7670_SUPPORT is not set -# CONFIG_OV7725_SUPPORT is not set -# CONFIG_NT99141_SUPPORT is not set -# CONFIG_GC2145_SUPPORT is not set -# CONFIG_GC032A_SUPPORT is not set -# CONFIG_GC0308_SUPPORT is not set -# CONFIG_BF3005_SUPPORT is not set -# CONFIG_BF20A6_SUPPORT is not set -# CONFIG_SC030IOT_SUPPORT is not set # # Bluetooth # CONFIG_BT_ENABLED=y -CONFIG_BT_STACK_NO_LOG=y -# CONFIG_BT_BLE_42_FEATURES_SUPPORTED is not set -# CONFIG_BLE_MESH is not set CONFIG_BT_NIMBLE_ENABLED=y -CONFIG_BT_NIMBLE_LOG_LEVEL_NONE=y -CONFIG_BT_NIMBLE_MAX_CONNECTIONS=1 -# CONFIG_BT_NIMBLE_NVS_PERSIST is not set -# CONFIG_BT_NIMBLE_CRYPTO_STACK_MBEDTLS is not set -# CONFIG_BT_NIMBLE_LL_CFG_FEAT_LE_2M_PHY is not set -# CONFIG_BT_NIMBLE_LL_CFG_FEAT_LE_CODED_PHY is not set -# CONFIG_BT_NIMBLE_50_FEATURE_SUPPORT is not set -CONFIG_BT_CTRL_MODEM_SLEEP=y -CONFIG_BT_CTRL_MODEM_SLEEP_MODE_1=y -CONFIG_BT_CTRL_LPCLK_SEL_MAIN_XTAL=y -# CONFIG_BT_CTRL_LPCLK_SEL_RTC_SLOW is not set -CONFIG_BT_LOG_HCI_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_BTM_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_L2CAP_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_RFCOMM_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_SDP_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_GAP_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_BNEP_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_PAN_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_A2D_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_AVDT_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_AVCT_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_AVRC_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_MCA_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_HID_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_APPL_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_GATT_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_SMP_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_BTIF_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_BTC_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_OSI_TRACE_LEVEL_NONE=y -CONFIG_BT_LOG_BLUFI_TRACE_LEVEL_NONE=y +# +# NimBLE Options +# + +# +# GAP +# +CONFIG_BT_NIMBLE_MAX_CONNECTIONS=2 +# end of GAP + +# +# BLE 5.x Features +# +CONFIG_BT_NIMBLE_50_FEATURE_SUPPORT=n +# end of BLE 5.x Features + +# +# Debugging/Testing +# +CONFIG_BT_NIMBLE_LOG_LEVEL_NONE=y +# end of Debugging/Testing +# end of NimBLE Options +# end of Bluetooth + +# +# ESP-TLS +# +CONFIG_ESP_TLS_CUSTOM_STACK=y +# end of ESP-TLS + +# +# Common ESP-related +# +CONFIG_ESP_ERR_TO_NAME_LOOKUP=n +# end of Common ESP-related + +# +# ESP-Driver:I2S Configurations +# +CONFIG_I2S_ISR_IRAM_SAFE=y +# end of ESP-Driver:I2S Configurations + +# +# ESP-Driver:SPI Configurations +# +CONFIG_SPI_MASTER_ISR_IN_IRAM=n +CONFIG_SPI_SLAVE_ISR_IN_IRAM=n +# end of ESP-Driver:SPI Configurations + +# +# Ethernet +# +CONFIG_ETH_TRANSMIT_MUTEX=y +# end of Ethernet + +# +# Event Loop Library +# +CONFIG_ESP_EVENT_POST_FROM_IRAM_ISR=n +# end of Event Loop Library + +# +# ESP HTTP client +# +CONFIG_ESP_HTTP_CLIENT_ENABLE_HTTPS=n +# end of ESP HTTP client + +# +# HTTP Server +# +CONFIG_HTTPD_WS_SUPPORT=y +# end of HTTP Server + +# +# Hardware Settings +# + +# +# Sleep Config +# +CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND=n +# end of Sleep Config + +# +# RTC Clock Config +# CONFIG_RTC_CLK_CAL_CYCLES=576 -# CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0 is not set +# end of RTC Clock Config +# end of Hardware Settings + +# +# ESP-Driver:LCD Controller Configurations +# +CONFIG_LCD_RGB_ISR_IRAM_SAFE=y +# end of ESP-Driver:LCD Controller Configurations + +# +# PHY +# +CONFIG_ESP_PHY_REDUCE_TX_POWER=y +# end of PHY + +# +# ESP PSRAM +# +CONFIG_SPIRAM=y + +# +# ESP System Settings +# +CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y +CONFIG_ESP_SYSTEM_MEMPROT=n +CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=2048 +CONFIG_ESP_MAIN_TASK_STACK_SIZE=4096 +CONFIG_ESP_INT_WDT_TIMEOUT_MS=300 +CONFIG_ESP_TASK_WDT_PANIC=y +CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0=n +CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1=n +CONFIG_ESP_SYSTEM_HW_STACK_GUARD=n +# end of ESP System Settings + +# +# ESP Timer (High Resolution Timer) +# +CONFIG_ESP_TIMER_TASK_STACK_SIZE=4096 +# end of ESP Timer (High Resolution Timer) + +# +# Wi-Fi +# +CONFIG_ESP_WIFI_STATIC_RX_BUFFER_NUM=8 +CONFIG_ESP_WIFI_IRAM_OPT=n +CONFIG_ESP_WIFI_RX_IRAM_OPT=n +CONFIG_ESP_WIFI_ENABLE_WPA3_SAE=n +CONFIG_ESP_WIFI_ENABLE_WPA3_OWE_STA=n +CONFIG_ESP_WIFI_ENABLE_WPA3_OWE_SOFTAP=n +CONFIG_ESP_WIFI_GMAC_SUPPORT=n +CONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM=0 +CONFIG_ESP_WIFI_ENTERPRISE_SUPPORT=n +# end of Wi-Fi + +# +# Wi-Fi Remote +# +CONFIG_ESP_WIFI_REMOTE_ENABLED=n +# end of Wi-Fi Remote + +# +# FAT Filesystem support +# +CONFIG_FATFS_LFN_STACK=y +CONFIG_FATFS_CODEPAGE_850=y +CONFIG_FATFS_API_ENCODING_UTF_8=y +# end of FAT Filesystem support + +# +# FreeRTOS +# + +# +# Kernel +# +CONFIG_FREERTOS_HZ=1000 CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=2304 +CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=3120 +# end of Kernel + +# +# Port +# +CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK=y +# end of Port +# end of FreeRTOS + +# +# Hardware Abstraction Layer (HAL) and Low Level (LL) +# +CONFIG_HAL_ASSERTION_DISABLE=y +# end of Hardware Abstraction Layer (HAL) and Low Level (LL) + +# +# Heap memory debugging +# +CONFIG_HEAP_POISONING_LIGHT=y +# end of Heap memory debugging + +# +# IEEE 802.15.4 +# +CONFIG_IEEE802154_ENABLED=n +# end of IEEE 802.15.4 + +# +# Log +# + +# +# Log Level +# +CONFIG_LOG_DEFAULT_LEVEL_NONE=y +# end of Log Level +# end of Log + +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="tasmota" +CONFIG_LWIP_MAX_SOCKETS=16 +CONFIG_LWIP_IP_FORWARD=y +CONFIG_LWIP_IPV4_NAPT=y +CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=48 +CONFIG_LWIP_DHCP_OPTIONS_LEN=128 +CONFIG_LWIP_IPV6_AUTOCONFIG=y +CONFIG_LWIP_IPV6_RDNSS_MAX_DNS_SERVERS=2 + +# +# TCP +# +CONFIG_LWIP_TCP_SYNMAXRTX=6 +CONFIG_LWIP_TCP_MSS=1436 +CONFIG_LWIP_TCP_MSL=6000 +CONFIG_LWIP_TCP_FIN_WAIT_TIMEOUT=2000 +CONFIG_LWIP_TCP_RECVMBOX_SIZE=16 +CONFIG_LWIP_TCP_RTO_TIME=3000 +# end of TCP + +# +# UDP +# +CONFIG_LWIP_UDP_RECVMBOX_SIZE=64 +# end of UDP + +CONFIG_LWIP_TCPIP_TASK_STACK_SIZE=2560 +CONFIG_LWIP_TCPIP_TASK_AFFINITY_CPU0=y + +# +# SNTP +# +CONFIG_LWIP_SNTP_MAX_SERVERS=3 +CONFIG_LWIP_SNTP_UPDATE_DELAY=10800000 +# end of SNTP +# end of LWIP + +# +# mbedTLS +# + +# +# Core Configuration +# +CONFIG_MBEDTLS_FS_IO=n +CONFIG_MBEDTLS_THREADING_C=n +CONFIG_MBEDTLS_ERROR_STRINGS=n +CONFIG_MBEDTLS_VERSION_C=n +CONFIG_MBEDTLS_HAVE_TIME=n +CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN=n +CONFIG_MBEDTLS_SELF_TEST=n +# end of Core Configuration + +# +# Certificates +# +CONFIG_MBEDTLS_X509_USE_C=n +CONFIG_MBEDTLS_X509_CRL_PARSE_C=n +CONFIG_MBEDTLS_X509_CSR_PARSE_C=n +CONFIG_MBEDTLS_CERTIFICATE_BUNDLE=n +# end of Certificates + +CONFIG_MBEDTLS_TLS_ENABLED=n + +# +# Symmetric Ciphers +# +CONFIG_MBEDTLS_CCM_C=n +CONFIG_MBEDTLS_CIPHER_MODE_CFB=n +CONFIG_MBEDTLS_CIPHER_MODE_CTR=n +CONFIG_MBEDTLS_CIPHER_MODE_OFB=n +CONFIG_MBEDTLS_GCM_C=n +CONFIG_MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH=y +# end of Symmetric Ciphers + +# +# Asymmetric Ciphers +# + +# +# Supported Curves +# +CONFIG_MBEDTLS_ECP_DP_SECP384R1_ENABLED=n +CONFIG_MBEDTLS_ECP_DP_SECP521R1_ENABLED=n +CONFIG_MBEDTLS_ECP_DP_SECP256K1_ENABLED=n +CONFIG_MBEDTLS_ECP_DP_BP256R1_ENABLED=n +CONFIG_MBEDTLS_ECP_DP_BP384R1_ENABLED=n +CONFIG_MBEDTLS_ECP_DP_BP512R1_ENABLED=n +CONFIG_MBEDTLS_ECP_DP_CURVE25519_ENABLED=n +# end of Supported Curves + +# +# Elliptic Curve Ciphers Configuration +# +CONFIG_MBEDTLS_ECP_NIST_OPTIM=n +CONFIG_MBEDTLS_PK_PARSE_EC_EXTENDED=n +CONFIG_MBEDTLS_PK_PARSE_EC_COMPRESSED=n +CONFIG_MBEDTLS_ECDSA_DETERMINISTIC=n +# end of Elliptic Curve Ciphers Configuration +# end of Asymmetric Ciphers + +# +# Hash functions +# +CONFIG_MBEDTLS_SHA384_C=n +CONFIG_MBEDTLS_SHA512_C=n +# end of Hash functions + +# +# Hardware Acceleration +# +CONFIG_MBEDTLS_ECC_OTHER_CURVES_SOFT_FALLBACK=n +CONFIG_MBEDTLS_GCM_SUPPORT_NON_AES_CIPHER=n +# end of Hardware Acceleration + +# +# Encoding/Decoding +# +CONFIG_MBEDTLS_PKCS5_C=n +# end of Encoding/Decoding +# end of mbedTLS + +# +# Protocomm +# +CONFIG_ESP_PROTOCOMM_SUPPORT_SECURITY_VERSION_0=y +CONFIG_ESP_PROTOCOMM_SUPPORT_SECURITY_VERSION_2=n +# end of Protocomm + +# +# PThreads +# +CONFIG_PTHREAD_TASK_STACK_SIZE_DEFAULT=2048 +# end of PThreads + +# +# SPI Flash driver +# +CONFIG_SPI_FLASH_DANGEROUS_WRITE_ALLOWED=y +CONFIG_SPI_FLASH_ERASE_YIELD_DURATION_MS=10 +CONFIG_SPI_FLASH_ERASE_YIELD_TICKS=2 +CONFIG_SPI_FLASH_WRITE_CHUNK_SIZE=4096 +CONFIG_SPI_FLASH_ENABLE_ENCRYPTED_READ_WRITE=n +# end of SPI Flash driver + +# +# Unity unit testing library +# +CONFIG_UNITY_ENABLE_FLOAT=n +CONFIG_UNITY_ENABLE_DOUBLE=n +CONFIG_UNITY_ENABLE_IDF_TEST_RUNNER=n +# end of Unity unit testing library + +# +# Virtual file system +# +CONFIG_VFS_SUPPORT_SELECT=n +# end of Virtual file system + +# +# DSP Library +# +CONFIG_DSP_MAX_FFT_SIZE_1024=y +# end of DSP Library + +# +# Camera configuration +# +CONFIG_OV7670_SUPPORT=n +CONFIG_OV7725_SUPPORT=n +CONFIG_NT99141_SUPPORT=n +CONFIG_GC2145_SUPPORT=n +CONFIG_GC032A_SUPPORT=n +CONFIG_GC0308_SUPPORT=n +CONFIG_BF3005_SUPPORT=n +CONFIG_BF20A6_SUPPORT=n +CONFIG_SC030IOT_SUPPORT=n +# end of Camera configuration + +# +# LittleFS +# +CONFIG_LITTLEFS_MAX_PARTITIONS=2 +CONFIG_LITTLEFS_MULTIVERSION=y +CONFIG_LITTLEFS_DISK_VERSION_2_0=y +# end of LittleFS + +# end of Component config diff --git a/tasmota/idf_component.yml b/tasmota/idf_component.yml index 6e5f92897..db2242e25 100644 --- a/tasmota/idf_component.yml +++ b/tasmota/idf_component.yml @@ -10,7 +10,7 @@ dependencies: rules: - if: "target in [esp32, esp32s2, esp32s3, esp32p4]" espressif/fb_gfx: - version: "master" + version: "release/v6.1" path: components/fb_gfx git: https://github.com/espressif/esp32-arduino-lib-builder.git require: public diff --git a/tasmota/include/tasmota.h b/tasmota/include/tasmota.h index b2faa928e..c7675794c 100644 --- a/tasmota/include/tasmota.h +++ b/tasmota/include/tasmota.h @@ -61,8 +61,8 @@ const uint8_t MAX_PWMS_LEGACY = 5; // Max number of PWM channels in fir #ifdef ESP32 // Max number of PWM channels (total including extended) - ESP32 only #if CONFIG_IDF_TARGET_ESP32 const uint8_t MAX_PWMS = 16; // ESP32: 16 ledc PWM channels in total - TODO for now - #elif CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 - const uint8_t MAX_PWMS = 8; // ESP32S2/S3: 8 ledc PWM channels in total + #elif CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32S31 + const uint8_t MAX_PWMS = 8; // ESP32S2/S3/S31: 8 ledc PWM channels in total #elif CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C6 const uint8_t MAX_PWMS = 6; // ESP32C2/C3/C6: 6 ledc PWM channels in total #else @@ -99,13 +99,38 @@ const uint8_t MAX_SPI = 2; // Max number of Hardware SPI contro // I2S #ifdef SOC_I2S_SUPPORTED + #ifndef SOC_I2S_NUM // IDF 6.x: SOC_I2S_NUM removed + #ifdef CONFIG_IDF_TARGET_ESP32P4 + #define SOC_I2S_NUM 3 + #elif CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32S31 + #define SOC_I2S_NUM 2 + #else + #define SOC_I2S_NUM 1 + #endif + #endif const uint8_t MAX_I2S = SOC_I2S_NUM; #else // SOC_I2S_SUPPORTED const uint8_t MAX_I2S = 0; #endif // SOC_I2S_SUPPORTED // RMT -#ifdef SOC_RMT_SUPPORTED +#ifdef SOC_RMT_SUPPORTED // IDF 6.x: SOC_RMT_SUPPORTED removed + #ifndef SOC_RMT_TX_CANDIDATES_PER_GROUP + #ifdef CONFIG_IDF_TARGET_ESP32 + #define SOC_RMT_TX_CANDIDATES_PER_GROUP 8 + #elif CONFIG_IDF_TARGET_ESP32S3 + #define SOC_RMT_TX_CANDIDATES_PER_GROUP 4 + #elif CONFIG_IDF_TARGET_ESP32P4 + #define SOC_RMT_TX_CANDIDATES_PER_GROUP 4 + #elif CONFIG_IDF_TARGET_ESP32S31 + #define SOC_RMT_TX_CANDIDATES_PER_GROUP 8 + #else + #define SOC_RMT_TX_CANDIDATES_PER_GROUP 2 + #endif + #endif + #ifndef SOC_RMT_GROUPS // IDF 6.x: removed + #define SOC_RMT_GROUPS 1 + #endif const uint8_t MAX_RMT = (SOC_RMT_GROUPS) * (SOC_RMT_TX_CANDIDATES_PER_GROUP); #else // SOC_RMT_SUPPORTED const uint8_t MAX_RMT = 0; @@ -347,6 +372,8 @@ const uint32_t LOOP_SLEEP_DELAY = 50; // Lowest number of milliseconds to #define SOC_TOUCH_VERSION_1 #elif SOC_TOUCH_SENSOR_VERSION == 2 // ESP32S2, ESP32S3 #define SOC_TOUCH_VERSION_2 +#elif SOC_TOUCH_SENSOR_VERSION == 3 // ESP32S31 +#define SOC_TOUCH_VERSION_3 #endif // SOC_TOUCH_SENSOR_VERSION #endif // ESP32 diff --git a/tasmota/include/tasmota_compat.h b/tasmota/include/tasmota_compat.h index 4a75ec3a8..1e2798e7d 100644 --- a/tasmota/include/tasmota_compat.h +++ b/tasmota/include/tasmota_compat.h @@ -24,6 +24,17 @@ // Modul #undef MODULE #define MODULE WEMOS // [Module] Select default model + +// ESP32-C2 has no RTC slow memory; RTC_NOINIT_ATTR is explicitly broken there. +// The IDF header itself defines RTC_NOINIT_ATTR as static_assert(0,...) on C2, +// so we must redefine it *after* that header has been pulled in via esp8266toEsp32.h. +#ifdef CONFIG_IDF_TARGET_ESP32C2 + #ifdef RTC_NOINIT_ATTR + #undef RTC_NOINIT_ATTR + #endif + #define RTC_NOINIT_ATTR __NOINIT_ATTR +#endif // CONFIG_IDF_TARGET_ESP32C2 + #endif // ESP32 #ifdef ESP8266 diff --git a/tasmota/include/tasmota_configurations_ESP32.h b/tasmota/include/tasmota_configurations_ESP32.h index f140cbc81..361ca3303 100644 --- a/tasmota/include/tasmota_configurations_ESP32.h +++ b/tasmota/include/tasmota_configurations_ESP32.h @@ -187,14 +187,14 @@ #undef USE_ESP32_WDT // disable watchdog on SAFEBOOT until more testing is done -#if CONFIG_FREERTOS_UNICORE || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_FREERTOS_UNICORE || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32S31 #if CONFIG_ETH_ENABLED // Check for Ethernet support in Arduino libs // #undef USE_MQTT_TLS // #define USE_SERIAL_BRIDGE // Add support for software Serial Bridge console Tee (+4.5k code) #define USE_SPI // Make SPI Ethernet adapters useable (+124 bytes) #define USE_ETHERNET #endif // CONFIG_ETH_ENABLED -#endif // CONFIG_FREERTOS_UNICORE || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32P4 +#endif // CONFIG_FREERTOS_UNICORE || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32S31 #endif // FIRMWARE_SAFEBOOT diff --git a/tasmota/include/tasmota_globals.h b/tasmota/include/tasmota_globals.h index 9d42d8a55..a8d8cbf7e 100644 --- a/tasmota/include/tasmota_globals.h +++ b/tasmota/include/tasmota_globals.h @@ -166,6 +166,8 @@ const char WIFI_HOSTNAME[] = WIFI_DEFAULT_HOSTNAME; // Override by user_confi #endif #elif CONFIG_IDF_TARGET_ESP32S3 #define TASMOTA_ARCH "esp32s3" +#elif CONFIG_IDF_TARGET_ESP32S31 + #define TASMOTA_ARCH "esp32s31" #else #define TASMOTA_ARCH "esp32" #endif diff --git a/tasmota/include/tasmota_template.h b/tasmota/include/tasmota_template.h index 492307039..8fe3d669f 100644 --- a/tasmota/include/tasmota_template.h +++ b/tasmota/include/tasmota_template.h @@ -1537,6 +1537,26 @@ const char PINS_WEMOS[] PROGMEM = "IOAOAOAOAOAOAOAOAOAOAOAOAOAOAOAOAOAOAOAOAOIO- // 0 1 2 3 4 5 6 7 8 9101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 const char PINS_WEMOS[] PROGMEM = "IOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOAOAOAOAOAOAOAOAOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOIOAOAOAOAOAOAO"; +#elif CONFIG_IDF_TARGET_ESP32S31 +/* **************************************** + * ESP32-S31 + * GPIOs 0..61 (GPIO29 and GPIO41 are not bonded) + * ****************************************/ +#define MAX_GPIO_PIN 62 +#define MIN_FLASH_PINS 0 +#define MAX_USER_PINS 62 +#define WEMOS_MODULE 0 + +const char PINS_WEMOS[] PROGMEM = + "AOAOIOIOIOIO" // GPIO0..5: 32 kHz crystal analog functions on GPIO0..1 + "AOAOAOAOAOAOAOAOAOAOAOAOAOAO" // GPIO6..19: touch-capable GPIOs + "IOIOIOIOIOIOFLFLFL" // GPIO20..28: GPIO26..28 are SPI flash pins + "--" // GPIO29 is not bonded + "FLFLFLAOAOIOIOAOAOAOAO" // GPIO30..40: GPIO30..32 are SPI flash pins + "--" // GPIO41 is not bonded + "AOAOAOAOAOAOAOAOAOAOAOAOAOAOAOAO" // GPIO42..57: ADC-capable GPIOs + "IOIOIOIO"; // GPIO58..61 + #else // not CONFIG_IDF_TARGET_ESP32C2/C3/C6 nor CONFIG_IDF_TARGET_ESP32S2 - ESP32 /* **************************************** @@ -3349,10 +3369,105 @@ const mytmplt kModules[] PROGMEM = { /*********************************************************************************************\ Known templates \*********************************************************************************************/ - -#elif CONFIG_IDF_TARGET_ESP32S2 + #elif CONFIG_IDF_TARGET_ESP32S31 /********************************************************************************************\ - * ESP32-S2 Module templates + * ESP32-S31 Module templates + \********************************************************************************************/ + + #define USER_MODULE 255 + #define WT32_ETH01 4 // Legacy Ethernet module identifier used by the driver + + /*********************************************************************************************\ + Known templates + \*********************************************************************************************/ + + enum SupportedModulesESP32S31 { + WEMOS, + MAXMODULE }; + + const uint8_t kModuleNiceList[] PROGMEM = { + WEMOS, + }; + + const char kModuleNames[] PROGMEM = + "ESP32S31|" + ; + + const mytmplt kModules[] PROGMEM = { + { + AGPIO(GPIO_USER), // 0 + AGPIO(GPIO_USER), // 1 + AGPIO(GPIO_USER), // 2 + AGPIO(GPIO_USER), // 3 + AGPIO(GPIO_USER), // 4 + AGPIO(GPIO_USER), // 5 + AGPIO(GPIO_USER), // 6 + AGPIO(GPIO_USER), // 7 + AGPIO(GPIO_USER), // 8 + AGPIO(GPIO_USER), // 9 + AGPIO(GPIO_USER), // 10 + AGPIO(GPIO_USER), // 11 + AGPIO(GPIO_USER), // 12 + AGPIO(GPIO_USER), // 13 + AGPIO(GPIO_USER), // 14 + AGPIO(GPIO_USER), // 15 + AGPIO(GPIO_USER), // 16 + AGPIO(GPIO_USER), // 17 + AGPIO(GPIO_USER), // 18 + AGPIO(GPIO_USER), // 19 + AGPIO(GPIO_USER), // 20 + AGPIO(GPIO_USER), // 21 + AGPIO(GPIO_USER), // 22 + AGPIO(GPIO_USER), // 23 + AGPIO(GPIO_USER), // 24 + AGPIO(GPIO_USER), // 25 + AGPIO(GPIO_NONE), // 26: SPI flash + AGPIO(GPIO_NONE), // 27: SPI flash + AGPIO(GPIO_NONE), // 28: SPI flash + AGPIO(GPIO_NONE), // 29: not bonded + AGPIO(GPIO_NONE), // 30: SPI flash + AGPIO(GPIO_NONE), // 31: SPI flash + AGPIO(GPIO_NONE), // 32: SPI flash + AGPIO(GPIO_USER), // 33 + AGPIO(GPIO_USER), // 34 + AGPIO(GPIO_USER), // 35 + AGPIO(GPIO_USER), // 36 + AGPIO(GPIO_USER), // 37 + AGPIO(GPIO_USER), // 38 + AGPIO(GPIO_USER), // 39 + AGPIO(GPIO_USER), // 40 + AGPIO(GPIO_NONE), // 41: not bonded + AGPIO(GPIO_USER), // 42 + AGPIO(GPIO_USER), // 43 + AGPIO(GPIO_USER), // 44 + AGPIO(GPIO_USER), // 45 + AGPIO(GPIO_USER), // 46 + AGPIO(GPIO_USER), // 47 + AGPIO(GPIO_USER), // 48 + AGPIO(GPIO_USER), // 49 + AGPIO(GPIO_USER), // 50 + AGPIO(GPIO_USER), // 51 + AGPIO(GPIO_USER), // 52 + AGPIO(GPIO_USER), // 53 + AGPIO(GPIO_USER), // 54 + AGPIO(GPIO_USER), // 55 + AGPIO(GPIO_USER), // 56 + AGPIO(GPIO_USER), // 57 + AGPIO(GPIO_USER), // 58 + AGPIO(GPIO_USER), // 59 + AGPIO(GPIO_USER), // 60 + AGPIO(GPIO_USER), // 61 + 0 // Flag + }, + }; + + /*********************************************************************************************\ + Known templates + \*********************************************************************************************/ + + #elif CONFIG_IDF_TARGET_ESP32S2 + /********************************************************************************************\ + * ESP32-S2 Module templates \********************************************************************************************/ #define USER_MODULE 255 diff --git a/tasmota/include/tasmota_types.h b/tasmota/include/tasmota_types.h index e61216665..4e35110a6 100644 --- a/tasmota/include/tasmota_types.h +++ b/tasmota/include/tasmota_types.h @@ -538,10 +538,10 @@ typedef struct { uint8_t tuyamcu_topic; // 33F Manage tuyaSend topic. ex_energy_power_delta on 6.6.0.20, replaced on 8.5.0.1 uint16_t domoticz_update_timer; // 340 uint16_t pwm_range; // 342 -#ifndef CONFIG_IDF_TARGET_ESP32P4 +#if !CONFIG_IDF_TARGET_ESP32P4 && !CONFIG_IDF_TARGET_ESP32S31 uint32_t domoticz_relay_idx[MAX_DOMOTICZ_IDX]; // 344 uint32_t domoticz_key_idx[MAX_DOMOTICZ_IDX]; // 354 -#endif // CONFIG_IDF_TARGET_ESP32P4 +#endif // !CONFIG_IDF_TARGET_ESP32P4 && !CONFIG_IDF_TARGET_ESP32S31 uint32_t energy_power_calibration; // 364 (P4 344) uint32_t energy_voltage_calibration; // 368 (P4 348) uint32_t energy_current_calibration; // 36C (P4 34C) @@ -598,7 +598,21 @@ typedef struct { // 496 #endif // ESP8266 #ifdef ESP32 -#if CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32S31 + // S31 needs the P4-sized GPIO mapping plus 14 additional bytes for its GPIOs. + myio my_gp; // 38C 2x62 bytes (ESP32-S31) + uint8_t eth_type; // 408 + uint8_t eth_clk_mode; // 409 + mytmplt user_template; // 40A 2x63 bytes (ESP32-S31) + WebCamCfg webcam_config; // 488 + int8_t eth_address; // 48C + uint8_t module; // 48D + uint8_t ws_width[3]; // 48E + char serial_delimiter; // 491 + uint8_t seriallog_level; // 492 + uint8_t sleep; // 493 + uint16_t ldo_mv[1]; // 494 ESP32-S31 LDO3 voltage +#elif CONFIG_IDF_TARGET_ESP32P4 // -------------------------------------------------------------- // Mapping 0x38C to 0x496 for ESP32P4 (Domoticz in filesystem) // -------------------------------------------------------------- @@ -615,7 +629,8 @@ typedef struct { uint8_t sleep; // 477 uint8_t ws_color[4][3]; // 478 (+xC) - uint8_t free_esp32_484[18]; // 484 + uint16_t ldo_mv[2]; // 484 ESP32-P4 LDO3 and LDO4 voltage + uint8_t free_esp32_488[14]; // 488 // 496 #elif CONFIG_IDF_TARGET_ESP32S3 // -------------------------------------------------------------- @@ -831,9 +846,12 @@ typedef struct { uint8_t web_color2[2][3]; // EA0 Needs to be on integer / 3 distance from web_color uint16_t zcdimmerset[5]; // EA6 - uint16_t ldo_mv[2]; // EB0 ESP32-P4 LDO3 and LDO4 voltage - - uint8_t free_eb4[16]; // EB4 16 bytes +#if CONFIG_IDF_TARGET_ESP32S31 + uint8_t ws_color[4][3]; // EB0 + uint8_t free_esp32s31_ebc[8]; // EBC +#else + uint8_t free_eb0[20]; // EB0 20 bytes +#endif uint16_t light_pixels_height_1 : 15;// EC4 Pixels height minus 1, default 0 (0 means 1 line) uint16_t light_pixels_alternate : 1;// EC4 Indicates alternate lines in Pixels Matrix diff --git a/tasmota/tasmota.ino b/tasmota/tasmota.ino index e27792c21..6bd5f8665 100644 --- a/tasmota/tasmota.ino +++ b/tasmota/tasmota.ino @@ -97,6 +97,7 @@ #ifdef ESP32 #include "include/tasconsole.h" #if SOC_USB_SERIAL_JTAG_SUPPORTED +#include "soc/io_mux_reg.h" // USB_INT_PHY0_Dx_GPIO_NUM #include "hal/usb_serial_jtag_ll.h" #include "esp_private/rtc_clk.h" #endif // SOC_USB_SERIAL_JTAG_SUPPORTED @@ -222,7 +223,7 @@ WiFiUDP PortUdp; // UDP Syslog and Alexa CONFIG_IDF_TARGET_ESP32S2 || // support USB via USBCDC CONFIG_IDF_TARGET_ESP32S3 // support USB via HWCDC using JTAG interface or USBCDC */ -#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32S31 //#if CONFIG_TINYUSB_CDC_ENABLED // This define is not recognized here so use USE_USB_CDC_CONSOLE #ifdef USE_USB_CDC_CONSOLE @@ -251,11 +252,11 @@ TASCONSOLE TasConsole{Serial}; bool tasconsole_serial = true; //#warning **** TasConsole uses Serial **** #endif // USE_USB_CDC_CONSOLE -#else // No ESP32C3, S2 or S3 +#else // No USB CDC-capable target TASCONSOLE TasConsole{Serial}; bool tasconsole_serial = true; //#warning **** TasConsole uses Serial **** -#endif // ESP32C3, S2 or S3 +#endif // USB CDC-capable targets #else // No ESP32 HardwareSerial TasConsole = Serial; // Only serial interface @@ -505,7 +506,7 @@ void setup(void) { } #ifdef ESP32 -#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32S31 #ifdef USE_USB_CDC_CONSOLE bool is_connected_to_USB = false; diff --git a/tasmota/tasmota_support/settings.ino b/tasmota/tasmota_support/settings.ino index 124947da8..3010c4a36 100644 --- a/tasmota/tasmota_support/settings.ino +++ b/tasmota/tasmota_support/settings.ino @@ -553,6 +553,8 @@ bool SettingsConfigRestore(void) { valid_settings = (7 == settings_buffer[0xF36]); // Settings->config_version ESP32P4 #elif CONFIG_IDF_TARGET_ESP32C5 valid_settings = (8 == settings_buffer[0xF36]); // Settings->config_version ESP32C5 +#elif CONFIG_IDF_TARGET_ESP32S31 + valid_settings = (9 == settings_buffer[0xF36]); // Settings->config_version ESP32S31 #else valid_settings = (1 == settings_buffer[0xF36]); // Settings->config_version ESP32 all other #endif // CONFIG_IDF_TARGET_ESP32S3 @@ -997,6 +999,8 @@ void SettingsDefaultSet2(void) { Settings->config_version = 7; // ESP32P4 #elif CONFIG_IDF_TARGET_ESP32C5 Settings->config_version = 8; // ESP32C5 +#elif CONFIG_IDF_TARGET_ESP32S31 + Settings->config_version = 9; // ESP32S31 #else Settings->config_version = 1; // ESP32 #endif // CONFIG_IDF_TARGET_ESP32S3 @@ -1616,6 +1620,8 @@ void SettingsDelta(void) { Settings->config_version = 7; // ESP32P4 #elif CONFIG_IDF_TARGET_ESP32C5 Settings->config_version = 8; // ESP32C5 +#elif CONFIG_IDF_TARGET_ESP32S31 + Settings->config_version = 9; // ESP32S31 #else Settings->config_version = 1; // ESP32 #endif // CONFIG_IDF_TARGET_ESP32S3 diff --git a/tasmota/tasmota_support/support.ino b/tasmota/tasmota_support/support.ino index d2807860a..878795395 100644 --- a/tasmota/tasmota_support/support.ino +++ b/tasmota/tasmota_support/support.ino @@ -21,6 +21,10 @@ extern "C" { extern struct rst_info resetInfo; } +#ifdef ESP32 // ESP32 specific gpio driver defines +#include "driver/gpio.h" +#endif // ESP32 + /*********************************************************************************************\ * ESP32 Watchdog \*********************************************************************************************/ @@ -1723,7 +1727,7 @@ void TemplateGpios(myio *gp) j++; #endif // ESP8266 #ifdef ESP32 -#if CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32S31 dest[i] = src[i]; #elif CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 if (22 == i) { j = 33; } // skip 22-32 @@ -1803,6 +1807,9 @@ bool FlashPin(uint32_t pin) { return (pin > 21) && (pin < 33); // ESP32S2 skip 22-32 #elif CONFIG_IDF_TARGET_ESP32P4 return false; // ESP32P4 has no flash pins, but GPIOs 34-38 are strapping pins +#elif CONFIG_IDF_TARGET_ESP32S31 + return ((pin >= 26) && (pin <= 28)) || + ((pin >= 30) && (pin <= 32)); // SPI flash pins; GPIO29 is unbonded #else return (pin >= 28) && (pin <= 31); // ESP32 skip 28-31 #endif // ESP32C2/C3/C5/C6 and S2/S3 @@ -1826,6 +1833,8 @@ bool RedPin(uint32_t pin) { // Pin may be dangerous to change, displa return false; // No red pin on ESP32S3 #elif CONFIG_IDF_TARGET_ESP32P4 return (34 >= pin) && (38 <= pin); // strapping pins on ESP32P4 +#elif CONFIG_IDF_TARGET_ESP32S31 + return false; #elif CONFIG_IDF_TARGET_ESP32S3 return (33 <= pin) && (37 >= pin); // ESP32S3: GPIOs 33..37 are usually used for PSRAM #else // ESP32 red pins are 6-11 for original ESP32, other models like PICO are not impacted if flash pins are condfigured @@ -1836,6 +1845,11 @@ bool RedPin(uint32_t pin) { // Pin may be dangerous to change, displa } uint32_t ValidPin(uint32_t pin, uint32_t gpio, uint8_t isTuya = false) { +#if CONFIG_IDF_TARGET_ESP32S31 + if (!GPIO_IS_VALID_GPIO(pin)) { + return GPIO_NONE; + } +#endif if (FlashPin(pin)) { return GPIO_NONE; // Disable flash pins GPIO6, GPIO7, GPIO8 and GPIO11 } @@ -2242,7 +2256,7 @@ void SetSerial(uint32_t baudrate, uint32_t serial_config) { void ClaimSerial(void) { #ifdef ESP32 -#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 +#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32S31 #ifdef USE_USB_CDC_CONSOLE if (!tasconsole_serial) { return; // USB console does not use serial diff --git a/tasmota/tasmota_support/support_command.ino b/tasmota/tasmota_support/support_command.ino index 5aa65df00..8536988c5 100644 --- a/tasmota/tasmota_support/support_command.ino +++ b/tasmota/tasmota_support/support_command.ino @@ -992,9 +992,9 @@ void CmndStatus(void) #endif ",\"" D_JSON_COREVERSION "\":\"" ARDUINO_CORE_RELEASE "\",\"" D_JSON_SDKVERSION "\":\"%s\"," "\"CpuFrequency\":%d,\"Hardware\":\"%s\"" -#ifdef CONFIG_ESP_WIFI_REMOTE_ENABLED +#if defined(CONFIG_ESP_WIFI_REMOTE_ENABLED) && !defined(SOC_WIFI_SUPPORTED) ",\"HostedMCU\":{\"Hardware\":\"%s\",\"Version\":\"%s\"}" -#endif // CONFIG_ESP_WIFI_REMOTE_ENABLED +#endif // CONFIG_ESP_WIFI_REMOTE_ENABLED && !SOC_WIFI_SUPPORTED "%s}}"), TasmotaGlobal.version, TasmotaGlobal.image_name, GetCodeCores().c_str(), GetBuildDateAndTime().c_str() #ifdef ESP8266 @@ -1002,9 +1002,9 @@ void CmndStatus(void) #endif , ESP.getSdkVersion(), ESP.getCpuFreqMHz(), GetDeviceHardwareRevision().c_str(), -#ifdef CONFIG_ESP_WIFI_REMOTE_ENABLED +#if defined(CONFIG_ESP_WIFI_REMOTE_ENABLED) && !defined(SOC_WIFI_SUPPORTED) GetHostedMCU().c_str(), GetHostedFwVersion(1).c_str(), -#endif // CONFIG_ESP_WIFI_REMOTE_ENABLED +#endif // CONFIG_ESP_WIFI_REMOTE_ENABLED && !SOC_WIFI_SUPPORTED GetStatistics().c_str()); CmndStatusResponse(2); } diff --git a/tasmota/tasmota_support/support_crash_recorder.ino b/tasmota/tasmota_support/support_crash_recorder.ino index 3ede23db5..ce5bd54cf 100644 --- a/tasmota/tasmota_support/support_crash_recorder.ino +++ b/tasmota/tasmota_support/support_crash_recorder.ino @@ -285,7 +285,7 @@ void CrashDump(void) } ResponseJsonEnd(); } -#elif CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32P4 +#elif CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32S31 extern "C" { // esp-idf 3.x @@ -315,6 +315,8 @@ const char *esp32c3_crash_reason[] = { #define NUM_C3_REASONS (sizeof(esp32c3_crash_reason) / sizeof(char *)) #include +#include "soc/soc.h" + extern "C" IRAM_ATTR void custom_crash_recorder(void *exc_frame, bool pseudo_excause) { RvExcFrame *regs = (RvExcFrame *)exc_frame; @@ -332,10 +334,23 @@ extern "C" IRAM_ATTR void custom_crash_recorder(void *exc_frame, bool pseudo_exc uint32_t idx = 0; // slot in stack trace crash_recorder.stack[idx++] = regs->ra; // push return address as first value - // // code copied from panic_print_basic_backtrace() - uint32_t * sp = (uint32_t*) regs->sp; + uint32_t stack_start = regs->sp; + uint32_t stack_limit; + if ((stack_start & 0xF) != 0) { return; } + if ((stack_start >= SOC_DRAM_LOW) && (stack_start < SOC_DRAM_HIGH)) { + stack_limit = SOC_DRAM_HIGH; + } +#if CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32S31 + else if ((stack_start >= SOC_EXTRAM_LOW) && (stack_start < SOC_EXTRAM_HIGH)) { + stack_limit = SOC_EXTRAM_HIGH; + } +#endif + else { + return; + } + uint32_t * sp = (uint32_t*) stack_start; uint32_t i = 0; - for (uint32_t i = 0; ((uint32_t) sp) < 0x3FCDFFF0 && i < 320 && idx < crash_dump_max_len; i++, sp++) { + for (uint32_t i = 0; ((uint32_t) sp) < stack_limit && i < 320 && idx < crash_dump_max_len; i++, sp++) { uint32_t value = *sp; if ((value >= 0x40000000) && (value < 0x42800000)) { // keep only addresses in code area crash_recorder.stack[idx++] = value; diff --git a/tasmota/tasmota_support/support_esp32.ino b/tasmota/tasmota_support/support_esp32.ino index 3647f9029..f1c17a24c 100644 --- a/tasmota/tasmota_support/support_esp32.ino +++ b/tasmota/tasmota_support/support_esp32.ino @@ -73,6 +73,10 @@ extern "C" { #include "esp32p4/rom/rtc.h" #include "esp32p4/rom/spi_flash.h" #define ESP_FLASH_IMAGE_BASE 0x2000 // Esp32p4 is located at 0x2000 +#elif CONFIG_IDF_TARGET_ESP32S31 + #include "esp32s31/rom/rtc.h" + #include "esp32s31/rom/spi_flash.h" + #define ESP_FLASH_IMAGE_BASE 0x2000 // Esp32s31 is located at 0x2000 #else #error Target CONFIG_IDF_TARGET is not supported #endif @@ -944,6 +948,9 @@ typedef struct { case 18: { // ESP32-P4 return F("ESP32-P4"); } + case 32: { // ESP32-S31 + return F("ESP32-S31"); + } } return F("ESP32"); } diff --git a/tasmota/tasmota_support/support_wifi.ino b/tasmota/tasmota_support/support_wifi.ino index 2c13052df..b4e12539d 100644 --- a/tasmota/tasmota_support/support_wifi.ino +++ b/tasmota/tasmota_support/support_wifi.ino @@ -459,9 +459,9 @@ void WifiBegin(uint8_t flag, uint8_t channel) { } #ifndef FIRMWARE_SAFEBOOT -#ifdef CONFIG_ESP_WIFI_REMOTE_ENABLED +#if defined(CONFIG_ESP_WIFI_REMOTE_ENABLED) && !defined(SOC_WIFI_SUPPORTED) HostedMCUStatus(); -#endif // CONFIG_ESP_WIFI_REMOTE_ENABLED +#endif // CONFIG_ESP_WIFI_REMOTE_ENABLED && !SOC_WIFI_SUPPORTED #endif // FIRMWARE_SAFEBOOT } @@ -1557,7 +1557,8 @@ void WifiConnect(void) if (!wifi_event_registered) { WiFi.onEvent(WifiEvents); // register event listener only once wifi_event_registered = true; -#ifdef CONFIG_ESP_WIFI_REMOTE_ENABLED +#if defined(CONFIG_ESP_WIFI_REMOTE_ENABLED) && !defined(SOC_WIFI_SUPPORTED) +#if __has_include("esp_hosted.h") // Hosted MCU SDIO pins must be set before WiFi is initialized char sdio_source[10] = "default"; uint32_t sdio_pins[7] = { // From sdkconfig, used by framework if not set by template @@ -1586,9 +1587,10 @@ void WifiConnect(void) } AddLog(LOG_LEVEL_DEBUG, PSTR("HST: Hosted MCU using %s GPIO%02d(CLK), GPIO%02d(CMD), GPIO%02d(D0), GPIO%02d(D1), GPIO%02d(D2), GPIO%02d(D3) and GPIO%02d(RST)"), sdio_source, sdio_pins[0], sdio_pins[1], sdio_pins[2], sdio_pins[3], sdio_pins[4], sdio_pins[5], sdio_pins[6]); -#endif // CONFIG_ESP_WIFI_REMOTE_ENABLED +#endif // __has_include("esp_hosted.h") +#endif // CONFIG_ESP_WIFI_REMOTE_ENABLED && !SOC_WIFI_SUPPORTED } -#endif // ESP32 +#endif // ESP32 WifiSetState(0); // WifiSetOutputPower(); @@ -2160,7 +2162,13 @@ uint64_t WifiGetNtp(void) { // Respond to some Arduino/esp-idf events for better IPv6 support // -------------------------------------------------------------------------------- #ifdef ESP32 +// IDF < 6: esp_interface_t / IDF >= 6: wifi_interface_t (esp_interface_t removed) +#include "esp_idf_version.h" +#if ESP_IDF_VERSION_MAJOR < 6 extern esp_netif_t* get_esp_interface_netif(esp_interface_t interface); +#else +extern esp_netif_t* get_esp_interface_netif(wifi_interface_t interface); +#endif // typedef void (*WiFiEventSysCb)(arduino_event_t *event); @@ -2207,7 +2215,11 @@ void WifiEvents(arduino_event_t *event) { // workaround for the race condition in LWIP, see https://github.com/espressif/arduino-esp32/pull/9016#discussion_r1451774885 { uint32_t i = 5; // try 5 times only + #if ESP_IDF_VERSION_MAJOR < 6 while (esp_netif_create_ip6_linklocal(get_esp_interface_netif(ESP_IF_WIFI_STA)) != ESP_OK) { + #else + while (esp_netif_create_ip6_linklocal(get_esp_interface_netif(WIFI_IF_STA)) != ESP_OK) { + #endif delay(1); if (i-- == 0) { break; diff --git a/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino b/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino index 1c9488f49..070c71781 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino @@ -150,7 +150,7 @@ const char HTTP_SCRIPT_TEMPLATE2[] PROGMEM = "}"; #endif // ESP8266 #ifdef ESP32 -#if CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32S31 const char HTTP_SCRIPT_TEMPLATE2[] PROGMEM = "for(i=0;i<" STR(MAX_USER_PINS) ";i++){" "sk(g[i],i);" // Set GPIO @@ -2363,7 +2363,7 @@ void TemplateSaveSettings(void) { j++; #endif // ESP8266 #ifdef ESP32 -#if CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32P4 +#if CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32S31 snprintf_P(command, sizeof(command), PSTR("%s%s%d"), command, (i>0)?",":"", WebGetGpioArg(i)); #elif CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 if (22 == i) { j = 33; } // skip 22-32 @@ -3122,12 +3122,12 @@ void HandleInformation(void) { SettingsTextEscaped(SET_FRIENDLYNAME1 +i).c_str()); } WSContentSeparatorIFat(); -#ifdef CONFIG_ESP_WIFI_REMOTE_ENABLED +#if defined(CONFIG_ESP_WIFI_REMOTE_ENABLED) && !defined(SOC_WIFI_SUPPORTED) WSContentSend_P(PSTR("}1" D_HOSTED_MCU "}2%s (%s)"), GetHostedMCU().c_str(), GetHostedFwVersion(1).c_str()); WSContentSeparatorIFat(); -#endif // CONFIG_ESP_WIFI_REMOTE_ENABLED +#endif // CONFIG_ESP_WIFI_REMOTE_ENABLED && !SOC_WIFI_SUPPORTED bool show_hr = false; if ((WiFi.getMode() >= WIFI_AP) && (static_cast(WiFi.softAPIP()) != 0)) { WSContentSend_P(PSTR("}1" D_MAC_ADDRESS "}2%s"), WiFi.softAPmacAddress().c_str()); diff --git a/tasmota/tasmota_xdrv_driver/xdrv_07_ufs_domoticz.ino b/tasmota/tasmota_xdrv_driver/xdrv_07_ufs_domoticz.ino index a184e1222..0c3223829 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_07_ufs_domoticz.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_07_ufs_domoticz.ino @@ -213,7 +213,7 @@ void DomoticzSettingsLoad(bool erase) { Domoticz->Settings.sensor_idx[i] = 0; } -#ifndef CONFIG_IDF_TARGET_ESP32P4 +#if !CONFIG_IDF_TARGET_ESP32P4 && !CONFIG_IDF_TARGET_ESP32S31 // Init any other parameter in struct DzSettings Domoticz->Settings.update_timer = Settings->domoticz_update_timer; for (uint32_t i = 0; i < MAX_DOMOTICZ_IDX; i++) { @@ -233,7 +233,7 @@ void DomoticzSettingsLoad(bool erase) { } } // *** End Init default values *** -#endif // CONFIG_IDF_TARGET_ESP32P4 +#endif // !CONFIG_IDF_TARGET_ESP32P4 && !CONFIG_IDF_TARGET_ESP32S31 // Try to load key if (erase) { diff --git a/tasmota/tasmota_xdrv_driver/xdrv_10_scripter.ino b/tasmota/tasmota_xdrv_driver/xdrv_10_scripter.ino index a237bca69..05673bd69 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_10_scripter.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_10_scripter.ino @@ -3445,6 +3445,8 @@ chknext: lp = GetNumericArgument(lp, OPER_EQU, &pin, gv); #ifdef CONFIG_IDF_TARGET_ESP32S3 if (pin < 1 || pin > 20) pin = 1; +#elif defined(CONFIG_IDF_TARGET_ESP32S31) + if (pin < 42 || pin > 57) pin = 42; #elif defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32C6) if (pin < 0 || pin > 5) pin = 0; #else diff --git a/tasmota/tasmota_xdrv_driver/xdrv_121_gpioviewer.ino b/tasmota/tasmota_xdrv_driver/xdrv_121_gpioviewer.ino index b7ae9f615..d2d1f257d 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_121_gpioviewer.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_121_gpioviewer.ino @@ -184,7 +184,12 @@ int GetPinMode(uint32_t pin) { #ifdef ESP32 #ifdef SOC_ADC_SUPPORTED +// IDF 5.x and earlier: soc/adc_periph.h; IDF 6.x+: moved to hal/adc_periph.h +#if __has_include("soc/adc_periph.h") #include "soc/adc_periph.h" +#else +#include "hal/adc_periph.h" +#endif int8_t GVDigitalPinToAnalogChannel(uint8_t pin) { uint8_t channel = 0; diff --git a/tasmota/tasmota_xdrv_driver/xdrv_82_esp32_ethernet.ino b/tasmota/tasmota_xdrv_driver/xdrv_82_esp32_ethernet.ino index ed190a70f..6e35822ee 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_82_esp32_ethernet.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_82_esp32_ethernet.ino @@ -139,7 +139,13 @@ const uint8_t eth_type_xtable[] = { char eth_hostname[sizeof(TasmotaGlobal.hostname)]; uint8_t eth_config_change; +// IDF < 6: esp_interface_t / IDF >= 6: wifi_interface_t (esp_interface_t removed) +#include "esp_idf_version.h" +#if ESP_IDF_VERSION_MAJOR < 6 extern esp_netif_t* get_esp_interface_netif(esp_interface_t interface); +#else +extern esp_netif_t* get_esp_interface_netif(wifi_interface_t interface); +#endif void EthernetEvent(arduino_event_t *event); void EthernetEvent(arduino_event_t *event) { diff --git a/tasmota/tasmota_xdrv_driver/xdrv_84_esp32_hosted.ino b/tasmota/tasmota_xdrv_driver/xdrv_84_esp32_hosted.ino index e03e803fb..20b625aae 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_84_esp32_hosted.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_84_esp32_hosted.ino @@ -8,6 +8,7 @@ #ifdef ESP32 #ifdef CONFIG_ESP_WIFI_REMOTE_ENABLED +#if __has_include("esp_hosted.h") #ifndef FIRMWARE_SAFEBOOT /*********************************************************************************************\ * Support for Hosted MCU to be used on ESP32-H2 and ESP32-P4 @@ -399,5 +400,11 @@ bool Xdrv84(uint32_t function) { } #endif // FIRMWARE_SAFEBOOT +#else // !__has_include("esp_hosted.h") - stub implementations for platforms without Hosted MCU support +// Stub functions so callers compile on platforms where esp_hosted.h is unavailable (e.g. ESP32-C3 with IDF 6.x) +String GetHostedFwVersion(uint32_t device) { return String(""); } +String GetHostedMCU(void) { return String(""); } +void HostedMCUStatus(void) {} +#endif // __has_include("esp_hosted.h") #endif // CONFIG_ESP_WIFI_REMOTE_ENABLED #endif // ESP32 diff --git a/tasmota/tasmota_xdrv_driver/xdrv_91_esp32_twai.ino b/tasmota/tasmota_xdrv_driver/xdrv_91_esp32_twai.ino index e357c140b..d27ce1837 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_91_esp32_twai.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_91_esp32_twai.ino @@ -7,7 +7,7 @@ */ #ifdef ESP32 -#if !CONFIG_IDF_TARGET_ESP32C5 // todo: remove when ESP32C5 TWAI support is added +#if !CONFIG_IDF_TARGET_ESP32C5 && !CONFIG_IDF_TARGET_ESP32S31 // Legacy TWAI driver is not available on these targets #ifdef USE_ESP32_TWAI #if SOC_TWAI_SUPPORTED /*********************************************************************************************\ diff --git a/tasmota/tasmota_xsns_sensor/xsns_52_esp32_ibeacon_ble.ino b/tasmota/tasmota_xsns_sensor/xsns_52_esp32_ibeacon_ble.ino index 0cfef94cb..abd930bf3 100644 --- a/tasmota/tasmota_xsns_sensor/xsns_52_esp32_ibeacon_ble.ino +++ b/tasmota/tasmota_xsns_sensor/xsns_52_esp32_ibeacon_ble.ino @@ -52,7 +52,7 @@ // for testing of BLE_ESP32, we remove xsns_52_ibeacon.ino completely, and instead add this modified xsns_52_ibeacon_BLE_ESP32.ino // in the future this may be more fine-grained, e.g. to allow hm17 for this, and BLE-ESP32 for other -#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C6 ||CONFIG_IDF_TARGET_ESP32S3 +#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32S31 #ifdef USE_BLE_ESP32 #define XSNS_52 52 diff --git a/tasmota/tasmota_xsns_sensor/xsns_62_esp32_mi_ble.ino b/tasmota/tasmota_xsns_sensor/xsns_62_esp32_mi_ble.ino index 5048e64c5..8ba695fb7 100644 --- a/tasmota/tasmota_xsns_sensor/xsns_62_esp32_mi_ble.ino +++ b/tasmota/tasmota_xsns_sensor/xsns_62_esp32_mi_ble.ino @@ -31,7 +31,7 @@ #ifdef USE_BLE_ESP32 #ifdef ESP32 // ESP32 family only. Use define USE_HM10 for ESP8266 support -#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32S3 +#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32S31 #ifdef USE_MI_ESP32