Improve support for hand-written asm source files

This commit is contained in:
Ivan Kravets
2022-05-28 18:38:57 +03:00
parent dac3351838
commit 9f46435179
3 changed files with 12 additions and 16 deletions

View File

@@ -21,7 +21,7 @@ from SCons.Script import DefaultEnvironment
env = DefaultEnvironment()
env.Append(
ASFLAGS=["-x", "assembler-with-cpp"],
ASPPFLAGS=["-x", "assembler-with-cpp"],
CCFLAGS=[
"-Os", # optimize for size
@@ -58,6 +58,3 @@ if "BOARD" in env:
"-mcpu=%s" % env.BoardConfig().get("build.cpu")
]
)
# copy CCFLAGS to ASFLAGS (-x assembler-with-cpp mode)
env.Append(ASFLAGS=env.get("CCFLAGS", [])[:])

View File

@@ -215,18 +215,22 @@ def process_dsp_lib():
)
env.Replace(AS="$CC", ASCOM="$ASPPCOM")
machine_flags = [
"-mthumb",
"-mcpu=%s" % board.get("build.cpu"),
]
env.Append(
ASFLAGS=["-x", "assembler-with-cpp"],
ASFLAGS=machine_flags,
ASPPFLAGS=[
"-x", "assembler-with-cpp",
],
CCFLAGS=[
CCFLAGS=machine_flags + [
"-Os", # optimize for size
"-ffunction-sections", # place each function in its own section
"-fdata-sections",
"-Wall",
"-mthumb",
"-mcpu=%s" % board.get("build.cpu"),
"-nostdlib",
],
@@ -267,11 +271,9 @@ env.Append(
"-fno-exceptions"
],
LINKFLAGS=[
LINKFLAGS=machine_flags + [
"-Os",
"-Wl,--gc-sections,--relax",
"-mthumb",
"-mcpu=%s" % board.get("build.cpu"),
"--specs=nano.specs",
"--specs=nosys.specs",
],
@@ -283,9 +285,6 @@ env.Append(
LIBS=["c", "gcc", "m", "stdc++", "nosys"],
)
# copy CCFLAGS to ASFLAGS (-x assembler-with-cpp mode)
env.Append(ASFLAGS=env.get("CCFLAGS", [])[:])
if not board.get("build.ldscript", ""):
env.Replace(LDSCRIPT_PATH=get_linker_script(
board.get("build.mcu", ""), board.get("build.cpu", "")))