From 8683ee6b5f7ed94c41bfde8c31bd8ce60ecc1b72 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Thu, 13 Nov 2025 18:33:00 +0100 Subject: [PATCH] Add PSRAM configuration for HybridCompile --- builder/frameworks/arduino.py | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/builder/frameworks/arduino.py b/builder/frameworks/arduino.py index f86642f5f..3ff6de9fd 100644 --- a/builder/frameworks/arduino.py +++ b/builder/frameworks/arduino.py @@ -575,13 +575,29 @@ def has_unicore_flags(): or flag in board_sdkconfig for flag in UNICORE_FLAGS) -# Esp32-solo1 libs settings -if flag_custom_sdkconfig and has_unicore_flags(): +def has_psram_config(): + """Check if PSRAM is configured in extra_flags, entry_custom_sdkconfig or board_sdkconfig""" + return ("PSRAM" in extra_flags or "PSRAM" in entry_custom_sdkconfig + or "PSRAM" in board_sdkconfig or "CONFIG_SPIRAM=y" in extra_flags + or "CONFIG_SPIRAM=y" in entry_custom_sdkconfig + or "CONFIG_SPIRAM=y" in board_sdkconfig) + + +# Esp32 settings for solo1 and PSRAM +if flag_custom_sdkconfig: if not env.get('BUILD_UNFLAGS'): # Initialize if not set env['BUILD_UNFLAGS'] = [] - build_unflags = (" ".join(env['BUILD_UNFLAGS']) + - " -mdisable-hardware-atomics -ustart_app_other_cores") + build_unflags = " ".join(env['BUILD_UNFLAGS']) + + # -mdisable-hardware-atomics: always for solo1, or when PSRAM is NOT configured + if has_unicore_flags() or not has_psram_config(): + build_unflags += " -mdisable-hardware-atomics" + + # -ustart_app_other_cores only and always for solo1 + if has_unicore_flags(): + build_unflags += " -ustart_app_other_cores" + new_build_unflags = build_unflags.split() env.Replace(BUILD_UNFLAGS=new_build_unflags)