Skip to content

Commit

Permalink
Fix sdkonfig parser (#96)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason2866 authored Nov 2, 2024
1 parent 60e4d12 commit 5cb45b2
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 4 deletions.
11 changes: 8 additions & 3 deletions builder/frameworks/espidf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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("\'", ""))
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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 ""))
Expand Down
32 changes: 31 additions & 1 deletion examples/arduino-blink/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -29,28 +29,58 @@ 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
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

0 comments on commit 5cb45b2

Please sign in to comment.