diff --git a/boards/esp32c2.json b/boards/esp32c2.json new file mode 100644 index 000000000..563a3357c --- /dev/null +++ b/boards/esp32c2.json @@ -0,0 +1,44 @@ +{ + "build": { + "arduino":{ + "ldscript": "esp32c2_out.ld" + }, + "core": "esp32", + "extra_flags": "-DESP32_4M -DESP32C2", + "f_cpu": "120000000L", + "f_flash": "60000000L", + "flash_mode": "dio", + "mcu": "esp32c2", + "variant": "esp32c2", + "partitions": "partitions/esp32_partition_app2880k_fs320k.csv" + }, + "connectivity": [ + "wifi", + "bluetooth" + ], + "debug": { + "openocd_target": "esp32c2.cfg" + }, + "frameworks": [ + "arduino", + "espidf" + ], + "name": "Espressif Generic ESP32-C2 = 4M Flash", + "upload": { + "arduino": { + "flash_extra_images": [ + [ + "0x10000", + "variants/tasmota/tasmota32c2-safeboot.bin" + ] + ] + }, + "flash_size": "4MB", + "maximum_ram_size": 278528, + "maximum_size": 4194304, + "require_upload_port": true, + "speed": 460800 + }, + "url": "https://docs.espressif.com/projects/espressif-esp-dev-kits/en/latest/esp32c6/esp32-c6-devkitc-1/index.html", + "vendor": "Espressif" + } diff --git a/boards/esp32c2_2M.json b/boards/esp32c2_2M.json new file mode 100644 index 000000000..36f16ffe3 --- /dev/null +++ b/boards/esp32c2_2M.json @@ -0,0 +1,44 @@ +{ + "build": { + "arduino":{ + "ldscript": "esp32c2_out.ld" + }, + "core": "esp32", + "extra_flags": "-DESP32_2M -DESP32C2", + "f_cpu": "120000000L", + "f_flash": "60000000L", + "flash_mode": "dio", + "mcu": "esp32c2", + "variant": "esp32c2", + "partitions": "partitions/esp32_partition_app1245k_fs64k.csv" + }, + "connectivity": [ + "wifi", + "bluetooth" + ], + "debug": { + "openocd_target": "esp32c2.cfg" + }, + "frameworks": [ + "arduino", + "espidf" + ], + "name": "Espressif Generic ESP32-C2 = 2M Flash, Tasmota 1245kB Code/OTA, 64k FS", + "upload": { + "arduino": { + "flash_extra_images": [ + [ + "0x10000", + "variants/tasmota/tasmota32c2-safeboot.bin" + ] + ] + }, + "flash_size": "2MB", + "maximum_ram_size": 278528, + "maximum_size": 2097152, + "require_upload_port": true, + "speed": 460800 + }, + "url": "https://docs.espressif.com/projects/espressif-esp-dev-kits/en/latest/esp32c6/esp32-c6-devkitc-1/index.html", + "vendor": "Espressif" + } diff --git a/boards/esp32c6.json b/boards/esp32c6.json index 919bcfdfe..57dd9b8f4 100644 --- a/boards/esp32c6.json +++ b/boards/esp32c6.json @@ -7,7 +7,7 @@ "extra_flags": "-DESP32_4M -DESP32C6", "f_cpu": "160000000L", "f_flash": "80000000L", - "flash_mode": "dio", + "flash_mode": "qio", "mcu": "esp32c6", "variant": "esp32c6", "partitions": "partitions/esp32_partition_app2880k_fs320k.csv" diff --git a/boards/esp32c6cdc.json b/boards/esp32c6cdc.json new file mode 100644 index 000000000..17932b7a8 --- /dev/null +++ b/boards/esp32c6cdc.json @@ -0,0 +1,45 @@ +{ + "build": { + "arduino":{ + "ldscript": "esp32c6_out.ld" + }, + "core": "esp32", + "extra_flags": "-DARDUINO_USB_MODE=1 -DESP32_4M -DESP32C6 -DUSE_USB_CDC_CONSOLE", + "f_cpu": "160000000L", + "f_flash": "80000000L", + "flash_mode": "qio", + "mcu": "esp32c6", + "variant": "esp32c6", + "partitions": "partitions/esp32_partition_app2880k_fs320k.csv" + }, + "connectivity": [ + "wifi", + "bluetooth" + ], + "debug": { + "openocd_target": "esp32c6.cfg" + }, + "frameworks": [ + "arduino", + "espidf" + ], + "name": "Espressif Generic ESP32-C6 >= 4M Flash, Tasmota 2880k Code/OTA, 320k FS", + "upload": { + "arduino": { + "flash_extra_images": [ + [ + "0x10000", + "variants/tasmota/tasmota32c6cdc-safeboot.bin" + ] + ] + }, + "flash_size": "4MB", + "maximum_ram_size": 327680, + "maximum_size": 4194304, + "require_upload_port": true, + "before_reset": "usb_reset", + "speed": 460800 + }, + "url": "https://docs.espressif.com/projects/espressif-esp-dev-kits/en/latest/esp32c6/esp32-c6-devkitc-1/index.html", + "vendor": "Espressif" + } diff --git a/include/esp32x_fixes.h b/include/esp32x_fixes.h index a9f963d42..13860477a 100644 --- a/include/esp32x_fixes.h +++ b/include/esp32x_fixes.h @@ -68,10 +68,28 @@ #define SPI_HOST SPI1_HOST #define HSPI_HOST SPI2_HOST #define VSPI_HOST SPI2_HOST /* No SPI3_host on C3 */ +#if ESP_IDF_VERSION_MAJOR < 5 // fix a bug in esp-idf 4.4 for esp32c3 #ifndef REG_SPI_BASE #define REG_SPI_BASE(i) (DR_REG_SPI1_BASE + (((i)>1) ? (((i)* 0x1000) + 0x20000) : (((~(i)) & 1)* 0x1000 ))) // SPI_MOSI_DLEN_REG is not defined anymore in esp32c3, instead use SPI_MS_DLEN_REG #define SPI_MOSI_DLEN_REG(x) SPI_MS_DLEN_REG(x) #endif // REG_SPI_BASE +#endif //ESP_IDF_VERSION_MAJOR < 5 + +#elif CONFIG_IDF_TARGET_ESP32C2 || CONFIG_IDF_TARGET_ESP32C6 +#define SPI_HOST SPI1_HOST +#define HSPI_HOST SPI1_HOST /* No SPI2_host on C2/C6 */ +#define VSPI_HOST SPI1_HOST /* No SPI3_host on C2/C6 */ +#define VSPI SPI +// #if ESP_IDF_VERSION_MAJOR < 5 +// // fix a bug in esp-idf 4.4 for esp32c3 +// #ifndef REG_SPI_BASE +// #define REG_SPI_BASE(i) (DR_REG_SPI1_BASE + (((i)>1) ? (((i)* 0x1000) + 0x20000) : (((~(i)) & 1)* 0x1000 ))) +// // SPI_MOSI_DLEN_REG is not defined anymore in esp32c3, instead use SPI_MS_DLEN_REG +#define SPI_MOSI_DLEN_REG(x) SPI_MS_DLEN_REG(x) +// #endif // REG_SPI_BASE +// #endif //ESP_IDF_VERSION_MAJOR < 5 + + #endif // TARGET diff --git a/partitions/esp32_partition_app1245k_fs64k.csv b/partitions/esp32_partition_app1245k_fs64k.csv new file mode 100644 index 000000000..587d7ccb0 --- /dev/null +++ b/partitions/esp32_partition_app1245k_fs64k.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, 0xB0000, +app0, app, ota_0, 0xC0000, 0x130000, +spiffs, data, spiffs, 0x1f0000,0x10000, diff --git a/pio-tools/override_copy.py b/pio-tools/override_copy.py index 7a45512a8..a52c62c85 100644 --- a/pio-tools/override_copy.py +++ b/pio-tools/override_copy.py @@ -25,3 +25,9 @@ if os.path.isfile("platformio_tasmota_cenv.ini"): print ("*** use provided platformio_tasmota_cenv.ini as planned ***") else: shutil.copy("platformio_tasmota_cenv_sample.ini", "platformio_tasmota_cenv.ini") + +# copy platformio_tasmota_core3_env_sample.ini to platformio_tasmota_core3_env.ini +if os.path.isfile("platformio_tasmota_core3_env.ini"): + print ("*** use provided platformio_tasmota_core3_env.ini as planned ***") +else: + shutil.copy("platformio_tasmota_core3_env_sample.ini", "platformio_tasmota_core3_env.ini") \ No newline at end of file diff --git a/platformio.ini b/platformio.ini index 83d80aa24..bd648897b 100644 --- a/platformio.ini +++ b/platformio.ini @@ -24,6 +24,7 @@ extra_configs = platformio_tasmota32.ini platformio_tasmota_env32.ini platformio_override.ini platformio_tasmota_cenv.ini + platformio_tasmota_core3_env.ini [common] platform = ${core.platform} diff --git a/platformio_tasmota_core3_env_sample.ini b/platformio_tasmota_core3_env_sample.ini new file mode 100644 index 000000000..ada11afac --- /dev/null +++ b/platformio_tasmota_core3_env_sample.ini @@ -0,0 +1,259 @@ +[platformio] +; *** Build/upload environments for ESP32 Arduino Core 3.0 + +; *** Uncomment the line below and one or more env to select version(s) +;default_envs = +; tasmota32-arduino30 +; tasmota32-odroid30 +; tasmota32s2-arduino30 +; tasmota32s3-arduino30 +; tasmota32c2-arduino30 +; tasmota32c3-arduino30 +; tasmota32c3cdc-arduino30 +; tasmota32c6-arduino30 +; tasmota32c6cdc-arduino30 +; tasmota32-safeboot +; tasmota32s2-safeboot +; tasmota32s3-safeboot +; tasmota32c2-safeboot +; tasmota32c3-safeboot +; tasmota32c3cdc-safeboot +; tasmota32c6-safeboot +; tasmota32c6cdc-safeboot + +[core32_30] +platform = https://github.com/Jason2866/platform-espressif32.git#Arduino/IDF5 +platform_packages = framework-arduinoespressif32 @ https://github.com/Jason2866/esp32-arduino-lib-builder/releases/download/1511/framework-arduinoespressif32-release_v5.1-90b05eff62.zip +build_unflags = ${core32.build_unflags} +build_flags = ${core32.build_flags} + +[core32_30_flags] +build_unflags = ${core32_30.build_unflags} + -DUSE_IPV6 +build_flags = ${core32_30.build_flags} +lib_extra_dirs = lib/lib_ssl, lib/lib_basic, lib/lib_i2c, lib/lib_div, lib/lib_display, lib/lib_rf, lib/libesp32, lib/libesp32_div, lib/libesp32_lvgl +lib_ignore = + HTTPUpdateServer + USB + SPIFFS + ESP32 Async UDP + NetBIOS + Preferences + BluetoothSerial + ArduinoOTA + ESP Mail Client + IRremoteESP8266 + ESP8266Audio + ESP8266SAM + ESP32-HomeKit + NimBLE-Arduino + +[env:arduino30] +framework = ${common.framework} +platform = ${core32_30.platform} +platform_packages = ${core32_30.platform_packages} +board_build.filesystem = ${common.board_build.filesystem} +custom_unpack_dir = ${common.custom_unpack_dir} +board = esp32 +monitor_speed = 115200 +upload_resetmethod = ${common.upload_resetmethod} +extra_scripts = ${esp32_defaults.extra_scripts} +build_unflags = ${core32_30_flags.build_unflags} +build_flags = ${core32_30_flags.build_flags} +lib_ldf_mode = ${common.lib_ldf_mode} +lib_compat_mode = ${common.lib_compat_mode} +lib_extra_dirs = ${core32_30_flags.lib_extra_dirs} +lib_ignore = ${core32_30_flags.lib_ignore} + + + +[env:tasmota32-arduino30] +extends = env:arduino30 +board = esp32 +build_unflags = ${env:arduino30.build_unflags} +build_flags = ${env:arduino30.build_flags} + -DFIRMWARE_ARDUINO30 + -DUSE_MI_HOMEKIT=0 ; 1 to enable; 0 to disable + -DUSE_MI_ESP32 +monitor_filters = esp32_exception_decoder +lib_ignore = ${env:arduino30.lib_ignore} + +[env:tasmota32-odroid30] +extends = env:arduino30 +board = esp32-fix +board_build.f_cpu = 240000000L +upload_port = /dev/cu.SLAB_USBtoUART +build_unflags = ${env:arduino30.build_unflags} +build_flags = ${env:arduino30.build_flags} + -DFIRMWARE_ARDUINO30 +monitor_filters = esp32_exception_decoder +lib_ignore = ${env:arduino30.lib_ignore} + +[env:tasmota32s2-arduino30] +extends = env:arduino30 +board = esp32s2 +build_unflags = ${env:arduino30.build_unflags} +build_flags = ${env:arduino30.build_flags} + -DFIRMWARE_ARDUINO30 +monitor_filters = esp32_exception_decoder +lib_ignore = ${env:arduino30.lib_ignore} + +[env:tasmota32s3-arduino30] +extends = env:arduino30 +board = esp32s3-qio_qspi +build_unflags = ${env:arduino30.build_unflags} +build_flags = ${env:arduino30.build_flags} + -DFIRMWARE_ARDUINO30 + -DUSE_MI_HOMEKIT=0 ; 1 to enable; 0 to disable + -DUSE_MI_ESP32 +monitor_filters = esp32_exception_decoder +lib_extra_dirs = lib/lib_ssl, lib/lib_basic, lib/lib_i2c, lib/lib_div, lib/lib_rf, lib/libesp32, lib/libesp32_div +lib_ignore = ${env:arduino30.lib_ignore} + universal display Library + +[env:tasmota32c2-arduino30] +extends = env:arduino30 +board = esp32c2 +build_unflags = ${env:arduino30.build_unflags} + -flto + -mtarget-align +build_flags = ${env:arduino30.build_flags} + -DFIRMWARE_ARDUINO30 + -DNO_NEOPIXEL + -DUSE_MI_HOMEKIT=0 ; 1 to enable; 0 to disable + -DUSE_MI_ESP32 + -fno-lto + -DOTA_URL='""' +monitor_filters = esp32_exception_decoder +lib_ignore = ${env:arduino30.lib_ignore} + NeoPixelBus + +[env:tasmota32c3-arduino30] +extends = env:arduino30 +board = esp32c3 +build_unflags = ${env:arduino30.build_unflags} + -flto + -mtarget-align +build_flags = ${env:arduino30.build_flags} + -DFIRMWARE_ARDUINO30 + -DUSE_MI_HOMEKIT=0 ; 1 to enable; 0 to disable + -DUSE_MI_ESP32 + -fno-lto +monitor_filters = esp32_exception_decoder +lib_ignore = ${env:arduino30.lib_ignore} + +[env:tasmota32c3cdc-arduino30] +extends = env:arduino30 +board = esp32c3cdc +build_unflags = ${env:arduino30.build_unflags} + -flto + -mtarget-align +build_flags = ${env:arduino30.build_flags} + -DFIRMWARE_ARDUINO30 + -fno-lto +monitor_filters = esp32_exception_decoder +lib_ignore = ${env:arduino30.lib_ignore} + +[env:tasmota32c6-arduino30] +extends = env:arduino30 +board = esp32c6 +build_unflags = ${env:arduino30.build_unflags} + -flto + -mtarget-align +build_flags = ${env:arduino30.build_flags} + -fno-lto + -DFIRMWARE_ARDUINO30 + -DUSE_MI_HOMEKIT=0 ; 1 to enable; 0 to disable + -DUSE_MI_ESP32 + -DOTA_URL='""' +monitor_filters = esp32_exception_decoder +lib_ignore = ${env:arduino30.lib_ignore} + +[env:tasmota32c6cdc-arduino30] +extends = env:arduino30 +board = esp32c6cdc +build_unflags = ${env:arduino30.build_unflags} + -flto + -mtarget-align +build_flags = ${env:arduino30.build_flags} + -fno-lto + -DFIRMWARE_ARDUINO30 + -DUSE_MI_HOMEKIT=0 ; 1 to enable; 0 to disable + -DUSE_MI_ESP32 + -DOTA_URL='""' +monitor_filters = esp32_exception_decoder +lib_ignore = ${env:arduino30.lib_ignore} + +[env:tasmota32-safeboot] +extends = env:tasmota32-arduino30 +build_unflags = ${env:tasmota32-arduino30.build_unflags} + -DFIRMWARE_ARDUINO30 +build_flags = ${env:tasmota32-arduino30.build_flags} + -DFIRMWARE_SAFEBOOT +lib_extra_dirs = lib/lib_ssl, lib/libesp32 +lib_ignore = ${safeboot_flags.lib_ignore} + +[env:tasmota32s2-safeboot] +extends = env:tasmota32s2-arduino30 +build_unflags = ${env:tasmota32s2-arduino30.build_unflags} + -DFIRMWARE_ARDUINO30 +build_flags = ${env:tasmota32s2-arduino30.build_flags} + -DFIRMWARE_SAFEBOOT +lib_extra_dirs = lib/lib_ssl, lib/libesp32 +lib_ignore = ${safeboot_flags.lib_ignore} + +[env:tasmota32s3-safeboot] +extends = env:tasmota32s3-arduino30 +build_unflags = ${env:tasmota32s3-arduino30.build_unflags} + -DFIRMWARE_ARDUINO30 +build_flags = ${env:tasmota32s3-arduino30.build_flags} + -DFIRMWARE_SAFEBOOT +lib_extra_dirs = lib/lib_ssl, lib/libesp32 +lib_ignore = ${safeboot_flags.lib_ignore} + +[env:tasmota32c2-safeboot] +extends = env:tasmota32c2-arduino30 +build_unflags = ${env:tasmota32c2-arduino30.build_unflags} + -DFIRMWARE_ARDUINO30 +build_flags = ${env:tasmota32c2-arduino30.build_flags} + -DFIRMWARE_SAFEBOOT +lib_extra_dirs = lib/lib_ssl, lib/libesp32 +lib_ignore = ${safeboot_flags.lib_ignore} + +[env:tasmota32c3-safeboot] +extends = env:tasmota32c3-arduino30 +build_unflags = ${env:tasmota32c3-arduino30.build_unflags} + -DFIRMWARE_ARDUINO30 +build_flags = ${env:tasmota32c3-arduino30.build_flags} + -DFIRMWARE_SAFEBOOT +lib_extra_dirs = lib/lib_ssl, lib/libesp32 +lib_ignore = ${safeboot_flags.lib_ignore} + +[env:tasmota32c3cdc-safeboot] +extends = env:tasmota32c3-arduino30 +board = esp32c3cdc +build_unflags = ${env:tasmota32c3-arduino30.build_unflags} + -DFIRMWARE_ARDUINO30 +build_flags = ${env:tasmota32c3-arduino30.build_flags} + -DFIRMWARE_SAFEBOOT +lib_extra_dirs = lib/lib_ssl, lib/libesp32 +lib_ignore = ${safeboot_flags.lib_ignore} + +[env:tasmota32c6-safeboot] +extends = env:tasmota32c6-arduino30 +build_unflags = ${env:tasmota32c6-arduino30.build_unflags} + -DFIRMWARE_ARDUINO30 +build_flags = ${env:tasmota32c6-arduino30.build_flags} + -DFIRMWARE_SAFEBOOT +lib_extra_dirs = lib/lib_ssl, lib/libesp32 +lib_ignore = ${safeboot_flags.lib_ignore} + +[env:tasmota32c6cdc-safeboot] +extends = env:tasmota32c6-arduino30 +board = esp32c6cdc +build_unflags = ${env:tasmota32c6-arduino30.build_unflags} + -DFIRMWARE_ARDUINO30 +build_flags = ${env:tasmota32c6-arduino30.build_flags} + -DFIRMWARE_SAFEBOOT +lib_extra_dirs = lib/lib_ssl, lib/libesp32 +lib_ignore = ${safeboot_flags.lib_ignore} \ No newline at end of file diff --git a/platformio_tasmota_env32.ini b/platformio_tasmota_env32.ini index fe74871af..d596e2f45 100644 --- a/platformio_tasmota_env32.ini +++ b/platformio_tasmota_env32.ini @@ -15,7 +15,6 @@ lib_compat_mode = ${common.lib_compat_mode} lib_extra_dirs = ${common.lib_extra_dirs} lib/libesp32 lib/libesp32_lvgl - lib/libesp32_eink lib/libesp32_audio lib_ignore = HTTPUpdateServer @@ -26,7 +25,7 @@ lib_ignore = ESP32 Azure IoT Arduino ESP32 Async UDP ESP32 BLE Arduino -; SimpleBLE + SimpleBLE NetBIOS ESP32 Preferences @@ -39,46 +38,6 @@ lib_ignore = ; tasmota/berry/modules/Partition_Manager.tapp custom_files_upload = no_files -[env:tasmota32-arduino30] -platform = https://github.com/Jason2866/platform-espressif32.git#Arduino/IDF5 -platform_packages = framework-arduinoespressif32 @ https://github.com/Jason2866/esp32-arduino-lib-builder/releases/download/1457/framework-arduinoespressif32-release_v5.1-69cdc81680.zip -extends = env:tasmota32_base -board = esp32 -build_unflags = ${env:tasmota32_base.build_unflags} - -DUSE_IPV6 -build_flags = ${env:tasmota32_base.build_flags} - -DFIRMWARE_ARDUINO30 - -DOTA_URL='""' -lib_extra_dirs = lib/lib_ssl, lib/libesp32 -lib_ignore = - ESP Mail Client - IRremoteESP8266 - NeoPixelBus - MFRC522 - universal display Library - ESP8266Audio - ESP8266SAM - -[env:tasmota32c6-safeboot] -platform = https://github.com/Jason2866/platform-espressif32.git#Arduino/IDF5 -platform_packages = framework-arduinoespressif32 @ https://github.com/Jason2866/esp32-arduino-lib-builder/releases/download/1457/framework-arduinoespressif32-release_v5.1-69cdc81680.zip -extends = env:tasmota32_base -board = esp32c6 -build_unflags = ${env:tasmota32_base.build_unflags} - -DUSE_IPV6 -build_flags = ${env:tasmota32_base.build_flags} - -DFIRMWARE_SAFEBOOT - -DOTA_URL='""' -lib_extra_dirs = lib/lib_ssl, lib/libesp32 -lib_ignore = - ESP Mail Client - IRremoteESP8266 - NeoPixelBus - MFRC522 - universal display Library - ESP8266Audio - ESP8266SAM - [env:tasmota32-safeboot] extends = env:tasmota32_base build_flags = ${env:tasmota32_base.build_flags}