@@ -557,7 +557,7 @@ def _handle_existing_tool(self, tool_name: str, paths: Dict[str, str]) -> bool:
557557
558558 return self .install_tool (tool_name )
559559
560- def _configure_arduino_framework (self , frameworks : List [str ]) -> None :
560+ def _configure_arduino_framework (self , frameworks : List [str ], mcu : str ) -> None :
561561 """Configure Arduino framework dependencies."""
562562 if "arduino" not in frameworks :
563563 return
@@ -566,7 +566,6 @@ def _configure_arduino_framework(self, frameworks: List[str]) -> None:
566566 safe_remove_directory_pattern (Path (self .packages_dir ), f"framework-arduinoespressif32.*" )
567567 self .packages ["framework-arduinoespressif32" ]["optional" ] = False
568568 self .packages ["framework-arduinoespressif32-libs" ]["optional" ] = False
569-
570569 if is_internet_available ():
571570 try :
572571 response = requests .get (ARDUINO_ESP32_PACKAGE_URL , timeout = 30 )
@@ -576,6 +575,10 @@ def _configure_arduino_framework(self, frameworks: List[str]) -> None:
576575 self .packages ["framework-arduinoespressif32-libs" ]["version" ] = dyn_lib_url
577576 except (requests .RequestException , KeyError , IndexError ) as e :
578577 logger .error (f"Failed to fetch Arduino framework library URL: { e } " )
578+ if mcu == "esp32c2" :
579+ self .packages ["framework-arduino-c2-skeleton-lib" ]["optional" ] = False
580+ if mcu == "esp32c61" :
581+ self .packages ["framework-arduino-c61-skeleton-lib" ]["optional" ] = False
579582
580583 def _configure_espidf_framework (
581584 self , frameworks : List [str ], variables : Dict , board_config : Dict , mcu : str
@@ -592,10 +595,6 @@ def _configure_espidf_framework(
592595 safe_remove_directory_pattern (Path (self .packages_dir ), f"framework-espidf@*" )
593596 safe_remove_directory_pattern (Path (self .packages_dir ), f"framework-espidf.*" )
594597 self .packages ["framework-espidf" ]["optional" ] = False
595- if mcu == "esp32c2" :
596- self .packages ["framework-arduino-c2-skeleton-lib" ]["optional" ] = False
597- if mcu == "esp32c61" :
598- self .packages ["framework-arduino-c61-skeleton-lib" ]["optional" ] = False
599598
600599 def _get_mcu_config (self , mcu : str ) -> Optional [Dict ]:
601600 """Get MCU configuration with optimized caching and search."""
@@ -831,7 +830,7 @@ def configure_default_packages(self, variables: Dict, targets: List[str]) -> Any
831830 self ._esptool_path = esptool_path
832831
833832 # Configuration steps (now with penv available)
834- self ._configure_arduino_framework (frameworks )
833+ self ._configure_arduino_framework (frameworks , mcu )
835834 self ._configure_espidf_framework (frameworks , variables , board_config , mcu )
836835 self ._configure_mcu_toolchains (mcu , variables , targets )
837836 self ._handle_littlefs_tool (for_download = False ) # Ensure mklittlefs is installed
0 commit comments