Arduino Core 3.3.0
This commit is contained in:
+26
-20
@@ -14,7 +14,6 @@
|
||||
|
||||
import fnmatch
|
||||
import os
|
||||
import contextlib
|
||||
import json
|
||||
import subprocess
|
||||
import sys
|
||||
@@ -30,8 +29,6 @@ from platformio.package.manager.tool import ToolPackageManager
|
||||
# Constants
|
||||
RETRY_LIMIT = 3
|
||||
SUBPROCESS_TIMEOUT = 300
|
||||
MKLITTLEFS_VERSION_320 = "3.2.0"
|
||||
MKLITTLEFS_VERSION_400 = "4.0.0"
|
||||
DEFAULT_DEBUG_SPEED = "5000"
|
||||
DEFAULT_APP_OFFSET = "0x10000"
|
||||
|
||||
@@ -326,17 +323,18 @@ class Espressif32Platform(PlatformBase):
|
||||
|
||||
# Then remove the main tool directory (if it still exists)
|
||||
safe_remove_directory(paths['tool_path'])
|
||||
|
||||
|
||||
return self.install_tool(tool_name, retry_count + 1)
|
||||
|
||||
def _configure_arduino_framework(self, frameworks: List[str]) -> None:
|
||||
"""Configure Arduino framework with dynamic library URL fetching."""
|
||||
"""Configure Arduino framework"""
|
||||
if "arduino" not in frameworks:
|
||||
return
|
||||
|
||||
self.packages["framework-arduinoespressif32"]["optional"] = False
|
||||
self.packages["framework-arduinoespressif32-libs"]["optional"] = False
|
||||
|
||||
|
||||
def _configure_espidf_framework(
|
||||
self, frameworks: List[str], variables: Dict, board_config: Dict, mcu: str
|
||||
) -> None:
|
||||
@@ -409,6 +407,10 @@ class Espressif32Platform(PlatformBase):
|
||||
if os.path.exists(installer_path):
|
||||
self.packages["tl-install"]["optional"] = True
|
||||
|
||||
def _install_esptool_package(self) -> None:
|
||||
"""Install esptool package required for all builds."""
|
||||
self.install_tool("tool-esptoolpy")
|
||||
|
||||
def _install_common_idf_packages(self) -> None:
|
||||
"""Install common ESP-IDF packages required for all builds."""
|
||||
for package in COMMON_IDF_PACKAGES:
|
||||
@@ -417,6 +419,7 @@ class Espressif32Platform(PlatformBase):
|
||||
def _configure_check_tools(self, variables: Dict) -> None:
|
||||
"""Configure static analysis and check tools based on configuration."""
|
||||
check_tools = variables.get("check_tool", [])
|
||||
self.install_tool("contrib-piohome")
|
||||
if not check_tools:
|
||||
return
|
||||
|
||||
@@ -432,37 +435,38 @@ class Espressif32Platform(PlatformBase):
|
||||
try:
|
||||
with open(piopm_path, 'r', encoding='utf-8') as f:
|
||||
package_data = json.load(f)
|
||||
if package_data.get('version') != MKLITTLEFS_VERSION_320:
|
||||
version = package_data.get('version', '')
|
||||
if not version.startswith("3."):
|
||||
os.remove(piopm_path)
|
||||
logger.info("Outdated mklittlefs version removed")
|
||||
logger.info(f"Incompatible mklittlefs version {version} removed (required: 3.x)")
|
||||
except (json.JSONDecodeError, KeyError) as e:
|
||||
logger.error(f"Error reading mklittlefs package data: {e}")
|
||||
|
||||
def _setup_mklittlefs_for_download(self) -> None:
|
||||
"""Setup mklittlefs for download functionality with version 4.0.0."""
|
||||
"""Setup mklittlefs for download functionality with version 4.x."""
|
||||
mklittlefs_dir = os.path.join(self.packages_dir, "tool-mklittlefs")
|
||||
mklittlefs400_dir = os.path.join(
|
||||
self.packages_dir, "tool-mklittlefs-4.0.0"
|
||||
mklittlefs4_dir = os.path.join(
|
||||
self.packages_dir, "tool-mklittlefs4"
|
||||
)
|
||||
|
||||
# Ensure mklittlefs 3.2.0 is installed
|
||||
# Ensure mklittlefs 3.x is installed
|
||||
if not os.path.exists(mklittlefs_dir):
|
||||
self.install_tool("tool-mklittlefs")
|
||||
if os.path.exists(os.path.join(mklittlefs_dir, "tools.json")):
|
||||
self.install_tool("tool-mklittlefs")
|
||||
|
||||
# Install mklittlefs 4.0.0
|
||||
if not os.path.exists(mklittlefs400_dir):
|
||||
self.install_tool("tool-mklittlefs-4.0.0")
|
||||
if os.path.exists(os.path.join(mklittlefs400_dir, "tools.json")):
|
||||
self.install_tool("tool-mklittlefs-4.0.0")
|
||||
# Install mklittlefs 4.x
|
||||
if not os.path.exists(mklittlefs4_dir):
|
||||
self.install_tool("tool-mklittlefs4")
|
||||
if os.path.exists(os.path.join(mklittlefs4_dir, "tools.json")):
|
||||
self.install_tool("tool-mklittlefs4")
|
||||
|
||||
# Copy mklittlefs 4.0.0 over 3.2.0
|
||||
if os.path.exists(mklittlefs400_dir):
|
||||
# Copy mklittlefs 4.x over 3.x
|
||||
if os.path.exists(mklittlefs4_dir):
|
||||
package_src = os.path.join(mklittlefs_dir, "package.json")
|
||||
package_dst = os.path.join(mklittlefs400_dir, "package.json")
|
||||
package_dst = os.path.join(mklittlefs4_dir, "package.json")
|
||||
safe_copy_file(package_src, package_dst)
|
||||
shutil.copytree(mklittlefs400_dir, mklittlefs_dir, dirs_exist_ok=True)
|
||||
shutil.copytree(mklittlefs4_dir, mklittlefs_dir, dirs_exist_ok=True)
|
||||
self.packages.pop("tool-mkfatfs", None)
|
||||
|
||||
def _handle_littlefs_tool(self, for_download: bool) -> None:
|
||||
@@ -513,9 +517,11 @@ class Espressif32Platform(PlatformBase):
|
||||
try:
|
||||
# Configuration steps
|
||||
self._configure_installer()
|
||||
self._install_esptool_package()
|
||||
self._configure_arduino_framework(frameworks)
|
||||
self._configure_espidf_framework(frameworks, variables, board_config, mcu)
|
||||
self._configure_mcu_toolchains(mcu, variables, targets)
|
||||
self._handle_littlefs_tool(for_download=False) # Ensure mklittlefs is installed
|
||||
|
||||
if "espidf" in frameworks:
|
||||
self._install_common_idf_packages()
|
||||
|
||||
Reference in New Issue
Block a user