diff --git a/.gitignore b/.gitignore index 78c2cfe2f..dcc81a15d 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,8 @@ data unpacked_fs unpacked_boards tasmota/user_config_override.h +variants +variants3 build build_output/* firmware.map diff --git a/boards/esp32-fix.json b/boards/esp32-fix.json index a2a9bed87..8287019b8 100644 --- a/boards/esp32-fix.json +++ b/boards/esp32-fix.json @@ -31,7 +31,7 @@ "flash_extra_images": [ [ "0x10000", - "variants/tasmota/tasmota32-safeboot.bin" + "tasmota32-safeboot.bin" ] ] }, diff --git a/boards/esp32.json b/boards/esp32.json index 1e476569c..4dd2a3602 100644 --- a/boards/esp32.json +++ b/boards/esp32.json @@ -31,7 +31,7 @@ "flash_extra_images": [ [ "0x10000", - "variants/tasmota/tasmota32-safeboot.bin" + "tasmota32-safeboot.bin" ] ] }, diff --git a/boards/esp32_solo1.json b/boards/esp32_solo1.json index 3bb85fe05..f3d9913b0 100644 --- a/boards/esp32_solo1.json +++ b/boards/esp32_solo1.json @@ -31,7 +31,7 @@ "flash_extra_images": [ [ "0x10000", - "variants/tasmota/tasmota32solo1-safeboot.bin" + "tasmota32solo1-safeboot.bin" ] ] }, diff --git a/boards/esp32c2.json b/boards/esp32c2.json index 563a3357c..c61238f2f 100644 --- a/boards/esp32c2.json +++ b/boards/esp32c2.json @@ -29,7 +29,7 @@ "flash_extra_images": [ [ "0x10000", - "variants/tasmota/tasmota32c2-safeboot.bin" + "tasmota32c2-safeboot.bin" ] ] }, diff --git a/boards/esp32c2_2M.json b/boards/esp32c2_2M.json index 36f16ffe3..00414399a 100644 --- a/boards/esp32c2_2M.json +++ b/boards/esp32c2_2M.json @@ -29,7 +29,7 @@ "flash_extra_images": [ [ "0x10000", - "variants/tasmota/tasmota32c2-safeboot.bin" + "tasmota32c2-safeboot.bin" ] ] }, diff --git a/boards/esp32c3.json b/boards/esp32c3.json index b7f74c3e5..2bb2f7660 100644 --- a/boards/esp32c3.json +++ b/boards/esp32c3.json @@ -29,7 +29,7 @@ "flash_extra_images": [ [ "0x10000", - "variants/tasmota/tasmota32c3-safeboot.bin" + "tasmota32c3-safeboot.bin" ] ] }, diff --git a/boards/esp32c3cdc.json b/boards/esp32c3cdc.json index 3d280a73b..711225bf6 100644 --- a/boards/esp32c3cdc.json +++ b/boards/esp32c3cdc.json @@ -29,7 +29,7 @@ "flash_extra_images": [ [ "0x10000", - "variants/tasmota/tasmota32c3cdc-safeboot.bin" + "tasmota32c3cdc-safeboot.bin" ] ] }, diff --git a/boards/esp32c6.json b/boards/esp32c6.json index 57dd9b8f4..76e7620db 100644 --- a/boards/esp32c6.json +++ b/boards/esp32c6.json @@ -29,7 +29,7 @@ "flash_extra_images": [ [ "0x10000", - "variants/tasmota/tasmota32c6-safeboot.bin" + "tasmota32c6-safeboot.bin" ] ] }, diff --git a/boards/esp32c6cdc.json b/boards/esp32c6cdc.json index 17932b7a8..62147804a 100644 --- a/boards/esp32c6cdc.json +++ b/boards/esp32c6cdc.json @@ -29,7 +29,7 @@ "flash_extra_images": [ [ "0x10000", - "variants/tasmota/tasmota32c6cdc-safeboot.bin" + "tasmota32c6cdc-safeboot.bin" ] ] }, diff --git a/boards/esp32s2.json b/boards/esp32s2.json index d13f2a855..aa9efca8b 100644 --- a/boards/esp32s2.json +++ b/boards/esp32s2.json @@ -28,7 +28,7 @@ "flash_extra_images": [ [ "0x10000", - "variants/tasmota/tasmota32s2-safeboot.bin" + "tasmota32s2-safeboot.bin" ] ] }, diff --git a/boards/esp32s2cdc.json b/boards/esp32s2cdc.json index bdd230d5c..fe5662174 100644 --- a/boards/esp32s2cdc.json +++ b/boards/esp32s2cdc.json @@ -28,7 +28,7 @@ "flash_extra_images": [ [ "0x10000", - "variants/tasmota/tasmota32s2cdc-safeboot.bin" + "tasmota32s2cdc-safeboot.bin" ] ] }, diff --git a/boards/esp32s3-qio_opi.json b/boards/esp32s3-qio_opi.json index 498534e61..4f2a06c47 100644 --- a/boards/esp32s3-qio_opi.json +++ b/boards/esp32s3-qio_opi.json @@ -31,7 +31,7 @@ "flash_extra_images": [ [ "0x10000", - "variants/tasmota/tasmota32s3-safeboot.bin" + "tasmota32s3-safeboot.bin" ] ] }, diff --git a/boards/esp32s3-qio_qspi.json b/boards/esp32s3-qio_qspi.json index cdc6d70ca..42b20a4bc 100644 --- a/boards/esp32s3-qio_qspi.json +++ b/boards/esp32s3-qio_qspi.json @@ -31,7 +31,7 @@ "flash_extra_images": [ [ "0x10000", - "variants/tasmota/tasmota32s3-safeboot.bin" + "tasmota32s3-safeboot.bin" ] ] }, diff --git a/boards/esp32s3cdc-qio_opi.json b/boards/esp32s3cdc-qio_opi.json index 67dae1a6e..d7650b42f 100644 --- a/boards/esp32s3cdc-qio_opi.json +++ b/boards/esp32s3cdc-qio_opi.json @@ -41,7 +41,7 @@ "flash_extra_images": [ [ "0x10000", - "variants/tasmota/tasmota32s3cdc-safeboot.bin" + "tasmota32s3cdc-safeboot.bin" ] ] }, diff --git a/boards/esp32s3cdc-qio_qspi.json b/boards/esp32s3cdc-qio_qspi.json index f37a47bb5..77c89f9aa 100644 --- a/boards/esp32s3cdc-qio_qspi.json +++ b/boards/esp32s3cdc-qio_qspi.json @@ -41,7 +41,7 @@ "flash_extra_images": [ [ "0x10000", - "variants/tasmota/tasmota32s3cdc-safeboot.bin" + "tasmota32s3cdc-safeboot.bin" ] ] }, diff --git a/pio-tools/post_esp32.py b/pio-tools/post_esp32.py index 0d1dff34e..8cbc2809f 100644 --- a/pio-tools/post_esp32.py +++ b/pio-tools/post_esp32.py @@ -16,7 +16,7 @@ # - 0x1000 | ~\.platformio\packages\framework-arduinoespressif32\tools\sdk\esp32\bin\bootloader_dout_40m.bin # - 0x8000 | ~\Tasmota\.pio\build\\partitions.bin # - 0xe000 | ~\.platformio\packages\framework-arduinoespressif32\tools\partitions\boot_app0.bin -# - 0x10000 | ~\.platformio/packages/framework-arduinoespressif32/variants/tasmota/\-safeboot.bin +# - 0x10000 | ~\Tasmota\/-safeboot.bin # - 0xe0000 | ~\Tasmota\.pio\build\/firmware.bin # - 0x3b0000| ~\Tasmota\.pio\build\/littlefs.bin @@ -37,6 +37,13 @@ from SCons.Script import COMMAND_LINE_TARGETS sys.path.append(join(platform.get_package_dir("tool-esptoolpy"))) import esptool +variants_dir = env.BoardConfig().get("build.variants_dir", "") +variant = env.BoardConfig().get("build.variant", "") +sections = env.subst(env.get("FLASH_EXTRA_IMAGES")) +chip = env.get("BOARD_MCU") +mcu_build_variant = env.BoardConfig().get("build.variant", "").lower() + +# Copy safeboots firmwares in place when running in Github github_actions = os.getenv('GITHUB_ACTIONS') extra_flags = ''.join([element.replace("-D", " ") for element in env.BoardConfig().get("build.extra_flags", "")]) build_flags = ''.join([element.replace("-D", " ") for element in env.GetProjectOption("build_flags")]) @@ -45,16 +52,31 @@ if "CORE32SOLO1" in extra_flags or "FRAMEWORK_ARDUINO_SOLO1" in build_flags: FRAMEWORK_DIR = platform.get_package_dir("framework-arduino-solo1") if github_actions and os.path.exists("./firmware/firmware"): shutil.copytree("./firmware/firmware", "/home/runner/.platformio/packages/framework-arduino-solo1/variants/tasmota") + if variants_dir: + shutil.copytree("./firmware/firmware", variants_dir, dirs_exist_ok=True) elif "CORE32ITEAD" in extra_flags or "FRAMEWORK_ARDUINO_ITEAD" in build_flags: FRAMEWORK_DIR = platform.get_package_dir("framework-arduino-ITEAD") if github_actions and os.path.exists("./firmware/firmware"): shutil.copytree("./firmware/firmware", "/home/runner/.platformio/packages/framework-arduino-ITEAD/variants/tasmota") + if variants_dir: + shutil.copytree("./firmware/firmware", variants_dir, dirs_exist_ok=True) else: FRAMEWORK_DIR = platform.get_package_dir("framework-arduinoespressif32") if github_actions and os.path.exists("./firmware/firmware"): shutil.copytree("./firmware/firmware", "/home/runner/.platformio/packages/framework-arduinoespressif32/variants/tasmota") + if variants_dir: + shutil.copytree("./firmware/firmware", variants_dir, dirs_exist_ok=True) -variants_dir = join(FRAMEWORK_DIR, "variants", "tasmota") +# Copy pins_arduino.h to variants folder +if variants_dir: + mcu_build_variant_path = join(FRAMEWORK_DIR, "variants", mcu_build_variant, "pins_arduino.h") + custom_variant_build = join(env.subst("$PROJECT_DIR"), variants_dir , mcu_build_variant, "pins_arduino.h") + os.makedirs(join(env.subst("$PROJECT_DIR"), variants_dir , mcu_build_variant), exist_ok=True) + shutil.copy(mcu_build_variant_path, custom_variant_build) + +if not variants_dir: + variants_dir = join(FRAMEWORK_DIR, "variants", "tasmota") + env.BoardConfig().update("build.variants_dir", variants_dir) def esp32_detect_flashsize(): uploader = env.subst("$UPLOADER") @@ -195,9 +217,7 @@ def esp32_create_combined_bin(source, target, env): new_file_name = env.subst("$BUILD_DIR/${PROGNAME}.factory.bin") - sections = env.subst(env.get("FLASH_EXTRA_IMAGES")) firmware_name = env.subst("$BUILD_DIR/${PROGNAME}.bin") - chip = env.get("BOARD_MCU") tasmota_platform = esp32_create_chip_string(chip) if "-DUSE_USB_CDC_CONSOLE" in env.BoardConfig().get("build.extra_flags") and "cdc" not in tasmota_platform: @@ -274,8 +294,8 @@ def esp32_create_combined_bin(source, target, env): ) print("Will use custom upload command for flashing operation to add file system defined for this build target.") - #print('Using esptool.py arguments: %s' % ' '.join(cmd)) if("safeboot" not in firmware_name): + #print('Using esptool.py arguments: %s' % ' '.join(cmd)) esptool.main(cmd) diff --git a/platformio.ini b/platformio.ini index 5f55fe7f2..f45cd00f5 100644 --- a/platformio.ini +++ b/platformio.ini @@ -32,6 +32,7 @@ platform_packages = ${core.platform_packages} framework = arduino board = esp8266_1M board_build.filesystem = littlefs +board_build.variants_dir = variants/tasmota custom_unpack_dir = unpacked_littlefs build_unflags = ${core.build_unflags} build_flags = ${core.build_flags} diff --git a/platformio_tasmota32.ini b/platformio_tasmota32.ini index c49c5e9a7..d1ee861fa 100644 --- a/platformio_tasmota32.ini +++ b/platformio_tasmota32.ini @@ -78,7 +78,7 @@ lib_ignore = ${esp32_defaults.lib_ignore} ccronexpr [core32] -platform = https://github.com/tasmota/platform-espressif32/releases/download/2023.10.05/platform-espressif32.zip +platform = https://github.com/tasmota/platform-espressif32/releases/download/2023.10.06/platform-espressif32.zip platform_packages = build_unflags = ${esp32_defaults.build_unflags} build_flags = ${esp32_defaults.build_flags} diff --git a/platformio_tasmota_core3_env_sample.ini b/platformio_tasmota_core3_env_sample.ini index 8c3bf2c96..7c8a055e8 100644 --- a/platformio_tasmota_core3_env_sample.ini +++ b/platformio_tasmota_core3_env_sample.ini @@ -22,7 +22,7 @@ ; tasmota32c6cdc-safeboot [core32_30] -platform = https://github.com/tasmota/platform-espressif32/releases/download/2023.10.11/platform-espressif32.zip +platform = https://github.com/tasmota/platform-espressif32/releases/download/2023.10.12/platform-espressif32.zip platform_packages = build_unflags = ${core32.build_unflags} @@ -50,6 +50,7 @@ framework = ${common.framework} platform = ${core32_30.platform} platform_packages = ${core32_30.platform_packages} board_build.filesystem = ${common.board_build.filesystem} +board_build.variants_dir = variants/tasmota_ard3 custom_unpack_dir = ${common.custom_unpack_dir} board = esp32 monitor_speed = 115200 diff --git a/platformio_tasmota_env32.ini b/platformio_tasmota_env32.ini index bea48c5a6..5b62e0bc6 100644 --- a/platformio_tasmota_env32.ini +++ b/platformio_tasmota_env32.ini @@ -4,6 +4,7 @@ platform = ${core32.platform} platform_packages = ${core32.platform_packages} board_build.filesystem = ${common.board_build.filesystem} custom_unpack_dir = ${common.custom_unpack_dir} +board_build.variants_dir = ${common.board_build.variants_dir} board = esp32 monitor_speed = ${common.monitor_speed} monitor_echo = ${common.monitor_echo} diff --git a/tasmota/tasmota.ino b/tasmota/tasmota.ino index bfd026f78..fd980bef8 100644 --- a/tasmota/tasmota.ino +++ b/tasmota/tasmota.ino @@ -223,7 +223,7 @@ bool tasconsole_serial = false; #if ARDUINO_USB_MODE //#warning **** TasConsole ARDUINO_USB_MODE **** -TASCONSOLE TasConsole{USBSerial}; // ESP32C3/C6/S3 embedded USB using JTAG interface +TASCONSOLE TasConsole{HWCDCSerial}; // ESP32C3/C6/S3 embedded USB using JTAG interface //#warning **** TasConsole uses HWCDC **** #else // No ARDUINO_USB_MODE #include "USB.h"