From 5cb45b28755c902fba835dee57f55da635e0b949 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 2 Nov 2024 22:38:08 +0100 Subject: [PATCH] Fix sdkonfig parser (#96) --- builder/frameworks/espidf.py | 11 ++++++--- examples/arduino-blink/platformio.ini | 32 ++++++++++++++++++++++++++- 2 files changed, 39 insertions(+), 4 deletions(-) diff --git a/builder/frameworks/espidf.py b/builder/frameworks/espidf.py index b83632b31..30727899a 100644 --- a/builder/frameworks/espidf.py +++ b/builder/frameworks/espidf.py @@ -216,7 +216,7 @@ def get_flag(line): else: no_match = True for item in idf_config_flags: - if flag in item: + if flag == get_flag(item.replace("\'", "")): dst.write(item.replace("\'", "")+"\n") no_match = False print("Replace:",line,"with:",item.replace("\'", "")) @@ -231,7 +231,7 @@ def get_flag(line): else: return -def HandleArduinoCOMPONENTsettings(env): +def HandleCOMPONENTsettings(env): if flag_custom_component_add == True or flag_custom_component_remove == True: # todo remove duplicated import yaml from yaml import SafeLoader @@ -302,7 +302,7 @@ def HandleArduinoCOMPONENTsettings(env): return if flag_custom_component_add == True or flag_custom_component_remove == True: - HandleArduinoCOMPONENTsettings(env) + HandleCOMPONENTsettings(env) if flag_custom_sdkonfig and "arduino" in env.subst("$PIOFRAMEWORK"): HandleArduinoIDFsettings(env) @@ -1999,10 +1999,15 @@ def idf_lib_copy(source, target, env): for file in files: if file.strip().endswith(".a"): shutil.copyfile(file,join(lib_dst,file.split(os.path.sep)[-1])) + + # /home/runner/work/platform-espressif32/platform-espressif32/examples/arduino-blink/.pio/build/esp32solo1/config/sdkconfig.h + sdkconfig_h_path = join(env["PROJECT_BUILD_DIR"],env["PIOENV"],"config","sdkconfig.h") + if not bool(os.path.isfile(join(ARDUINO_FRAMEWORK_DIR,"tools","esp32-arduino-libs",mcu,"sdkconfig.orig"))): shutil.move(join(ARDUINO_FRAMEWORK_DIR,"tools","esp32-arduino-libs",mcu,"sdkconfig"),join(ARDUINO_FRAMEWORK_DIR,"tools","esp32-arduino-libs",mcu,"sdkconfig.orig")) shutil.copyfile(join(env.subst("$PROJECT_DIR"),"sdkconfig."+env["PIOENV"]),join(ARDUINO_FRAMEWORK_DIR,"tools","esp32-arduino-libs",mcu,"sdkconfig")) shutil.copyfile(join(env.subst("$PROJECT_DIR"),"sdkconfig."+env["PIOENV"]),join(ARDUINO_FRAMEWORK_DIR,"tools","esp32-arduino-libs","sdkconfig")) + shutil.copyfile(sdkconfig_h_path,join(ARDUINO_FRAMEWORK_DIR,"tools","esp32-arduino-libs",mcu,board.get("build.arduino.memory_type", (board.get("build.flash_mode", "dio") + "_qspi")),"include","sdkconfig.h")) print("*** Copied compiled %s IDF libraries to Arduino framework ***" % idf_variant) pio_exe_path = shutil.which("platformio"+(".exe" if IS_WINDOWS else "")) diff --git a/examples/arduino-blink/platformio.ini b/examples/arduino-blink/platformio.ini index e2db625cc..2dc851fe5 100644 --- a/examples/arduino-blink/platformio.ini +++ b/examples/arduino-blink/platformio.ini @@ -13,7 +13,7 @@ framework = arduino board = esp32-solo1 build_flags = -DLED_BUILTIN=2 custom_sdkconfig = CONFIG_FREERTOS_UNICORE=y -; '# CONFIG_BT_ENABLED is not set' + '# CONFIG_BT_ENABLED is not set' '# CONFIG_ULP_COPROC_ENABLED is not set' '# CONFIG_LWIP_PPP_SUPPORT is not set' '# CONFIG_ETH_ENABLED is not set' @@ -29,24 +29,48 @@ platform = espressif32 framework = arduino board = esp32s3_120_16_8-qio_opi monitor_speed = 115200 +custom_component_remove = espressif/esp_hosted + espressif/esp_wifi_remote + espressif/mdns + espressif/esp-dsp + espressif/esp_modem + espressif/esp32-camera [env:esp32-c2-devkitm-1] platform = espressif32 framework = arduino board = esp32-c2-devkitm-1 monitor_speed = 115200 +custom_component_remove = espressif/esp_hosted + espressif/esp_wifi_remote + espressif/mdns + espressif/esp-dsp + espressif/esp_modem + espressif/esp32-camera [env:esp32-c6-devkitc-1] platform = espressif32 framework = arduino board = esp32-c6-devkitc-1 monitor_speed = 115200 +custom_component_remove = espressif/esp_hosted + espressif/esp_wifi_remote + espressif/mdns + espressif/esp-dsp + espressif/esp_modem + espressif/esp32-camera [env:esp32-h2-devkitm-1] platform = espressif32 framework = arduino board = esp32-h2-devkitm-1 monitor_speed = 115200 +custom_component_remove = espressif/esp_hosted + espressif/esp_wifi_remote + espressif/mdns + espressif/esp-dsp + espressif/esp_modem + espressif/esp32-camera [env:esp32-p4] platform = espressif32 @@ -54,3 +78,9 @@ framework = arduino board = esp32-p4 build_flags = -DLED_BUILTIN=2 monitor_speed = 115200 +custom_component_remove = espressif/esp_hosted + espressif/esp_wifi_remote + espressif/mdns + espressif/esp-dsp + espressif/esp_modem + espressif/esp32-camera