@@ -155,10 +155,14 @@ def _get_installed_standard_pip_packages():
155155):
156156 print ("Warning! Debugging an IDF project requires PlatformIO Core >= 6.1.11!" )
157157
158- # Arduino framework as a component is not compatible with ESP-IDF >5.3
159158if "arduino" in env .subst ("$PIOFRAMEWORK" ):
160159 ARDUINO_FRAMEWORK_DIR = platform .get_package_dir ("framework-arduinoespressif32" )
161160 ARDUINO_FRMWRK_LIB_DIR = platform .get_package_dir ("framework-arduinoespressif32-libs" )
161+ if mcu == "esp32c2" :
162+ ARDUINO_FRMWRK_C2_LIB_DIR = join (platform .get_package_dir ("framework-arduinoespressif32-libs" ),mcu )
163+ if not os .path .exists (ARDUINO_FRMWRK_C2_LIB_DIR ):
164+ ARDUINO_C2_DIR = join (platform .get_package_dir ("framework-arduino-c2-skeleton-lib" ),mcu )
165+ shutil .copytree (ARDUINO_C2_DIR , ARDUINO_FRMWRK_C2_LIB_DIR , dirs_exist_ok = True )
162166 # Possible package names in 'package@version' format is not compatible with CMake
163167 if "@" in os .path .basename (ARDUINO_FRAMEWORK_DIR ):
164168 new_path = os .path .join (
@@ -296,7 +300,7 @@ def HandleCOMPONENTsettings(env):
296300 if flag_custom_component_add == True or flag_custom_component_remove == True : # todo remove duplicated
297301 import yaml
298302 from yaml import SafeLoader
299- print ("*** \" custom_component\" is used to select managed idf components ***" )
303+ print ("*** \" custom_component\" is used to (de) select managed idf components ***" )
300304 if flag_custom_component_remove == True :
301305 idf_custom_component_remove = env .GetProjectOption ("custom_component_remove" ).splitlines ()
302306 else :
@@ -365,7 +369,7 @@ def HandleCOMPONENTsettings(env):
365369if flag_custom_component_add == True or flag_custom_component_remove == True :
366370 HandleCOMPONENTsettings (env )
367371
368- if flag_custom_sdkonfig == True and "arduino" in env .subst ("$PIOFRAMEWORK" ):
372+ if flag_custom_sdkonfig == True and "arduino" in env .subst ("$PIOFRAMEWORK" ) and "espidf" not in env . subst ( "$PIOFRAMEWORK" ) :
369373 HandleArduinoIDFsettings (env )
370374 LIB_SOURCE = os .path .join (ProjectConfig .get_instance ().get ("platformio" , "platforms_dir" ), "espressif32" , "builder" , "build_lib" )
371375 if not bool (os .path .exists (os .path .join (PROJECT_DIR , ".dummy" ))):
@@ -2056,7 +2060,7 @@ def _skip_prj_source_files(node):
20562060# Compile Arduino IDF sources
20572061#
20582062
2059- if "arduino" in env .get ( " PIOFRAMEWORK" ) and "espidf" not in env .get ( " PIOFRAMEWORK" ):
2063+ if ( "arduino" in env .subst ( "$ PIOFRAMEWORK" )) and ( "espidf" not in env .subst ( "$ PIOFRAMEWORK") ):
20602064 def idf_lib_copy (source , target , env ):
20612065 env_build = join (env ["PROJECT_BUILD_DIR" ],env ["PIOENV" ])
20622066 sdkconfig_h_path = join (env_build ,"config" ,"sdkconfig.h" )
@@ -2114,7 +2118,7 @@ def idf_lib_copy(source, target, env):
21142118 print ("*** Original Arduino \" idf_component.yml\" couldnt be restored ***" )
21152119 env .AddPostAction ("checkprogsize" , idf_lib_copy )
21162120
2117- if "espidf" in env .get ( " PIOFRAMEWORK" ) and (flag_custom_component_add == True or flag_custom_component_remove == True ):
2121+ if "espidf" in env .subst ( "$ PIOFRAMEWORK" ) and (flag_custom_component_add == True or flag_custom_component_remove == True ):
21182122 def idf_custom_component (source , target , env ):
21192123 try :
21202124 shutil .copy (join (ARDUINO_FRAMEWORK_DIR ,"idf_component.yml.orig" ),join (ARDUINO_FRAMEWORK_DIR ,"idf_component.yml" ))
0 commit comments