From 5308cd201e3a3ee39133d599e050adb62db8fbdb Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 4 May 2025 17:16:56 +0200 Subject: [PATCH 1/5] Update platform.json --- platform.json | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/platform.json b/platform.json index eca066cb9..7e47654a7 100644 --- a/platform.json +++ b/platform.json @@ -57,30 +57,35 @@ "type": "toolchain", "optional": true, "owner": "pioarduino", + "package-version": "14.2.0+20241119", "version": "https://github.com/pioarduino/registry/releases/download/0.0.1/xtensa-esp-elf-14.2.0_20241119.zip" }, "toolchain-riscv32-esp": { "type": "toolchain", "optional": true, "owner": "pioarduino", + "package-version": "14.2.0+20241119", "version": "https://github.com/pioarduino/registry/releases/download/0.0.1/riscv32-esp-elf-14.2.0_20241119.zip" }, "toolchain-esp32ulp": { "type": "toolchain", "optional": true, "owner": "pioarduino", + "package-version": "2.38.0+20240113", "version": "https://github.com/pioarduino/registry/releases/download/0.0.1/esp32ulp-elf-2.38_20240113.zip" }, - "tool-xtensa-esp-elf-gdb": { + "tool-xtensa-esp-elf-gdb": { "type": "debugger", "optional": true, "owner": "pioarduino", + "package-version": "16.2.0+20250324", "version": "https://github.com/pioarduino/registry/releases/download/0.0.1/xtensa-esp-gdb-v16.2_20250324.zip" }, "tool-riscv32-esp-elf-gdb": { "type": "debugger", "optional": true, "owner": "pioarduino", + "package-version": "16.2.0+20250324", "version": "https://github.com/pioarduino/registry/releases/download/0.0.1/riscv32-esp-gdb-v16.2_20250324.zip" }, "tool-esptoolpy": { @@ -99,72 +104,91 @@ "type": "uploader", "optional": true, "owner": "pioarduino", + "package-version": "1.11.0", "version": "https://github.com/pioarduino/registry/releases/download/0.0.1/dfuutil-arduino-v1.11.0.zip" }, "tool-openocd-esp32": { "type": "debugger", "optional": true, "owner": "pioarduino", + "package-version": "2.1200.20250226", "version": "https://github.com/pioarduino/registry/releases/download/0.0.1/openocd-v0.12.0-esp32-20250226.zip" }, "tool-mklittlefs": { "type": "uploader", "optional": true, "owner": "pioarduino", + "package-version": "3.2.0", "version": "https://github.com/pioarduino/registry/releases/download/0.0.1/mklittlefs-3.2.0.zip" }, - "tool-mkfatfs": { + "tool-mklittlefs-4.0.0": { "type": "uploader", "optional": true, "owner": "pioarduino", - "version": "https://github.com/pioarduino/registry/releases/download/0.0.1/mkfatfs-v2.0.1.zip" + "package-version": "4.0.0", + "version": "https://github.com/pioarduino/registry/releases/download/0.0.1/mklittlefs-4.0.0.zip" }, "tool-mkspiffs": { "type": "uploader", "optional": true, "owner": "pioarduino", + "package-version": "2.230.0", "version": "https://github.com/pioarduino/registry/releases/download/0.0.1/mkspiffs-v2.230.0.zip" + }, + "tool-mkfatfs": { + "type": "uploader", + "optional": true, + "owner": "pioarduino", + "package-version": "2.0.1", + "version": "https://github.com/pioarduino/registry/releases/download/0.0.1/mkfatfs-v2.0.1.zip" }, "tool-cppcheck": { "type": "tool", "optional": true, "owner": "pioarduino", + "package-version": "2.11.0+230717", "version": "https://github.com/pioarduino/registry/releases/download/0.0.1/cppcheck-v2.11.0-230717.zip" }, "tool-clangtidy": { "type": "tool", "optional": true, "owner": "pioarduino", + "package-version": "18.1.1", "version": "https://github.com/pioarduino/registry/releases/download/0.0.1/clangtidy-v18.1.1.zip" }, "tool-pvs-studio": { "type": "tool", "optional": true, "owner": "pioarduino", - "version": "https://github.com/pioarduino/registry/releases/download/0.0.1/pvs-studio-v7.18.zip" + "package-version": "7.36.91321", + "version": "https://github.com/pioarduino/registry/releases/download/0.0.1/pvs-studio-v7.36.91321.zip" }, "tool-cmake": { "type": "tool", "optional": true, "owner": "pioarduino", + "package-version": "3.30.2", "version": "https://github.com/pioarduino/registry/releases/download/0.0.1/cmake-3.30.2.zip" }, "tool-esp-rom-elfs": { "type": "tool", "optional": true, "owner": "pioarduino", + "package-version": "2024.10.11", "version": "https://github.com/pioarduino/registry/releases/download/0.0.1/esp-rom-elfs-20241011.zip" }, "tool-ninja": { "type": "tool", "optional": true, "owner": "pioarduino", + "package-version": "1.10.2", "version": "https://github.com/pioarduino/registry/releases/download/0.0.1/ninja-1.10.2.zip" }, "tool-scons": { "type": "tool", "optional": true, "owner": "pioarduino", + "package-version": "4.40801.0", "version": "https://github.com/pioarduino/registry/releases/download/0.0.1/scons-4.8.1.zip" } } From cec728d052091893b023115d457d850f6bf8ce56 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 4 May 2025 17:20:32 +0200 Subject: [PATCH 2/5] Update platform.py --- platform.py | 65 +++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 56 insertions(+), 9 deletions(-) diff --git a/platform.py b/platform.py index ad350317f..fdca9b1c2 100644 --- a/platform.py +++ b/platform.py @@ -13,6 +13,7 @@ # limitations under the License. import os +import json import subprocess import sys import shutil @@ -44,7 +45,7 @@ def configure_default_packages(self, variables, targets): board_sdkconfig = variables.get("board_espidf.custom_sdkconfig", board_config.get("espidf.custom_sdkconfig", "")) frameworks = variables.get("pioframework", []) - def install_tool(TOOL): + def install_tool(TOOL, retry_count=0): self.packages[TOOL]["optional"] = False TOOL_PATH = os.path.join(ProjectConfig.get_instance().get("platformio", "packages_dir"), TOOL) TOOL_PACKAGE_PATH = os.path.join(TOOL_PATH, "package.json") @@ -80,13 +81,37 @@ def install_tool(TOOL): try: shutil.rmtree(TOOL_PATH) except Exception as e: - print(f"Error while removing the tool folder: {e}") + print(f"Error while removing the tool folder: {e}") pm.install(tl_path) # tool is already installed, just activate it if tl_flag and pio_flag and not json_flag: - self.packages[TOOL]["version"] = TOOL_PATH - self.packages[TOOL]["optional"] = False - + with open(TOOL_PACKAGE_PATH, "r") as file: + package_data = json.load(file) + # check installed tool version against listed in platforms.json + if "package-version" in self.packages[TOOL] \ + and "version" in package_data \ + and self.packages[TOOL]["package-version"] == package_data["version"]: + self.packages[TOOL]["version"] = TOOL_PATH + self.packages[TOOL]["optional"] = False + elif "package-version" not in self.packages[TOOL]: + # No version check needed, just use the installed tool + self.packages[TOOL]["version"] = TOOL_PATH + self.packages[TOOL]["optional"] = False + elif "version" not in package_data: + print(f"Warning: Cannot determine installed version for {TOOL}. Reinstalling...") + else: # Installed version does not match required version, deinstall existing and install needed + self.packages.pop(TOOL, None) + if os.path.exists(TOOL_PATH) and os.path.isdir(TOOL_PATH): + try: + shutil.rmtree(TOOL_PATH) + except Exception as e: + print(f"Error while removing the tool folder: {e}") + if retry_count >= 3: # Limit to 3 retries + print(f"Failed to install {TOOL} after multiple attempts. Please check your network connection and try again manually.") + return + print(f"Wrong version for {TOOL}. Installing needed version...") + install_tool(TOOL, retry_count + 1) + return # Installer only needed for setup, deactivate when installed @@ -130,7 +155,6 @@ def install_tool(TOOL): # Set mandatory toolchains for toolchain in toolchain_data["toolchains"]: install_tool(toolchain) - # Set ULP toolchain if applicable ulp_toolchain = toolchain_data.get("ulp_toolchain") if ulp_toolchain and os.path.isdir("ulp"): @@ -169,6 +193,13 @@ def install_tool(TOOL): if "buildfs" in targets: filesystem = variables.get("board_build.filesystem", "littlefs") if filesystem == "littlefs": + # ensure use of mklittlefs 3.2.0 + piopm_path = os.path.join(ProjectConfig.get_instance().get("platformio", "packages_dir"), "tool-mklittlefs", ".piopm") + if os.path.exists(piopm_path): + with open(piopm_path, "r") as file: + package_data = json.load(file) + if package_data['version'] == "4.0.0": + os.remove(piopm_path) install_tool("tool-mklittlefs") elif filesystem == "fatfs": install_tool("tool-mkfatfs") @@ -179,9 +210,25 @@ def install_tool(TOOL): filesystem = variables.get("board_build.filesystem", "littlefs") if filesystem == "littlefs": # Use Tasmota mklittlefs v4.0.0 to unpack, older version is incompatible - self.packages["tool-mklittlefs"]["version"] = "https://github.com/pioarduino/registry/releases/download/0.0.1/mklittlefs-4.0.0.zip" - self.packages["tool-mklittlefs"]["optional"] = False - install_tool("tool-mklittlefs") + # make sure mklittlefs 3.2.0 is installed + mklittlefs_dir = os.path.join(ProjectConfig.get_instance().get("platformio", "packages_dir"), "tool-mklittlefs") + if not os.path.exists(mklittlefs_dir): + install_tool("tool-mklittlefs") + if os.path.exists(os.path.join(mklittlefs_dir, "tools.json")): + install_tool("tool-mklittlefs") + mklittlefs400_dir = os.path.join(ProjectConfig.get_instance().get("platformio", "packages_dir"), "tool-mklittlefs-4.0.0") + if not os.path.exists(mklittlefs400_dir): + # install mklittlefs 4.0.0 + install_tool("tool-mklittlefs-4.0.0") + if os.path.exists(os.path.join(mklittlefs400_dir, "tools.json")): + install_tool("tool-mklittlefs-4.0.0") + # use mklittlefs 4.0.0 instead of 3.2.0 by copying over + if os.path.exists(mklittlefs400_dir): + shutil.copyfile( + os.path.join(mklittlefs_dir, "package.json"), + os.path.join(mklittlefs400_dir, "package.json"), + ) + shutil.copytree(mklittlefs400_dir, mklittlefs_dir, dirs_exist_ok=True) # Currently only Arduino Nano ESP32 uses the dfuutil tool as uploader if variables.get("board") == "arduino_nano_esp32": From dde6cdb5f33065488018d6af861e24f1efcb9e6b Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 4 May 2025 17:28:59 +0200 Subject: [PATCH 3/5] Update platform.json --- platform.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/platform.json b/platform.json index 7e47654a7..a59be429a 100644 --- a/platform.json +++ b/platform.json @@ -18,7 +18,7 @@ "type": "git", "url": "https://github.com/pioarduino/platform-espressif32.git" }, - "version": "54.03.20+develop", + "version": "55.03.30+develop", "frameworks": { "arduino": { "script": "builder/frameworks/arduino.py" @@ -33,7 +33,7 @@ "type": "framework", "optional": true, "owner": "espressif", - "version": "https://github.com/espressif/arduino-esp32/archive/master.zip" + "version": "https://github.com/espressif/arduino-esp32/archive/release/v3.3.x.zip" }, "framework-arduinoespressif32-libs": { "type": "framework", @@ -51,7 +51,7 @@ "type": "framework", "optional": true, "owner": "pioarduino", - "version": "https://github.com/pioarduino/esp-idf/releases/download/v5.4.1.250411/esp-idf-v5.4.1.zip" + "version": "https://github.com/pioarduino/esp-idf/releases/download/v5.5.0.20250422/esp-idf-v5.5.0.zip" }, "toolchain-xtensa-esp-elf": { "type": "toolchain", From f412ad86f7d76439833bb83cf223bcd8a00b6e06 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 4 May 2025 17:38:54 +0200 Subject: [PATCH 4/5] Update platform.json --- platform.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/platform.json b/platform.json index a59be429a..7e47654a7 100644 --- a/platform.json +++ b/platform.json @@ -18,7 +18,7 @@ "type": "git", "url": "https://github.com/pioarduino/platform-espressif32.git" }, - "version": "55.03.30+develop", + "version": "54.03.20+develop", "frameworks": { "arduino": { "script": "builder/frameworks/arduino.py" @@ -33,7 +33,7 @@ "type": "framework", "optional": true, "owner": "espressif", - "version": "https://github.com/espressif/arduino-esp32/archive/release/v3.3.x.zip" + "version": "https://github.com/espressif/arduino-esp32/archive/master.zip" }, "framework-arduinoespressif32-libs": { "type": "framework", @@ -51,7 +51,7 @@ "type": "framework", "optional": true, "owner": "pioarduino", - "version": "https://github.com/pioarduino/esp-idf/releases/download/v5.5.0.20250422/esp-idf-v5.5.0.zip" + "version": "https://github.com/pioarduino/esp-idf/releases/download/v5.4.1.250411/esp-idf-v5.4.1.zip" }, "toolchain-xtensa-esp-elf": { "type": "toolchain", From c0219e32200397cfbd5f3e1272884fcdde63738a Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sun, 4 May 2025 17:43:17 +0200 Subject: [PATCH 5/5] Update platform.py --- platform.py | 1 + 1 file changed, 1 insertion(+) diff --git a/platform.py b/platform.py index fdca9b1c2..3d089dde8 100644 --- a/platform.py +++ b/platform.py @@ -13,6 +13,7 @@ # limitations under the License. import os +import requests import json import subprocess import sys