Skip to content

Commit 87f323b

Browse files
committed
platform: common extension mapping
- generate a _debug.elf, then strip it to create the final .elf - add '-zsk.bin' extension to the chosen binary so all files end in .bin - use upload.extension more consistently
1 parent ac05eb3 commit 87f323b

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

boards.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ portentac33.menu.mode.linked.build.extra_extra_ldflags=-lc -lm -lgcc -L{build.va
495495
portentac33.menu.mode.linked.build.llext_link_flags=
496496
portentac33.menu.mode.linked.build.suffix=_linked
497497
portentac33.menu.mode.linked.build.ldscript={runtime.platform.path}/variants/linked/linker_script.ld
498-
portentac33.menu.mode.linked.upload.extension=bin.dfu
498+
portentac33.menu.mode.linked.upload.extension=bin-zsk.bin
499499
portentac33.menu.mode.linked.postbuild_mode=-linked
500500

501501
portentac33.build.variant=arduino_portenta_c33

extra/post_build_tool/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
)
1010

1111
func main() {
12-
var output = flag.String("output", "", "Output to a specific file (default: add .dfu suffix)")
12+
var output = flag.String("output", "", "Output to a specific file (default: add -zsk.bin suffix)")
1313
var debug = flag.Bool("debug", false, "Enable debugging mode")
1414
var linked = flag.Bool("prelinked", false, "Provided file has already been linked to Zephyr")
1515
var force = flag.Bool("force", false, "Ignore safety checks and overwrite the header")
@@ -85,7 +85,7 @@ func main() {
8585
// Create a new filename for the copy
8686
newFilename := *output
8787
if newFilename == "" {
88-
newFilename = filename + ".dfu"
88+
newFilename = filename + "-zsk.bin"
8989
}
9090

9191
// Write the new content to the new file

platform.txt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ build.ldscript={runtime.platform.path}/variants/llext/linker_script.ld
4545
build.llext_link_flags=-r -e main
4646
build.extra_extra_ldflags=
4747
build.suffix=
48-
upload.extension=llext.dfu
48+
upload.extension=elf-zsk.bin
4949
postbuild_debug=
5050
postbuild_mode=
5151

@@ -89,7 +89,8 @@ recipe.S.o.pattern="{compiler.path}{compiler.S.cmd}" {compiler.S.flags} -DARDUIN
8989
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}"
9090

9191
## Combine gc-sections, archives, and objects
92-
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" "-L{build.path}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} {build.extra_flags} {build.extra_ldflags} {compiler.zephyr.ldflags} "-T{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" --specs=picolibc.specs --specs=nosys.specs {compiler.ldflags} -o "{build.path}/{build.project_name}.elf" {object_files} "{build.path}/{archive_file}" {compiler.zephyr} {compiler.zephyr.extra_ldflags} {compiler.libraries.ldflags}
92+
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" "-L{build.path}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} {build.extra_flags} {build.extra_ldflags} {compiler.zephyr.ldflags} "-T{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" --specs=picolibc.specs --specs=nosys.specs {compiler.ldflags} -o "{build.path}/{build.project_name}_debug.elf" {object_files} "{build.path}/{archive_file}" {compiler.zephyr} {compiler.zephyr.extra_ldflags} {compiler.libraries.ldflags}
93+
recipe.hooks.linking.postlink.1.pattern="{compiler.path}{build.crossprefix}strip" --strip-debug {build.path}/{build.project_name}_debug.elf -o{build.path}/{build.project_name}.elf
9394

9495
## Create eeprom
9596
recipe.objcopy.eep.pattern=
@@ -101,18 +102,17 @@ recipe.objcopy.bin.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf
101102
recipe.objcopy.hex.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.hex.flags} {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.hex"
102103

103104
## Mangle the file
104-
recipe.hooks.objcopy.postobjcopy.1.pattern="{compiler.path}{build.crossprefix}strip" --strip-debug {build.path}/{build.project_name}.elf -o{build.path}/{build.project_name}.llext
105-
recipe.hooks.objcopy.postobjcopy.2.pattern={runtime.tools.zephyr-post-build-tool.path}/post_build {postbuild_debug} {postbuild_mode} {build.path}/{build.project_name}.llext
106-
recipe.hooks.objcopy.postobjcopy.3.pattern={runtime.tools.zephyr-post-build-tool.path}/post_build {postbuild_debug} {postbuild_mode} {build.path}/{build.project_name}.bin
105+
recipe.hooks.objcopy.postobjcopy.1.pattern={runtime.tools.zephyr-post-build-tool.path}/post_build {postbuild_debug} {postbuild_mode} {build.path}/{build.project_name}.elf
106+
recipe.hooks.objcopy.postobjcopy.2.pattern={runtime.tools.zephyr-post-build-tool.path}/post_build {postbuild_debug} {postbuild_mode} {build.path}/{build.project_name}.bin
107107

108108
## Compute size
109109
recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf"
110110
recipe.size.regex.data=^(?:\.data|\.bss)\s+([0-9]+).*
111111
recipe.size.regex=^(?:\.data|\.text|\.rodata)\S*?\s+([0-9]+).*
112112

113-
## Save hex
114-
recipe.output.tmp_file={build.project_name}.llext
115-
recipe.output.save_file={build.project_name}.{build.variant}.llext
113+
## Save output file
114+
recipe.output.tmp_file={build.project_name}.{upload.extension}
115+
recipe.output.save_file={build.project_name}.{build.variant}.{upload.extension}
116116

117117

118118
# Required discoveries and monitors
@@ -242,7 +242,7 @@ tools.pyocd.path=
242242
tools.pyocd.cmd=pyocd
243243
tools.pyocd.upload.params.verbose=
244244
tools.pyocd.upload.params.quiet=
245-
tools.pyocd.upload.pattern="{cmd}" load --target {upload.target} {build.path}/{build.project_name}.dfu.bin@{upload.address}
245+
tools.pyocd.upload.pattern="{cmd}" load --target {upload.target} {build.path}/{build.project_name}.${upload.extension}@{upload.address}
246246

247247
tools.pyocd.bootloader.params.verbose=
248248
tools.pyocd.bootloader.params.quiet=

0 commit comments

Comments
 (0)