Arduino core 3.3.3
This commit is contained in:
+55
-3
@@ -12,11 +12,19 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# Python Version Check
|
||||
import sys
|
||||
|
||||
if not ((3, 10) <= sys.version_info < (3, 14)):
|
||||
print("ERROR: Python version must be between 3.10 and 3.13.", file=sys.stderr)
|
||||
print(f"Current Python version: {sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}", file=sys.stderr)
|
||||
print("Supported versions: 3.10, 3.11, 3.12, 3.13", file=sys.stderr)
|
||||
raise SystemExit(1)
|
||||
|
||||
# LZMA support check
|
||||
try:
|
||||
import lzma as _lzma
|
||||
except ImportError:
|
||||
import sys
|
||||
print("ERROR: Python's lzma module is unavailable or broken in this interpreter.", file=sys.stderr)
|
||||
print("LZMA (liblzma) support is required for tool/toolchain installation.", file=sys.stderr)
|
||||
print("Please install Python built with LZMA support.", file=sys.stderr)
|
||||
@@ -34,7 +42,6 @@ import requests
|
||||
import shutil
|
||||
import socket
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from typing import Optional, Dict, List, Any, Union
|
||||
|
||||
@@ -53,12 +60,14 @@ spec.loader.exec_module(penv_setup_module)
|
||||
|
||||
setup_penv_minimal = penv_setup_module.setup_penv_minimal
|
||||
get_executable_path = penv_setup_module.get_executable_path
|
||||
has_internet_connection = penv_setup_module.has_internet_connection
|
||||
|
||||
|
||||
# Constants
|
||||
DEFAULT_DEBUG_SPEED = "5000"
|
||||
DEFAULT_APP_OFFSET = "0x10000"
|
||||
tl_install_name = "tool-esp_install"
|
||||
ARDUINO_ESP32_PACKAGE_URL = "https://raw.githubusercontent.com/espressif/arduino-esp32/master/package/package_esp32_index.template.json"
|
||||
|
||||
# MCUs that support ESP-builtin debug
|
||||
ESP_BUILTIN_DEBUG_MCUS = frozenset([
|
||||
@@ -119,6 +128,13 @@ pm = ToolPackageManager()
|
||||
# Configure logger
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
def is_internet_available():
|
||||
"""
|
||||
Check if connected to Internet.
|
||||
Uses the centralized internet check from penv_setup module.
|
||||
"""
|
||||
return has_internet_connection()
|
||||
|
||||
def safe_file_operation(operation_func):
|
||||
"""Decorator for safe filesystem operations with error handling."""
|
||||
def wrapper(*args, **kwargs):
|
||||
@@ -546,10 +562,11 @@ class Espressif32Platform(PlatformBase):
|
||||
if "arduino" not in frameworks:
|
||||
return
|
||||
|
||||
safe_remove_directory_pattern(Path(self.packages_dir), f"framework-arduinoespressif32@*")
|
||||
safe_remove_directory_pattern(Path(self.packages_dir), f"framework-arduinoespressif32.*")
|
||||
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:
|
||||
@@ -562,6 +579,8 @@ class Espressif32Platform(PlatformBase):
|
||||
|
||||
if custom_sdkconfig is not None or len(str(board_sdkconfig)) > 3:
|
||||
frameworks.append("espidf")
|
||||
safe_remove_directory_pattern(Path(self.packages_dir), f"framework-espidf@*")
|
||||
safe_remove_directory_pattern(Path(self.packages_dir), f"framework-espidf.*")
|
||||
self.packages["framework-espidf"]["optional"] = False
|
||||
if mcu == "esp32c2":
|
||||
self.packages["framework-arduino-c2-skeleton-lib"]["optional"] = False
|
||||
@@ -645,6 +664,38 @@ class Espressif32Platform(PlatformBase):
|
||||
for package in COMMON_IDF_PACKAGES:
|
||||
self.install_tool(package)
|
||||
|
||||
def _check_exception_decoder_filter(self, variables: Dict) -> bool:
|
||||
"""
|
||||
Check if esp32_exception_decoder filter is configured in monitor_filters.
|
||||
|
||||
Args:
|
||||
variables: Build configuration variables from platformio.ini
|
||||
|
||||
Returns:
|
||||
bool: True if esp32_exception_decoder is configured, False otherwise
|
||||
"""
|
||||
monitor_filters = variables.get("monitor_filters", [])
|
||||
|
||||
# Handle both list and string formats
|
||||
if isinstance(monitor_filters, str):
|
||||
monitor_filters = [f.strip() for f in monitor_filters.split(",")]
|
||||
|
||||
return "esp32_exception_decoder" in monitor_filters
|
||||
|
||||
def _configure_rom_elfs_for_exception_decoder(self, variables: Dict) -> None:
|
||||
"""
|
||||
Install tool-esp-rom-elfs if esp32_exception_decoder filter is enabled.
|
||||
|
||||
The ESP32 exception decoder requires ROM ELF files to decode addresses
|
||||
from ROM code regions in crash backtraces.
|
||||
|
||||
Args:
|
||||
variables: Build configuration variables from platformio.ini
|
||||
"""
|
||||
if self._check_exception_decoder_filter(variables):
|
||||
logger.info("esp32_exception_decoder filter detected, installing tool-esp-rom-elfs")
|
||||
self.install_tool("tool-esp-rom-elfs")
|
||||
|
||||
def _configure_check_tools(self, variables: Dict) -> None:
|
||||
"""Configure static analysis and check tools based on configuration."""
|
||||
check_tools = variables.get("check_tool", [])
|
||||
@@ -776,6 +827,7 @@ class Espressif32Platform(PlatformBase):
|
||||
if "espidf" in frameworks:
|
||||
self._install_common_idf_packages()
|
||||
|
||||
self._configure_rom_elfs_for_exception_decoder(variables)
|
||||
self._configure_check_tools(variables)
|
||||
self._configure_filesystem_tools(variables, targets)
|
||||
self._handle_dfuutil_tool(variables)
|
||||
|
||||
Reference in New Issue
Block a user