@@ -19,7 +19,7 @@ compiler.path={build.compiler_path}
19
19
compiler.c.cmd={build.crossprefix}gcc
20
20
compiler.c.flags=-g -c {compiler.warning_flags} {compiler.zephyr.macros} "@{compiler.zephyr.cflags_file}" {compiler.zephyr.arch.define} -MMD -mcpu={build.mcu} {build.float-abi} {build.fpu}
21
21
compiler.c.elf.cmd={build.crossprefix}g++
22
- compiler.c.elf.flags={build.llext_link_flags} -Wl,--gc-sections -mcpu={build.mcu} {build.float-abi} {build.fpu} -std=gnu++17
22
+ compiler.c.elf.flags=-Wl,--gc-sections -mcpu={build.mcu} {build.float-abi} {build.fpu} -std=gnu++17
23
23
compiler.S.cmd={build.crossprefix}g++
24
24
compiler.S.flags=-c -x assembler-with-cpp -mcpu={build.mcu} {build.fpu}
25
25
compiler.cpp.cmd={build.crossprefix}g++
@@ -49,12 +49,26 @@ compiler.zephyr.extra_ldflags=-lstdc++ -lsupc++
49
49
# this can be overriden in boards.txt
50
50
build.extra_flags=
51
51
build.extra_ldflags=
52
+ build.link_mode=llext
52
53
compiler.zephyr=
53
54
54
- build.ldscript={runtime.platform.path}/variants/_llext/linker_script.ld
55
- build.llext_link_flags=-r -e main
56
- build.extra_extra_ldflags=
57
- build.suffix=
55
+ build.ldscript.path={runtime.platform.path}/variants/_ldscripts
56
+ build.link_command="{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.common_ldflags} --specs=picolibc.specs --specs=nosys.specs {compiler.ldflags} {object_files} -Wl,--start-group "{build.path}/{archive_file}" {compiler.zephyr} {compiler.zephyr.extra_ldflags} {compiler.libraries.ldflags} -Wl,--end-group {build.link_args.{build.link_mode}}
57
+
58
+ # link_args.* are included by any link_command depending on the link_mode
59
+ build.link_args.llext=-e main
60
+ build.link_args.linked=-lc -lm -lgcc -L{build.variant.path} -Wl,--wrap=random -Wl,--wrap=calloc -Wl,--wrap=free -Wl,--wrap=malloc -Wl,--wrap=realloc
61
+ # link_args.check-* are used to check the build. Only LLEXT needs these to emulate a linked build (no -r!).
62
+ build.link_args.check-llext="-T{build.variant.path}/syms-llext.ld" "-T{build.ldscript.path}/memory-check.ld" "-T{build.ldscript.path}/build-linked.ld"
63
+ # link_args.build-* are used to create the final binary. -common are added to both llext and linked.
64
+ build.link_args.build-llext="-T{build.ldscript.path}/build-llext.ld" -r
65
+ build.link_args.build-linked="-T{build.variant.path}/syms-linked.ld" "-T{build.ldscript.path}/memory-linked.ld" "-T{build.ldscript.path}/build-linked.ld"
66
+ build.link_args.build-common="-Wl,-Map,{build.path}/{build.project_name}.map" -o "{build.path}/{build.project_name}_debug.elf"
67
+
68
+ build.check_command-llext={build.link_command} {build.link_args.check-llext} -o "{build.path}/{build.project_name}_check.tmp"
69
+ build.check_command-linked=
70
+ build.combine_command={build.link_command} {build.link_args.build-{build.link_mode}} {build.link_args.build-common}
71
+
58
72
upload.extension=elf-zsk.bin
59
73
postbuild_debug=
60
74
postbuild_mode=
@@ -99,7 +113,9 @@ recipe.S.o.pattern="{compiler.path}{compiler.S.cmd}" {compiler.S.flags} -DARDUIN
99
113
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}"
100
114
101
115
## Combine gc-sections, archives, and objects
102
- 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.common_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} -Wl,--start-group "{build.path}/{archive_file}" {compiler.zephyr} {compiler.zephyr.extra_ldflags} {compiler.libraries.ldflags} -Wl,--end-group
116
+ recipe.c.combine.1.pattern={build.check_command-{build.link_mode}}
117
+ recipe.c.combine.2.pattern={build.combine_command}
118
+ recipe.c.combine.pattern={build.combine_command}
103
119
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"
104
120
105
121
## Create eeprom
0 commit comments