Skip to content

Commit c40f4dd

Browse files
committed
Simplify LD script handling
1 parent b513ee8 commit c40f4dd

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

builder/main.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@
9494
CCFLAGS=["-G1024"]
9595
)
9696

97+
# append LD script manually
98+
if "LDSCRIPT_PATH" in env:
99+
del env['LDSCRIPT_PATH']
100+
97101

98102
env.Append(
99103
BUILDERS=dict(
@@ -132,16 +136,8 @@
132136
else:
133137
target_elf = env.BuildProgram()
134138

135-
# Hook: Fix option for LD script
136-
_new_linkflags = []
137-
for f in env['LINKFLAGS']:
138-
if not f.startswith("-Wl,-T"):
139-
_new_linkflags.append(f)
140-
else:
141-
_new_linkflags.append("-Wl,--script=%s" % f[6:])
142-
143-
env.Replace(LINKFLAGS=_new_linkflags)
144139
env.Append(LINKFLAGS=[
140+
"-Wl,--script=%s" % env.BoardConfig().get("build.ldscript", ""),
145141
"-Wl,--script=chipKIT-application-COMMON%s.ld" %
146142
("-MZ" if "MZ" in env.BoardConfig().get("build.mcu", "") else "")
147143
])

0 commit comments

Comments
 (0)