Skip to content

Commit 9f46435

Browse files
committed
Improve support for hand-written asm source files
1 parent dac3351 commit 9f46435

File tree

3 files changed

+12
-16
lines changed

3 files changed

+12
-16
lines changed

builder/frameworks/_bare.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
env = DefaultEnvironment()
2222

2323
env.Append(
24-
ASFLAGS=["-x", "assembler-with-cpp"],
24+
ASPPFLAGS=["-x", "assembler-with-cpp"],
2525

2626
CCFLAGS=[
2727
"-Os", # optimize for size
@@ -58,6 +58,3 @@
5858
"-mcpu=%s" % env.BoardConfig().get("build.cpu")
5959
]
6060
)
61-
62-
# copy CCFLAGS to ASFLAGS (-x assembler-with-cpp mode)
63-
env.Append(ASFLAGS=env.get("CCFLAGS", [])[:])

builder/frameworks/libopencm3

builder/frameworks/stm32cube.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -215,18 +215,22 @@ def process_dsp_lib():
215215
)
216216

217217

218-
env.Replace(AS="$CC", ASCOM="$ASPPCOM")
218+
machine_flags = [
219+
"-mthumb",
220+
"-mcpu=%s" % board.get("build.cpu"),
221+
]
219222

220223
env.Append(
221-
ASFLAGS=["-x", "assembler-with-cpp"],
224+
ASFLAGS=machine_flags,
225+
ASPPFLAGS=[
226+
"-x", "assembler-with-cpp",
227+
],
222228

223-
CCFLAGS=[
229+
CCFLAGS=machine_flags + [
224230
"-Os", # optimize for size
225231
"-ffunction-sections", # place each function in its own section
226232
"-fdata-sections",
227233
"-Wall",
228-
"-mthumb",
229-
"-mcpu=%s" % board.get("build.cpu"),
230234
"-nostdlib",
231235
],
232236

@@ -267,11 +271,9 @@ def process_dsp_lib():
267271
"-fno-exceptions"
268272
],
269273

270-
LINKFLAGS=[
274+
LINKFLAGS=machine_flags + [
271275
"-Os",
272276
"-Wl,--gc-sections,--relax",
273-
"-mthumb",
274-
"-mcpu=%s" % board.get("build.cpu"),
275277
"--specs=nano.specs",
276278
"--specs=nosys.specs",
277279
],
@@ -283,9 +285,6 @@ def process_dsp_lib():
283285
LIBS=["c", "gcc", "m", "stdc++", "nosys"],
284286
)
285287

286-
# copy CCFLAGS to ASFLAGS (-x assembler-with-cpp mode)
287-
env.Append(ASFLAGS=env.get("CCFLAGS", [])[:])
288-
289288
if not board.get("build.ldscript", ""):
290289
env.Replace(LDSCRIPT_PATH=get_linker_script(
291290
board.get("build.mcu", ""), board.get("build.cpu", "")))

0 commit comments

Comments
 (0)