Skip to content

Commit 8521ae7

Browse files
committed
Improve support for hand-written asm source files
1 parent 08ccc03 commit 8521ae7

File tree

3 files changed

+17
-25
lines changed

3 files changed

+17
-25
lines changed

adafruit.py

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -67,17 +67,24 @@
6767
softdevice_version = board.get("build.softdevice.sd_version", default_softdevice_version)
6868
bootloader_version = board.get("build.bootloader.version", default_bootloader_version)
6969

70+
machine_flags = [
71+
"-mthumb",
72+
"-mcpu=%s" % board.get("build.cpu"),
73+
]
74+
7075
env.Append(
71-
ASFLAGS=["-x", "assembler-with-cpp"],
76+
ASFLAGS=machine_flags,
77+
ASPPFLAGS=[
78+
"-x", "assembler-with-cpp",
79+
],
7280

7381
CFLAGS=["-std=gnu11"],
7482

75-
CCFLAGS=[
83+
CCFLAGS=machine_flags + [
7684
"-Ofast",
7785
"-ffunction-sections", # place each function in its own section
7886
"-fdata-sections",
7987
"-Wall",
80-
"-mthumb",
8188
"-nostdlib",
8289
"--param", "max-inline-insns-single=500"
8390
],
@@ -118,10 +125,9 @@
118125
join(NORDIC_DIR, "nrfx", "drivers", "src")
119126
],
120127

121-
LINKFLAGS=[
128+
LINKFLAGS=machine_flags + [
122129
"-Ofast",
123130
"-Wl,--gc-sections,--relax",
124-
"-mthumb",
125131
"--specs=nano.specs",
126132
"--specs=nosys.specs",
127133
"-Wl,--check-sections",
@@ -137,18 +143,12 @@
137143
LIBS=["m", "arm_cortexM4lf_math"]
138144
)
139145

140-
if "BOARD" in env:
141-
env.Append(
142-
CCFLAGS=[
143-
"-mcpu=%s" % board.get("build.cpu")
144-
],
145-
LINKFLAGS=[
146-
"-mcpu=%s" % board.get("build.cpu")
147-
]
148-
)
149-
150146
if board.get("build.cpu") == "cortex-m4":
151147
env.Append(
148+
ASFLAGS=[
149+
"-mfloat-abi=hard",
150+
"-mfpu=fpv4-sp-d16",
151+
],
152152
CCFLAGS=[
153153
"-mfloat-abi=hard",
154154
"-mfpu=fpv4-sp-d16",
@@ -161,10 +161,6 @@
161161
]
162162
)
163163

164-
env.Append(
165-
ASFLAGS=env.get("CCFLAGS", [])[:]
166-
)
167-
168164
# Process softdevice options
169165
softdevice_name = board.get("build.softdevice.sd_name")
170166
board_name = board.get("build.bootloader.hex_filename", board.get("build.variant"))

mbed-core

nrf5.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
assert isdir(FRAMEWORK_DIR)
3333

3434
env.Append(
35-
ASFLAGS=["-x", "assembler-with-cpp"],
35+
ASPPFLAGS=["-x", "assembler-with-cpp"],
3636

3737
CFLAGS=["-std=gnu11"],
3838

@@ -118,10 +118,6 @@
118118
]
119119
)
120120

121-
env.Append(
122-
ASFLAGS=env.get("CCFLAGS", [])[:]
123-
)
124-
125121
# Process softdevice options
126122
softdevice_ver = None
127123
ldscript_path = None

0 commit comments

Comments
 (0)