Skip to content

Commit b0699f5

Browse files
authored
Update main.py
1 parent 565927d commit b0699f5

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

builder/main.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ def __fetch_fs_size(target, source, env):
256256
GDB=join(
257257
platform.get_package_dir(
258258
"riscv32-esp-elf-gdb"
259-
if mcu in ("esp32c2", "esp32c3", "esp32c6", "esp32h2", "esp32p4")
259+
if mcu in ("esp32c2", "esp32c3", "esp32c5", "esp32c6", "esp32h2", "esp32p4")
260260
else "xtensa-esp-elf-gdb"
261261
)
262262
or "",
@@ -306,8 +306,20 @@ def __fetch_fs_size(target, source, env):
306306
PROGSUFFIX=".elf"
307307
)
308308

309-
# Set lib_archive to False for all envs to avoid issues with weak defs in framework and libs
310-
projectconfig.set("env:" + env["PIOENV"], "lib_archive", "False")
309+
# Check if lib_archive is set in platformio.ini and set it to False
310+
# if not found. This makes weak defs in framework and libs possible.
311+
def check_lib_archive_exists():
312+
for section in projectconfig.sections():
313+
if "lib_archive" in projectconfig.options(section):
314+
#print(f"lib_archive in [{section}] found with value: {projectconfig.get(section, 'lib_archive')}")
315+
return True
316+
#print("lib_archive was not found in platformio.ini")
317+
return False
318+
319+
if not check_lib_archive_exists():
320+
env_section = "env:" + env["PIOENV"]
321+
projectconfig.set(env_section, "lib_archive", "False")
322+
#print(f"lib_archive is set to False in [{env_section}]")
311323

312324
# Allow user to override via pre:script
313325
if env.get("PROGNAME", "program") == "program":

0 commit comments

Comments
 (0)