Skip to content

Commit db09865

Browse files
authored
Add PSRAM configuration check for Esp32 settings
1 parent ae485b0 commit db09865

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

builder/frameworks/arduino.py

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -575,13 +575,29 @@ def has_unicore_flags():
575575
or flag in board_sdkconfig for flag in UNICORE_FLAGS)
576576

577577

578-
# Esp32-solo1 libs settings
579-
if flag_custom_sdkconfig and has_unicore_flags():
578+
def has_psram_config():
579+
"""Check if PSRAM is configured in extra_flags, entry_custom_sdkconfig or board_sdkconfig"""
580+
return ("PSRAM" in extra_flags or "PSRAM" in entry_custom_sdkconfig
581+
or "PSRAM" in board_sdkconfig or "CONFIG_SPIRAM=y" in extra_flags
582+
or "CONFIG_SPIRAM=y" in entry_custom_sdkconfig
583+
or "CONFIG_SPIRAM=y" in board_sdkconfig)
584+
585+
586+
# Esp32 settings for solo1 and PSRAM
587+
if flag_custom_sdkconfig:
580588
if not env.get('BUILD_UNFLAGS'): # Initialize if not set
581589
env['BUILD_UNFLAGS'] = []
582590

583-
build_unflags = (" ".join(env['BUILD_UNFLAGS']) +
584-
" -mdisable-hardware-atomics -ustart_app_other_cores")
591+
build_unflags = " ".join(env['BUILD_UNFLAGS'])
592+
593+
# -mdisable-hardware-atomics: always for solo1, or when PSRAM is NOT configured
594+
if has_unicore_flags() or not has_psram_config():
595+
build_unflags += " -mdisable-hardware-atomics"
596+
597+
# -ustart_app_other_cores only and always for solo1
598+
if has_unicore_flags():
599+
build_unflags += " -ustart_app_other_cores"
600+
585601
new_build_unflags = build_unflags.split()
586602
env.Replace(BUILD_UNFLAGS=new_build_unflags)
587603

0 commit comments

Comments
 (0)