From f3a5dafd04b6493a951013dc929045b47dec9070 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Fri, 23 May 2025 19:37:53 +0200 Subject: [PATCH] Tasmota Esp32c5 (#23464) * initial c5 support * shrink c5 safeboot --- .github/workflows/Tasmota_build_devel.yml | 7 +- .github/workflows/Tasmota_build_master.yml | 7 +- .github/workflows/build_all_the_things.yml | 2 + boards/esp32c5.json | 44 +++++++++++ boards/esp32c5ser.json | 44 +++++++++++ include/esp32x_fixes.h | 2 +- .../src/internal/DotStarEsp32DmaSpiMethod.h | 16 ++-- .../NeoPixelBus/src/internal/NeoBusChannel.h | 2 +- .../src/internal/NeoEsp32RmtMethod.cpp | 2 +- .../src/internal/NeoEsp32RmtMethod.h | 4 +- .../src/internal/NeoEsp32RmtMethod_idf5.h | 12 +-- .../src/internal/NeoEsp32SpiMethod_idf5.h | 2 +- .../src/internal/NeoEspBitBangMethod.cpp | 2 +- .../src/internal/NeoEspBitBangMethod.h | 2 +- lib/lib_display/UDisplay/uDisplay.h | 2 +- .../src/esp8266toEsp32.cpp | 2 +- .../.github/workflows/build.yml | 2 +- .../esp-nimble-cpp/CMakeLists.txt | 1 + pio-tools/add_c_flags.py | 2 +- pio-tools/metrics-firmware.py | 11 +-- platformio_tasmota32.ini | 3 + platformio_tasmota_cenv_sample.ini | 9 +++ platformio_tasmota_env32.ini | 65 +++++++++++++++- tasmota/include/tasmota.h | 4 +- tasmota/include/tasmota_globals.h | 8 +- tasmota/include/tasmota_template.h | 77 +++++++++++++++++++ tasmota/tasmota.ino | 5 +- tasmota/tasmota_support/support.ino | 4 +- tasmota/tasmota_support/support_command.ino | 2 +- .../support_crash_recorder.ino | 2 +- tasmota/tasmota_support/support_esp32.ino | 25 +++++- .../xdrv_01_9_webserver.ino | 12 +-- .../tasmota_xdrv_driver/xdrv_79_esp32_ble.ino | 2 +- .../xdrv_85_esp32_ble_eq3_trv.ino | 2 +- .../xdrv_91_esp32_twai.ino | 2 + .../xsns_52_esp32_ibeacon_ble.ino | 2 +- .../tasmota_xsns_sensor/xsns_62_esp32_mi.ino | 4 +- .../xsns_62_esp32_mi_ble.ino | 2 +- 38 files changed, 333 insertions(+), 65 deletions(-) create mode 100644 boards/esp32c5.json create mode 100644 boards/esp32c5ser.json diff --git a/.github/workflows/Tasmota_build_devel.yml b/.github/workflows/Tasmota_build_devel.yml index 2aa33737a..017100b34 100644 --- a/.github/workflows/Tasmota_build_devel.yml +++ b/.github/workflows/Tasmota_build_devel.yml @@ -92,12 +92,14 @@ jobs: - tasmota32c2-safeboot - tasmota32c3-safeboot - tasmota32c3ser-safeboot + - tasmota32c5-safeboot + - tasmota32c5ser-safeboot + - tasmota32c6-safeboot + - tasmota32c6ser-safeboot - tasmota32s2-safeboot - tasmota32s2cdc-safeboot - tasmota32s3-safeboot - tasmota32s3ser-safeboot - - tasmota32c6-safeboot - - tasmota32c6ser-safeboot steps: - uses: actions/checkout@v4 with: @@ -188,6 +190,7 @@ jobs: - tasmota32-lvgl - tasmota32c2 - tasmota32c3 + - tasmota32c5 - tasmota32c6 - tasmota32s2 - tasmota32s2cdc diff --git a/.github/workflows/Tasmota_build_master.yml b/.github/workflows/Tasmota_build_master.yml index a3162b6aa..1761ecdd9 100644 --- a/.github/workflows/Tasmota_build_master.yml +++ b/.github/workflows/Tasmota_build_master.yml @@ -26,12 +26,14 @@ jobs: - tasmota32c2-safeboot - tasmota32c3-safeboot - tasmota32c3ser-safeboot + - tasmota32c5-safeboot + - tasmota32c5ser-safeboot + - tasmota32c6-safeboot + - tasmota32c6ser-safeboot - tasmota32s2-safeboot - tasmota32s2cdc-safeboot - tasmota32s3-safeboot - tasmota32s3ser-safeboot - - tasmota32c6-safeboot - - tasmota32c6ser-safeboot steps: - uses: actions/checkout@v4 with: @@ -115,6 +117,7 @@ jobs: - tasmota32-lvgl - tasmota32c2 - tasmota32c3 + - tasmota32c5 - tasmota32c6 - tasmota32s2 - tasmota32s2cdc diff --git a/.github/workflows/build_all_the_things.yml b/.github/workflows/build_all_the_things.yml index 5fe75a5d8..a3bbba4e4 100644 --- a/.github/workflows/build_all_the_things.yml +++ b/.github/workflows/build_all_the_things.yml @@ -94,6 +94,7 @@ jobs: - tasmota32solo1 - tasmota32c2 - tasmota32c3 + - tasmota32c5 - tasmota32c6 - tasmota32s2 - tasmota32s2cdc @@ -111,6 +112,7 @@ jobs: - tasmota32s3-safeboot - tasmota32c2-safeboot - tasmota32c3-safeboot + - tasmota32c5-safeboot - tasmota32c6-safeboot steps: - uses: actions/checkout@v4 diff --git a/boards/esp32c5.json b/boards/esp32c5.json new file mode 100644 index 000000000..a509e16a0 --- /dev/null +++ b/boards/esp32c5.json @@ -0,0 +1,44 @@ +{ + "build": { + "core": "esp32", + "extra_flags": "-DARDUINO_TASMOTA -DARDUINO_USB_MODE=1 -DESP32_4M -DESP32C5 -DUSE_USB_CDC_CONSOLE", + "f_cpu": "240000000L", + "f_flash": "80000000L", + "flash_mode": "qio", + "mcu": "esp32c5", + "variant": "esp32c5", + "partitions": "partitions/esp32_partition_app2880k_fs320k.csv" + }, + "connectivity": [ + "wifi", + "bluetooth" + ], + "debug": { + "openocd_target": "esp32c5.cfg" + }, + "frameworks": [ + "arduino", + "espidf" + ], + "name": "Espressif Generic ESP32-C5 >= 4M Flash, Tasmota 2880k Code/OTA, 320k FS", + "upload": { + "arduino": { + "flash_extra_images": [ + [ + "0x10000", + "tasmota32c5-safeboot.bin" + ] + ] + }, + "flash_size": "4MB", + "maximum_ram_size": 327680, + "maximum_size": 4194304, + "require_upload_port": true, + "speed": 2000000 + }, + "download": { + "speed": 2000000 + }, + "url": "https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32c5/esp32-c5-devkitc-1/index.html", + "vendor": "Espressif" + } diff --git a/boards/esp32c5ser.json b/boards/esp32c5ser.json new file mode 100644 index 000000000..c7c31a5ef --- /dev/null +++ b/boards/esp32c5ser.json @@ -0,0 +1,44 @@ +{ + "build": { + "core": "esp32", + "extra_flags": "-DARDUINO_TASMOTA -DESP32_4M -DESP32C5", + "f_cpu": "240000000L", + "f_flash": "80000000L", + "flash_mode": "qio", + "mcu": "esp32c5", + "variant": "esp32c5", + "partitions": "partitions/esp32_partition_app2880k_fs320k.csv" + }, + "connectivity": [ + "wifi", + "bluetooth" + ], + "debug": { + "openocd_target": "esp32c5.cfg" + }, + "frameworks": [ + "arduino", + "espidf" + ], + "name": "Espressif Generic ESP32-C5 >= 4M Flash, Tasmota 2880k Code/OTA, 320k FS", + "upload": { + "arduino": { + "flash_extra_images": [ + [ + "0x10000", + "tasmota32c5ser-safeboot.bin" + ] + ] + }, + "flash_size": "4MB", + "maximum_ram_size": 327680, + "maximum_size": 4194304, + "require_upload_port": true, + "speed": 460800 + }, + "download": { + "speed": 230400 + }, + "url": "https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32c5/esp32-c5-devkitc-1/index.html", + "vendor": "Espressif" + } diff --git a/include/esp32x_fixes.h b/include/esp32x_fixes.h index 7713a6e05..a7dd135f6 100644 --- a/include/esp32x_fixes.h +++ b/include/esp32x_fixes.h @@ -61,7 +61,7 @@ // SPI_MOSI_DLEN_REG is not defined anymore in esp32s3 #define SPI_MOSI_DLEN_REG(x) SPI_MS_DLEN_REG(x) -#elif CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 +#elif CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C6 #define SPI_HOST SPI1_HOST #define HSPI_HOST SPI2_HOST #define VSPI_HOST SPI2_HOST /* No SPI3_host on C2/C6 */ diff --git a/lib/lib_basic/NeoPixelBus/src/internal/DotStarEsp32DmaSpiMethod.h b/lib/lib_basic/NeoPixelBus/src/internal/DotStarEsp32DmaSpiMethod.h index 953a216e7..9bfd598eb 100644 --- a/lib/lib_basic/NeoPixelBus/src/internal/DotStarEsp32DmaSpiMethod.h +++ b/lib/lib_basic/NeoPixelBus/src/internal/DotStarEsp32DmaSpiMethod.h @@ -29,12 +29,12 @@ License along with NeoPixel. If not, see #include "driver/spi_master.h" -#if (defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32C2) || defined(CONFIG_IDF_TARGET_ESP32C6)) && !defined(HSPI_HOST) +#if (defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32C2) || defined(CONFIG_IDF_TARGET_ESP32C5) || defined(CONFIG_IDF_TARGET_ESP32C6)) && !defined(HSPI_HOST) // HSPI_HOST depreciated in C3 #define HSPI_HOST SPI2_HOST #endif -#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C2) && !defined(CONFIG_IDF_TARGET_ESP32C6) +#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C2) && !defined(CONFIG_IDF_TARGET_ESP32C5) && !defined(CONFIG_IDF_TARGET_ESP32C6) class Esp32VspiBus { public: @@ -52,7 +52,7 @@ public: const static int ParallelBits = 1; }; -#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C2) && !defined(CONFIG_IDF_TARGET_ESP32C6) +#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C2) && !defined(CONFIG_IDF_TARGET_ESP32C5) && !defined(CONFIG_IDF_TARGET_ESP32C6) class Esp32Vspi2BitBus { public: @@ -70,7 +70,7 @@ public: const static int ParallelBits = 2; }; -#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C2) && !defined(CONFIG_IDF_TARGET_ESP32C6) +#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C2) && !defined(CONFIG_IDF_TARGET_ESP32C5) && !defined(CONFIG_IDF_TARGET_ESP32C6) class Esp32Vspi4BitBus { public: @@ -174,7 +174,7 @@ public: // If pins aren't specified, initialize bus with just the default SCK and MOSI pins for the SPI peripheral (no SS, no >1-bit pins) void Initialize() { -#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C2) && !defined(CONFIG_IDF_TARGET_ESP32C6) +#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C2) && !defined(CONFIG_IDF_TARGET_ESP32C5) && !defined(CONFIG_IDF_TARGET_ESP32C6) if (T_SPIBUS::SpiHostDevice == VSPI_HOST) { Initialize(SCK, -1, MOSI, -1, -1, -1); @@ -277,7 +277,7 @@ private: int8_t _ssPin; }; -#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C2) && !defined(CONFIG_IDF_TARGET_ESP32C6) +#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C2) && !defined(CONFIG_IDF_TARGET_ESP32C5) && !defined(CONFIG_IDF_TARGET_ESP32C6) // Clock Speed and Default Definitions for DotStarEsp32DmaVspi typedef DotStarEsp32DmaSpiMethod DotStarEsp32DmaVspi40MhzMethod; typedef DotStarEsp32DmaSpiMethod DotStarEsp32DmaVspi20MhzMethod; @@ -303,7 +303,7 @@ typedef DotStarEsp32DmaSpiMethod DotStarEsp32DmaHspiHz typedef DotStarEsp32DmaHspi10MhzMethod DotStarEsp32DmaHspiMethod; -#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C2) && !defined(CONFIG_IDF_TARGET_ESP32C6) +#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C2) && !defined(CONFIG_IDF_TARGET_ESP32C5) && !defined(CONFIG_IDF_TARGET_ESP32C6) // Clock Speed and Default Definitions for DotStarEsp32DmaVspi2Bit typedef DotStarEsp32DmaSpiMethod DotStarEsp32DmaVspi2Bit40MhzMethod; typedef DotStarEsp32DmaSpiMethod DotStarEsp32DmaVspi2Bit20MhzMethod; @@ -329,7 +329,7 @@ typedef DotStarEsp32DmaSpiMethod DotStarEsp32DmaHsp typedef DotStarEsp32DmaHspi2Bit10MhzMethod DotStarEsp32DmaHspi2BitMethod; -#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C2) && !defined(CONFIG_IDF_TARGET_ESP32C6) +#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C2) && !defined(CONFIG_IDF_TARGET_ESP32C5) && !defined(CONFIG_IDF_TARGET_ESP32C6) // Clock Speed and Default Definitions for DotStarEsp32DmaVspi4Bit typedef DotStarEsp32DmaSpiMethod DotStarEsp32DmaVspi4Bit40MhzMethod; typedef DotStarEsp32DmaSpiMethod DotStarEsp32DmaVspi4Bit20MhzMethod; diff --git a/lib/lib_basic/NeoPixelBus/src/internal/NeoBusChannel.h b/lib/lib_basic/NeoPixelBus/src/internal/NeoBusChannel.h index 5fdb131bf..ddfd0f852 100644 --- a/lib/lib_basic/NeoPixelBus/src/internal/NeoBusChannel.h +++ b/lib/lib_basic/NeoPixelBus/src/internal/NeoBusChannel.h @@ -12,7 +12,7 @@ enum NeoBusChannel NeoBusChannel_0, NeoBusChannel_1, -#if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C2) && !defined(CONFIG_IDF_TARGET_ESP32C6) +#if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C2) && !defined(CONFIG_IDF_TARGET_ESP32C5) && !defined(CONFIG_IDF_TARGET_ESP32C6) NeoBusChannel_2, diff --git a/lib/lib_basic/NeoPixelBus/src/internal/NeoEsp32RmtMethod.cpp b/lib/lib_basic/NeoPixelBus/src/internal/NeoEsp32RmtMethod.cpp index c8525e09d..5bd32855d 100644 --- a/lib/lib_basic/NeoPixelBus/src/internal/NeoEsp32RmtMethod.cpp +++ b/lib/lib_basic/NeoPixelBus/src/internal/NeoEsp32RmtMethod.cpp @@ -32,7 +32,7 @@ License along with NeoPixel. If not, see #include "NeoBusChannel.h" #include "NeoEsp32RmtMethod.h" -#if defined(ARDUINO_ARCH_ESP32) && !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(CONFIG_IDF_TARGET_ESP32C2) +#if defined(ARDUINO_ARCH_ESP32) && !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(CONFIG_IDF_TARGET_ESP32C2) && !defined(CONFIG_IDF_TARGET_ESP32C5) // translate NeoPixelBuffer into RMT buffer diff --git a/lib/lib_basic/NeoPixelBus/src/internal/NeoEsp32RmtMethod.h b/lib/lib_basic/NeoPixelBus/src/internal/NeoEsp32RmtMethod.h index e804cc2a7..b820ace1b 100644 --- a/lib/lib_basic/NeoPixelBus/src/internal/NeoEsp32RmtMethod.h +++ b/lib/lib_basic/NeoPixelBus/src/internal/NeoEsp32RmtMethod.h @@ -29,7 +29,7 @@ License along with NeoPixel. If not, see #pragma once -#if defined(ARDUINO_ARCH_ESP32) && !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(CONFIG_IDF_TARGET_ESP32C2) +#if defined(ARDUINO_ARCH_ESP32) && !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(CONFIG_IDF_TARGET_ESP32C2) && !defined(CONFIG_IDF_TARGET_ESP32C5) /* General Reference documentation for the APIs used in this implementation LOW LEVEL: (what is actually used) @@ -454,7 +454,7 @@ public: const static rmt_channel_t RmtChannelNumber = RMT_CHANNEL_3; }; -#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C6) +#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C5) && !defined(CONFIG_IDF_TARGET_ESP32C6) class NeoEsp32RmtChannel4 { diff --git a/lib/lib_basic/NeoPixelBus/src/internal/NeoEsp32RmtMethod_idf5.h b/lib/lib_basic/NeoPixelBus/src/internal/NeoEsp32RmtMethod_idf5.h index d26aece56..d84a79b80 100644 --- a/lib/lib_basic/NeoPixelBus/src/internal/NeoEsp32RmtMethod_idf5.h +++ b/lib/lib_basic/NeoPixelBus/src/internal/NeoEsp32RmtMethod_idf5.h @@ -399,7 +399,7 @@ public: rmt_channel_handle_t RmtChannelNumber = NULL; }; -#if !defined(CONFIG_IDF_TARGET_ESP32C6) // C6 only 2 RMT channels ?? +#if !defined(CONFIG_IDF_TARGET_ESP32C5) && !defined(CONFIG_IDF_TARGET_ESP32C6) // C5 & C6 only 2 RMT channels class NeoEsp32RmtChannel2 { public: @@ -417,7 +417,7 @@ protected: rmt_channel_handle_t RmtChannelNumber = NULL; }; #endif // !defined(CONFIG_IDF_TARGET_ESP32C6) -#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C6) +#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C5) && !defined(CONFIG_IDF_TARGET_ESP32C6) class NeoEsp32RmtChannel4 { @@ -634,7 +634,7 @@ typedef NeoEsp32RmtMethodBase NeoEs typedef NeoEsp32RmtMethodBase NeoEsp32Rmt1800KbpsMethod; typedef NeoEsp32RmtMethodBase NeoEsp32Rmt1400KbpsMethod; -#if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C6) +#if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C5) && !defined(CONFIG_IDF_TARGET_ESP32C6) typedef NeoEsp32RmtMethodBase NeoEsp32Rmt2Ws2811Method; typedef NeoEsp32RmtMethodBase NeoEsp32Rmt2Ws2812xMethod; @@ -741,7 +741,7 @@ typedef NeoEsp32RmtMethodBase NeoEsp32Rmt1800KbpsInvertedMethod; typedef NeoEsp32RmtMethodBase NeoEsp32Rmt1400KbpsInvertedMethod; -#if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C6) +#if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C5) && !defined(CONFIG_IDF_TARGET_ESP32C6) typedef NeoEsp32RmtMethodBase NeoEsp32Rmt2Ws2811InvertedMethod; typedef NeoEsp32RmtMethodBase NeoEsp32Rmt2Ws2812xInvertedMethod; @@ -815,13 +815,13 @@ typedef NeoEsp32RmtMethodBase // ESP32C3 I2S is not supported yet -#if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C2) && !defined(CONFIG_IDF_TARGET_ESP32C6) +#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" #endif diff --git a/lib/lib_basic/NeoPixelBus/src/internal/NeoEspBitBangMethod.h b/lib/lib_basic/NeoPixelBus/src/internal/NeoEspBitBangMethod.h index 44f865488..655f16ba8 100644 --- a/lib/lib_basic/NeoPixelBus/src/internal/NeoEspBitBangMethod.h +++ b/lib/lib_basic/NeoPixelBus/src/internal/NeoEspBitBangMethod.h @@ -29,7 +29,7 @@ License along with NeoPixel. If not, see #if defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32) // ESP32C3 I2S is not supported yet -#if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C2) && !defined(CONFIG_IDF_TARGET_ESP32C6) +#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 diff --git a/lib/lib_display/UDisplay/uDisplay.h b/lib/lib_display/UDisplay/uDisplay.h index 64afbaebd..36c9224c7 100755 --- a/lib/lib_display/UDisplay/uDisplay.h +++ b/lib/lib_display/UDisplay/uDisplay.h @@ -112,7 +112,7 @@ enum uColorType { uCOLOR_BW, uCOLOR_COLOR }; #undef GPIO_SET_SLOW #undef GPIO_CLR_SLOW -#if CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 +#if CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C6 #define GPIO_CLR(A) GPIO.out_w1tc.val = (1 << A) #define GPIO_SET(A) GPIO.out_w1ts.val = (1 << A) #else // plain ESP32 diff --git a/lib/libesp32/ESP32-to-ESP8266-compat/src/esp8266toEsp32.cpp b/lib/libesp32/ESP32-to-ESP8266-compat/src/esp8266toEsp32.cpp index 8149b4bfa..9cfd9b997 100644 --- a/lib/libesp32/ESP32-to-ESP8266-compat/src/esp8266toEsp32.cpp +++ b/lib/libesp32/ESP32-to-ESP8266-compat/src/esp8266toEsp32.cpp @@ -52,7 +52,7 @@ enum LoggingLevels {LOG_LEVEL_NONE, LOG_LEVEL_ERROR, LOG_LEVEL_INFO, LOG_LEVEL_D 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_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 +#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 const uint8_t MAX_PWMS = 5; // Unknown - revert to 5 PWM max diff --git a/lib/libesp32_div/esp-nimble-cpp/.github/workflows/build.yml b/lib/libesp32_div/esp-nimble-cpp/.github/workflows/build.yml index f256daaff..c35e6fc2a 100644 --- a/lib/libesp32_div/esp-nimble-cpp/.github/workflows/build.yml +++ b/lib/libesp32_div/esp-nimble-cpp/.github/workflows/build.yml @@ -16,7 +16,7 @@ jobs: # https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/tools/idf-docker-image.html # for details. idf_ver: ["release-v4.4", "release-v5.1"] - idf_target: ["esp32", "esp32s3", "esp32c2", "esp32c3", "esp32c6"] + idf_target: ["esp32", "esp32s3", "esp32c2", "esp32c3", "esp32c5", "esp32c6"] example: - Advanced/NimBLE_Client - Advanced/NimBLE_Server diff --git a/lib/libesp32_div/esp-nimble-cpp/CMakeLists.txt b/lib/libesp32_div/esp-nimble-cpp/CMakeLists.txt index 4bed65b11..4a954934e 100644 --- a/lib/libesp32_div/esp-nimble-cpp/CMakeLists.txt +++ b/lib/libesp32_div/esp-nimble-cpp/CMakeLists.txt @@ -30,6 +30,7 @@ idf_component_register( "esp32s3" "esp32c2" "esp32c3" + "esp32c5" "esp32c6" "esp32h2" INCLUDE_DIRS diff --git a/pio-tools/add_c_flags.py b/pio-tools/add_c_flags.py index 835add5c0..980cd8840 100644 --- a/pio-tools/add_c_flags.py +++ b/pio-tools/add_c_flags.py @@ -10,7 +10,7 @@ env.Append(CXXFLAGS=["-Wno-volatile"]) env.Append(CFLAGS=["-Wno-discarded-qualifiers", "-Wno-implicit-function-declaration", "-Wno-incompatible-pointer-types"]) # Remove build flags which are not valid for risc-v -if mcu in ("esp32c2", "esp32c3", "esp32c6", "esp32h2", "esp32p4"): +if mcu in ("esp32c2", "esp32c3", "esp32c5", "esp32c6", "esp32h2", "esp32p4"): try: build_flags.pop(build_flags.index("-mno-target-align")) except: diff --git a/pio-tools/metrics-firmware.py b/pio-tools/metrics-firmware.py index 38849ea60..e90879814 100644 --- a/pio-tools/metrics-firmware.py +++ b/pio-tools/metrics-firmware.py @@ -7,16 +7,7 @@ import subprocess def firm_metrics(source, target, env): print() - if env["PIOPLATFORM"] == "espressif32": - try: - import tasmota_metrics - map_file = str(tasmotapiolib.get_source_map_path(env).resolve()) - subprocess.run([ - env.subst("$PYTHONEXE"), "-m", "tasmota_metrics", map_file - ], check=False) - except: - pass - elif env["PIOPLATFORM"] == "espressif8266": + if env["PIOPLATFORM"] == "espressif8266": map_file = join(env.subst("$BUILD_DIR")) + os.sep + "firmware.map" with open(map_file,'r', encoding='utf-8') as f: phrase = "_text_end = ABSOLUTE (.)" diff --git a/platformio_tasmota32.ini b/platformio_tasmota32.ini index 7c53a0e09..36b8c2ab7 100644 --- a/platformio_tasmota32.ini +++ b/platformio_tasmota32.ini @@ -54,6 +54,7 @@ monitor_filters = esp32_exception_decoder lib_ignore = ${esp32_defaults.lib_ignore} ESPmDNS LinkedList + LittleFS ESP Mail Client IRremoteESP8266 NeoPixelBus @@ -69,6 +70,8 @@ lib_ignore = ${esp32_defaults.lib_ignore} SD SD_MMC UdpListener + esp_wireguard_tasmota + IniFile Berry Berry mapping to C Berry Tasmota mapping diff --git a/platformio_tasmota_cenv_sample.ini b/platformio_tasmota_cenv_sample.ini index b89852c45..52686a69d 100644 --- a/platformio_tasmota_cenv_sample.ini +++ b/platformio_tasmota_cenv_sample.ini @@ -211,6 +211,15 @@ build_flags = ${env:tasmota32_base.build_flags} lib_extra_dirs = lib/libesp32, lib/libesp32_div, lib/lib_basic, lib/lib_i2c, lib/lib_div, lib/lib_ssl lib_ignore = Micro-RTSP +[env:tasmota32c5-mi32] +extends = env:tasmota32_base +board = esp32c5 +build_flags = ${env:tasmota32_base.build_flags} + -DFIRMWARE_BLUETOOTH + -DUSE_MI_EXT_GUI + -DCONFIG_BT_NIMBLE_NVS_PERSIST=y + -DOTA_URL='""' + [env:tasmota32c6-mi32] extends = env:tasmota32_base board = esp32c6 diff --git a/platformio_tasmota_env32.ini b/platformio_tasmota_env32.ini index afbf82f92..aaf397bf6 100644 --- a/platformio_tasmota_env32.ini +++ b/platformio_tasmota_env32.ini @@ -130,6 +130,62 @@ build_flags = ${env:tasmota32_base.build_flags} lib_extra_dirs = lib/lib_ssl, lib/libesp32 lib_ignore = ${safeboot_flags.lib_ignore} +[env:tasmota32c5-safeboot] +extends = env:tasmota32_base +board = esp32c5 +board_build.app_partition_name = safeboot +build_flags = ${env:tasmota32_base.build_flags} + -DFIRMWARE_SAFEBOOT + -DOTA_URL='"http://ota.tasmota.com/tasmota32/release/tasmota32c5-safeboot.bin"' +lib_extra_dirs = lib/lib_ssl, lib/libesp32 +lib_ignore = ${safeboot_flags.lib_ignore} +custom_sdkconfig = + '# CONFIG_BT_ENABLED is not set' + '# CONFIG_BT_NIMBLE_ENABLED is not set' + '# CONFIG_BT_CONTROLLER_ENABLED is not set' + CONFIG_BT_CONTROLLER_DISABLED=y + '# CONFIG_LWIP_IP_FORWARD is not set' + '# CONFIG_LWIP_IPV4_NAPT is not set' + '# CONFIG_LWIP_IPV4_NAPT_PORTMAP is not set' + '# CONFIG_ETH_ENABLED is not set' + '# CONFIG_ETH_USE_SPI_ETHERNET is not set' + '# CONFIG_ETH_TRANSMIT_MUTEX is not set' + '# CONFIG_ETH_SPI_ETHERNET_DM9051 is not set' + '# CONFIG_ETH_SPI_ETHERNET_W5500 is not set' + '# CONFIG_ETH_SPI_ETHERNET_KSZ8851SNL is not set' + '# CONFIG_LWIP_PPP_SUPPORT is not set' +custom_component_remove = espressif/esp_hosted + espressif/esp_wifi_remote + espressif/esp_modem + +[env:tasmota32c5ser-safeboot] +extends = env:tasmota32_base +board = esp32c5ser +board_build.app_partition_name = safeboot +build_flags = ${env:tasmota32_base.build_flags} + -DFIRMWARE_SAFEBOOT + -DOTA_URL='"http://ota.tasmota.com/tasmota32/release/tasmota32c5ser-safeboot.bin"' +lib_extra_dirs = lib/lib_ssl, lib/libesp32 +lib_ignore = ${safeboot_flags.lib_ignore} +custom_sdkconfig = + '# CONFIG_BT_ENABLED is not set' + '# CONFIG_BT_NIMBLE_ENABLED is not set' + '# CONFIG_BT_CONTROLLER_ENABLED is not set' + CONFIG_BT_CONTROLLER_DISABLED=y + '# CONFIG_LWIP_IP_FORWARD is not set' + '# CONFIG_LWIP_IPV4_NAPT is not set' + '# CONFIG_LWIP_IPV4_NAPT_PORTMAP is not set' + '# CONFIG_ETH_ENABLED is not set' + '# CONFIG_ETH_USE_SPI_ETHERNET is not set' + '# CONFIG_ETH_TRANSMIT_MUTEX is not set' + '# CONFIG_ETH_SPI_ETHERNET_DM9051 is not set' + '# CONFIG_ETH_SPI_ETHERNET_W5500 is not set' + '# CONFIG_ETH_SPI_ETHERNET_KSZ8851SNL is not set' + '# CONFIG_LWIP_PPP_SUPPORT is not set' +custom_component_remove = espressif/esp_hosted + espressif/esp_wifi_remote + espressif/esp_modem + [env:tasmota32c6-safeboot] extends = env:tasmota32_base board = esp32c6 @@ -224,7 +280,14 @@ build_flags = ${env:tasmota32_base.build_flags} -DOTA_URL='"http://ota.tasmota.com/tasmota32/release/tasmota32c3.bin"' lib_ignore = ${env:tasmota32_base.lib_ignore} Micro-RTSP - +[env:tasmota32c5] +extends = env:tasmota32_base +board = esp32c5 +build_flags = ${env:tasmota32_base.build_flags} + -DFIRMWARE_TASMOTA32 + -DOTA_URL='"http://ota.tasmota.com/tasmota32/release/tasmota32c5.bin"' +lib_ignore = ${env:tasmota32_base.lib_ignore} + Micro-RTSP [env:tasmota32c6] extends = env:tasmota32_base board = esp32c6 diff --git a/tasmota/include/tasmota.h b/tasmota/include/tasmota.h index 86ce99b83..c1771dc83 100644 --- a/tasmota/include/tasmota.h +++ b/tasmota/include/tasmota.h @@ -63,7 +63,7 @@ const uint8_t MAX_PWMS_LEGACY = 5; // Max number of PWM channels in fir 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_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 + #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 const uint8_t MAX_PWMS = 5; // Unknown - revert to 5 PWM max @@ -135,6 +135,8 @@ const uint8_t MAX_SWITCHES_TXT = 8; // Max number of switches user text #ifdef ESP32 #if CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 const uint8_t MAX_ADCS = 5; // Max number of ESP32-C3 ADC pins (ADC2 pins are unusable with Wifi enabled) + #elif CONFIG_IDF_TARGET_ESP32C5 + const uint8_t MAX_ADCS = 6; // Max number of ESP32 ADC pins (ADC2 pins are unusable with Wifi enabled) #elif CONFIG_IDF_TARGET_ESP32C6 const uint8_t MAX_ADCS = 7; // Max number of ESP32 ADC pins (ADC2 pins are unusable with Wifi enabled) #else // ESP32 diff --git a/tasmota/include/tasmota_globals.h b/tasmota/include/tasmota_globals.h index 4d2603e66..1fa21c4e3 100644 --- a/tasmota/include/tasmota_globals.h +++ b/tasmota/include/tasmota_globals.h @@ -148,15 +148,15 @@ const char WIFI_HOSTNAME[] = WIFI_DEFAULT_HOSTNAME; // Override by user_confi \*-------------------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------------------*\ - * Start ESP32-C3/C6 specific parameters - disable features not present in ESP32-C3/C6 + * Start ESP32-C3/C5/C6 specific parameters - disable features not present in ESP32-C3/C5/C6 \*-------------------------------------------------------------------------------------------*/ -#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 // ESP32-C3/C6 +#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C6 // ESP32-C3/C5/C6 //#ifdef USE_ETHERNET -//#undef USE_ETHERNET // ESP32-C3/C6 does not support ethernet +//#undef USE_ETHERNET // ESP32-C3/C5/C6 does not support ethernet //#endif -#endif // CONFIG_IDF_TARGET_ESP32C3/C6 +#endif // CONFIG_IDF_TARGET_ESP32C3/C5/C6 /*-------------------------------------------------------------------------------------------*\ * End ESP32-C3 specific parameters diff --git a/tasmota/include/tasmota_template.h b/tasmota/include/tasmota_template.h index 5bd6f9667..1e590d1fa 100644 --- a/tasmota/include/tasmota_template.h +++ b/tasmota/include/tasmota_template.h @@ -1412,6 +1412,19 @@ const char PINS_WEMOS[] PROGMEM = "AOAOAOAOAOIOIOIOIOIOIOFLFLFLFLFLFLFLIORXTX"; // 0 1 2 3 4 5 6 7 8 9101112131415161718192021 const char PINS_WEMOS[] PROGMEM = "AOAOAOAOAOAOIOIOIOIOIOFLFLFLFLFLFLFLIOIORXTX"; +//#elif CONFIG_IDF_TARGET_ESP32C5 + +/* **************************************** + * ESP32C5 + * ****************************************/ +//#define MAX_GPIO_PIN 27 // Number of supported GPIO +//#define MIN_FLASH_PINS 0 // Number of flash chip pins unusable for configuration (GPIO24 to 30) +//#define MAX_USER_PINS 27 // MAX_GPIO_PIN - MIN_FLASH_PINS +//#define WEMOS_MODULE 0 // Wemos module + +// 0 1 2 3 4 5 6 7 8 91011121314151617181920212223242526 +//const char PINS_WEMOS[] PROGMEM = "AOAOAOAOAOAOAOIOIOIOIOIOIOIOIOIOTXRXIOIOIOIOIOIOFLFLFL"; + #elif CONFIG_IDF_TARGET_ESP32C6 /* **************************************** @@ -3054,6 +3067,70 @@ const mytmplt kModules[] PROGMEM = { Known templates \*********************************************************************************************/ +#elif CONFIG_IDF_TARGET_ESP32C5 +/********************************************************************************************\ + * ESP32-C5 Module templates +\********************************************************************************************/ + +#define USER_MODULE 255 + +// Supported hardware modules +enum SupportedModulesESP32C5 { + WEMOS, // not really correct, a placeholder for now + MAXMODULE }; + +// Default module settings +const uint8_t kModuleNiceList[] PROGMEM = { + WEMOS, +}; + +// !!! Update this list in the same order as kModuleNiceList !!! +const char kModuleNames[] PROGMEM = + "ESP32C5|" + ; + +// !!! Update this list in the same order as SupportedModulesESP32C5 !!! +const mytmplt kModules[] PROGMEM = { + { // Generic ESP32C5 device + AGPIO(GPIO_USER), // 0 IO GPIO0, ADC1_CH0, LP_GPIO0 + AGPIO(GPIO_USER), // 1 IO GPIO1, ADC1_CH1, LP_GPIO1 + AGPIO(GPIO_USER), // 2 IO GPIO2, ADC1_CH2, LP_GPIO2 + AGPIO(GPIO_USER), // 3 IO GPIO3, ADC1_CH3, LP_GPIO3 + AGPIO(GPIO_USER), // 4 IO GPIO4, ADC1_CH4, LP_GPIO4, Strapping + AGPIO(GPIO_USER), // 5 IO GPIO5, ADC1_CH5, LP_GPIO5, Strapping + AGPIO(GPIO_USER), // 6 IO GPIO6, ADC1_CH6, LP_GPIO6 + AGPIO(GPIO_USER), // 7 IO GPIO7, LP_GPIO7 + AGPIO(GPIO_USER), // 8 IO GPIO8, Strapping + AGPIO(GPIO_USER), // 9 IO GPIO9, Strapping + AGPIO(GPIO_USER), // 10 IO GPIO10 (QFN40 only) + AGPIO(GPIO_USER), // 11 IO GPIO11 (QFN40 only) + AGPIO(GPIO_USER), // 12 IO GPIO12, USB-JTAG + AGPIO(GPIO_USER), // 13 IO GPIO13, USB-JTAG + AGPIO(GPIO_USER), // 14 IO GPIO14 (QFN32 only) + AGPIO(GPIO_USER), // 15 IO GPIO15, Strapping + AGPIO(GPIO_USER), // 16 IO TXD0 GPIO16, U0TXD + AGPIO(GPIO_USER), // 17 IO RXD0 GPIO17, U0RXD + AGPIO(GPIO_USER), // 18 IO GPIO18, SDIO_CMD + AGPIO(GPIO_USER), // 19 IO GPIO19, SDIO_CLK + AGPIO(GPIO_USER), // 20 IO GPIO20, SDIO_DATA0 + AGPIO(GPIO_USER), // 21 IO GPIO21, SDIO_DATA1 + AGPIO(GPIO_USER), // 22 IO GPIO22, SDIO_DATA2 + AGPIO(GPIO_USER), // 23 IO GPIO23, SDIO_DATA3 + 0, // 24 IO GPIO24, SPICS1, PSRAM + 0, // 25 IO GPIO25, SPIQ + 0, // 26 IO GPIO26, SPIWP - Free if flash DIO/DOUT + 0, // 27 IO GPIO27, SPIVDD + 0, // 28 IO GPIO28, SPIHD - Free if flash DIO/DOUT + 0, // 29 IO GPIO29, SPICLK + 0, // 30 IO GPIO30, SPID + 0 // Flag + }, +}; + +/*********************************************************************************************\ + Known templates +\*********************************************************************************************/ + #elif CONFIG_IDF_TARGET_ESP32C6 /********************************************************************************************\ * ESP32-C6 Module templates diff --git a/tasmota/tasmota.ino b/tasmota/tasmota.ino index 586612497..3d50eb518 100644 --- a/tasmota/tasmota.ino +++ b/tasmota/tasmota.ino @@ -208,11 +208,12 @@ WiFiUDP PortUdp; // UDP Syslog and Alexa #ifdef ESP32 /* #if CONFIG_IDF_TARGET_ESP32C3 || // support USB via HWCDC using JTAG interface + CONFIG_IDF_TARGET_ESP32C5 || // support USB via HWCDC using JTAG interface CONFIG_IDF_TARGET_ESP32C6 || // support USB via HWCDC using JTAG interface 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_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 //#if CONFIG_TINYUSB_CDC_ENABLED // This define is not recognized here so use USE_USB_CDC_CONSOLE #ifdef USE_USB_CDC_CONSOLE @@ -493,7 +494,7 @@ void setup(void) { } #ifdef ESP32 -#if CONFIG_IDF_TARGET_ESP32C3 || 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 #ifdef USE_USB_CDC_CONSOLE bool is_connected_to_USB = false; diff --git a/tasmota/tasmota_support/support.ino b/tasmota/tasmota_support/support.ino index f5a72ad7f..01d51b3da 100755 --- a/tasmota/tasmota_support/support.ino +++ b/tasmota/tasmota_support/support.ino @@ -1714,7 +1714,7 @@ void TemplateGpios(myio *gp) j++; #endif // ESP8266 #ifdef ESP32 -#if CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 +#if CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C6 dest[i] = src[i]; #elif CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 if (22 == i) { j = 33; } // skip 22-32 @@ -2203,7 +2203,7 @@ void SetSerial(uint32_t baudrate, uint32_t serial_config) { void ClaimSerial(void) { #ifdef ESP32 -#if CONFIG_IDF_TARGET_ESP32C3 || 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 #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 dbd75a8fd..5ab034202 100644 --- a/tasmota/tasmota_support/support_command.ino +++ b/tasmota/tasmota_support/support_command.ino @@ -2137,7 +2137,7 @@ void CmndTemplate(void) if (8 == i) { j = 12; } #endif // ESP8266 #ifdef ESP32 -#if CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 +#if CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C6 // No change #elif CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 // if (22 == i) { j = 33; } // TODO 20230821 verify diff --git a/tasmota/tasmota_support/support_crash_recorder.ino b/tasmota/tasmota_support/support_crash_recorder.ino index ab894e1ee..19e3e99f0 100644 --- a/tasmota/tasmota_support/support_crash_recorder.ino +++ b/tasmota/tasmota_support/support_crash_recorder.ino @@ -261,7 +261,7 @@ void CrashDump(void) } ResponseJsonEnd(); } -#elif CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 +#elif CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C6 extern "C" { // esp-idf 3.x diff --git a/tasmota/tasmota_support/support_esp32.ino b/tasmota/tasmota_support/support_esp32.ino index 3ce402119..74aa88c58 100644 --- a/tasmota/tasmota_support/support_esp32.ino +++ b/tasmota/tasmota_support/support_esp32.ino @@ -31,6 +31,8 @@ const static char kWifiPhyMode[] PROGMEM = "low rate|11b|11g|HT20|HT40|HE20"; // #define ESP32_ARCH "esp32c2" #elif CONFIG_IDF_TARGET_ESP32C3 #define ESP32_ARCH "esp32c3" +#elif CONFIG_IDF_TARGET_ESP32C5 + #define ESP32_ARCH "esp32c5" #elif CONFIG_IDF_TARGET_ESP32C6 #define ESP32_ARCH "esp32c6" #elif CONFIG_IDF_TARGET_ESP32H2 @@ -51,6 +53,8 @@ const static char kWifiPhyMode[] PROGMEM = "low rate|11b|11g|HT20|HT40|HE20"; // #include "esp32c2/rom/rtc.h" #elif CONFIG_IDF_TARGET_ESP32C3 // ESP32-C3 #include "esp32c3/rom/rtc.h" +#elif CONFIG_IDF_TARGET_ESP32C5 // ESP32-C5 + #include "esp32c5/rom/rtc.h" #elif CONFIG_IDF_TARGET_ESP32C6 // ESP32-C6 #include "esp32c6/rom/rtc.h" #elif CONFIG_IDF_TARGET_ESP32H2 // ESP32-H2 @@ -240,6 +244,9 @@ extern "C" { #elif CONFIG_IDF_TARGET_ESP32C3 // ESP32-C3 #include "esp32c3/rom/spi_flash.h" #define ESP_FLASH_IMAGE_BASE 0x0000 // Esp32c3 is located at 0x0000 +#elif CONFIG_IDF_TARGET_ESP32C5 // ESP32-C5 + #include "esp32c5/rom/spi_flash.h" + #define ESP_FLASH_IMAGE_BASE 0x2000 // Esp32c5 is located at 0x2000 #elif CONFIG_IDF_TARGET_ESP32C6 // ESP32-C6 #include "esp32c6/rom/spi_flash.h" #define ESP_FLASH_IMAGE_BASE 0x0000 // Esp32c6 is located at 0x0000 @@ -585,7 +592,7 @@ extern "C" { // `psramFound()` can return true even if no PSRAM is actually installed // This new version also checks `esp_spiram_is_initialized` to know if the PSRAM is initialized bool FoundPSRAM(void) { -#if CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 || DISABLE_PSRAMCHECK || CORE32SOLO1 +#if CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C6 || DISABLE_PSRAMCHECK || CORE32SOLO1 return psramFound(); #else return psramFound() && esp_psram_is_initialized(); @@ -712,6 +719,7 @@ typedef enum { CHIP_ESP32S3 = 9, //!< ESP32-S3 CHIP_ESP32C3 = 5, //!< ESP32-C3 CHIP_ESP32C2 = 12, //!< ESP32-C2 + CHIP_ESP32C5 = 23, //!< ESP32-C5 CHIP_ESP32C6 = 13, //!< ESP32-C6 CHIP_ESP32H2 = 16, //!< ESP32-H2 CHIP_POSIX_LINUX = 999, //!< The code is running on POSIX/Linux simulator @@ -874,6 +882,21 @@ typedef struct { #endif // CONFIG_IDF_TARGET_ESP32C2 return F("ESP32-C2"); } + case 23: { // ESP32-C5 + /* + ESP32-C5 Series + - Ultra-low-power SoC with 32-bit RISC-V single-core microprocessor + - 2.4 and 5 GHz dual-band Wi-Fi 6 (802.11ax), Bluetooth® 5 (LE), Zigbee and Thread (802.15.4) + - 27 or 19 GPIOs, rich set of peripherals + */ +#ifdef CONFIG_IDF_TARGET_ESP32C5 + switch (pkg_version) { + case 0: return F("ESP32-C5"); + case 1: return F("ESP32-C5FH4"); + } +#endif // CONFIG_IDF_TARGET_ESP32C5 + return F("ESP32-C5"); + } case 7: // ESP32-C6(beta) case 13: { // ESP32-C6 /* diff --git a/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino b/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino index f0e595aac..502f5dc2e 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino @@ -154,7 +154,7 @@ const char HTTP_SCRIPT_TEMPLATE2[] PROGMEM = "}"; #endif // ESP8266 #ifdef ESP32 -#if CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 +#if CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C6 const char HTTP_SCRIPT_TEMPLATE2[] PROGMEM = "for(i=0;i<" STR(MAX_USER_PINS) ";i++){" "sk(g[i],i);" // Set GPIO @@ -2144,14 +2144,14 @@ void HandleTemplateConfiguration(void) { WSContentBegin(200, CT_PLAIN); WSContentSend_P(PSTR("%s}1"), AnyModuleName(module).c_str()); // NAME: Generic for (uint32_t i = 0; i < nitems(template_gp.io); i++) { // 17,148,29,149,7,255,255,255,138,255,139,255,255 -#if CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 +#if CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C6 // ESP32C2/C3/C6 we always send all GPIOs, Flash are just hidden WSContentSend_P(PSTR("%s%d"), (i>0)?",":"", template_gp.io[i]); #else if (!FlashPin(i)) { WSContentSend_P(PSTR("%s%d"), (i>0)?",":"", template_gp.io[i]); } -#endif // CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 +#endif // CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C6 } WSContentSend_P(PSTR("}1%d}1%d"), flag, Settings->user_template_base); // FLAG: 1 BASE: 17 WSContentEnd(); @@ -2192,7 +2192,7 @@ void HandleTemplateConfiguration(void) { "
")); WSContentSend_P(HTTP_TABLE100); // "" for (uint32_t i = 0; i < MAX_GPIO_PIN; i++) { -#if CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 +#if CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C6 // ESP32C2/C3/C6 all gpios are in the template, flash are hidden bool hidden = FlashPin(i); WSContentSend_P(PSTR(""), @@ -2205,7 +2205,7 @@ void HandleTemplateConfiguration(void) { RedPin(i) ? WebColor(COL_TEXT_WARNING) : WebColor(COL_TEXT), i, (0==i) ? PSTR(" style='width:146px'") : "", i, i); WSContentSend_P(PSTR(""), i); } -#endif // CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 +#endif // CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C6 } WSContentSend_P(PSTR("
" D_GPIO "%d
")); @@ -2270,7 +2270,7 @@ void TemplateSaveSettings(void) { j++; #endif // ESP8266 #ifdef ESP32 -#if CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C6 +#if CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C6 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 diff --git a/tasmota/tasmota_xdrv_driver/xdrv_79_esp32_ble.ino b/tasmota/tasmota_xdrv_driver/xdrv_79_esp32_ble.ino index 4fd0c8211..19d8f2e4f 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_79_esp32_ble.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_79_esp32_ble.ino @@ -32,7 +32,7 @@ #endif #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_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 #ifdef USE_BLE_ESP32 /* diff --git a/tasmota/tasmota_xdrv_driver/xdrv_85_esp32_ble_eq3_trv.ino b/tasmota/tasmota_xdrv_driver/xdrv_85_esp32_ble_eq3_trv.ino index 81d455b04..8c7facdd2 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_85_esp32_ble_eq3_trv.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_85_esp32_ble_eq3_trv.ino @@ -128,7 +128,7 @@ print("".join(pin)) #define USE_EQ3_ESP32 #endif -#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C3 || 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 #ifdef USE_EQ3_ESP32 #ifdef ESP32 // ESP32 only. Use define USE_HM10 for ESP8266 support #ifdef USE_BLE_ESP32 diff --git a/tasmota/tasmota_xdrv_driver/xdrv_91_esp32_twai.ino b/tasmota/tasmota_xdrv_driver/xdrv_91_esp32_twai.ino index 57ad13870..8bd730c3d 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_91_esp32_twai.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_91_esp32_twai.ino @@ -7,6 +7,7 @@ */ #ifdef ESP32 +#ifndef ESP32C5 // todo: remove when ESP32C5 support is added #ifdef USE_ESP32_TWAI #if SOC_TWAI_SUPPORTED /*********************************************************************************************\ @@ -442,4 +443,5 @@ bool Xdrv91(uint32_t function) { #endif // SOC_TWAI_SUPPORTED #endif // USE_ESP32_TWAI +#endif // ESP32C5 #endif // ESP32 \ No newline at end of file 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 2e886af91..4db5ae260 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_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 #ifdef USE_BLE_ESP32 #define XSNS_52 52 diff --git a/tasmota/tasmota_xsns_sensor/xsns_62_esp32_mi.ino b/tasmota/tasmota_xsns_sensor/xsns_62_esp32_mi.ino index 6abd6b470..218cacbdd 100644 --- a/tasmota/tasmota_xsns_sensor/xsns_62_esp32_mi.ino +++ b/tasmota/tasmota_xsns_sensor/xsns_62_esp32_mi.ino @@ -50,7 +50,7 @@ */ #ifndef USE_BLE_ESP32 #ifdef ESP32 // ESP32 only. Use define USE_HM10 for ESP8266 support -#if defined CONFIG_IDF_TARGET_ESP32 || defined CONFIG_IDF_TARGET_ESP32C3 || defined CONFIG_IDF_TARGET_ESP32C2 || defined CONFIG_IDF_TARGET_ESP32C6 || defined CONFIG_IDF_TARGET_ESP32S3 +#if defined CONFIG_IDF_TARGET_ESP32 || defined CONFIG_IDF_TARGET_ESP32C3 || defined CONFIG_IDF_TARGET_ESP32C2 || defined CONFIG_IDF_TARGET_ESP32C5 || defined CONFIG_IDF_TARGET_ESP32C6 || defined CONFIG_IDF_TARGET_ESP32S3 #ifdef USE_MI_ESP32 @@ -1316,7 +1316,7 @@ bool MI32StartConnectionTask(){ } void MI32ConnectionTask(void *pvParameters){ -#if !defined(CONFIG_IDF_TARGET_ESP32C3) || !defined(CONFIG_IDF_TARGET_ESP32C6) //needs more testing ... +#if !defined(CONFIG_IDF_TARGET_ESP32C3) || !defined(CONFIG_IDF_TARGET_ESP32C5) || !defined(CONFIG_IDF_TARGET_ESP32C6) //needs more testing ... // NimBLEDevice::setOwnAddrType(BLE_OWN_ADDR_RANDOM,false); //seems to be important for i.e. xbox controller, hopefully not breaking other things #endif //CONFIG_IDF_TARGET_ESP32C3 MI32.conCtx->error = MI32_CONN_NO_ERROR; 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 7690af927..99c4fb36f 100644 --- a/tasmota/tasmota_xsns_sensor/xsns_62_esp32_mi_ble.ino +++ b/tasmota/tasmota_xsns_sensor/xsns_62_esp32_mi_ble.ino @@ -82,7 +82,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_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 #ifdef USE_MI_ESP32