Skip to content

Commit fb4df46

Browse files
authored
Update main.py
1 parent b927322 commit fb4df46

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

builder/main.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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)