Skip to content

Commit 85097c0

Browse files
committed
Automatically generate debug listing, use hardfloat for baremetal projects
1 parent 4d1ad09 commit 85097c0

File tree

2 files changed

+32
-3
lines changed

2 files changed

+32
-3
lines changed

builder/frameworks/_bare.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,27 @@
5858
)
5959

6060
if "BOARD" in env:
61+
more_flags = []
62+
mcu = env.BoardConfig().get("build.mcu", "")
63+
if mcu == "rp2350":
64+
more_flags = [
65+
"-march=armv8-m.main+fp+dsp",
66+
"-mfloat-abi=hard",
67+
"-mcmse",
68+
]
69+
if mcu == "rp2350-riscv":
70+
more_flags = [
71+
"-march=rv32imac_zicsr_zifencei_zba_zbb_zbs_zbkb",
72+
"-mabi=ilp32"
73+
]
6174
env.Append(
6275
ASFLAGS=[
6376
"-mcpu=%s" % env.BoardConfig().get("build.cpu")
64-
],
77+
] + more_flags,
6578
CCFLAGS=[
6679
"-mcpu=%s" % env.BoardConfig().get("build.cpu")
67-
],
80+
] + more_flags,
6881
LINKFLAGS=[
6982
"-mcpu=%s" % env.BoardConfig().get("build.cpu")
70-
]
83+
] + more_flags
7184
)

builder/main.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ def generate_uf2(target, source, env):
216216
CXX="%s-g++" % toolchain_tripple,
217217
GDB="%s-gdb" % toolchain_tripple,
218218
OBJCOPY="%s-objcopy" % toolchain_tripple,
219+
OBJDUMP="%s-objdump" % toolchain_tripple,
219220
RANLIB="%s-ranlib" % toolchain_tripple,
220221
SIZETOOL="%s-size" % toolchain_tripple,
221222

@@ -281,6 +282,20 @@ def new_check_size(target, source, env):
281282
print("PSRAM: " + _format_available_bytes(used_psram, psram_len))
282283
env.CheckUploadSize = new_check_size
283284

285+
def gen_debug_listings(env):
286+
for opt, name in [("", ""), ("-S", ".debug")]:
287+
env.AddPostAction(
288+
"$BUILD_DIR/${PROGNAME}.elf",
289+
env.VerboseAction(" ".join([
290+
"$OBJDUMP",
291+
opt,
292+
"-d",
293+
'"%s"' % "$BUILD_DIR/${PROGNAME}.elf",
294+
">",
295+
'"%s"' % ("$BUILD_DIR/${PROGNAME}" + name + ".lst")
296+
]), "Building $BUILD_DIR/${PROGNAME}" + name + ".lst")
297+
)
298+
284299
# Allow user to override via pre:script
285300
if env.get("PROGNAME", "program") == "program":
286301
env.Replace(PROGNAME="firmware")
@@ -387,6 +402,7 @@ def new_check_size(target, source, env):
387402
target_signed_bin = env.BinToSignedBin(join("$BUILD_DIR", "${PROGNAME}"), target_firm)
388403
env.Depends(target_signed_bin, "checkprogsize")
389404
env.Depends(target_firm, "checkprogsize")
405+
gen_debug_listings(env)
390406

391407
env.AddPlatformTarget("buildfs", target_firm, target_firm, "Build Filesystem Image")
392408
AlwaysBuild(env.Alias("nobuild", target_firm))

0 commit comments

Comments
 (0)