Skip to content

Commit 39d1a28

Browse files
Rationalize link stage command line (earlephilhower#143)
1 parent 7dc0aa1 commit 39d1a28

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

platform.txt

+9-3
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,12 @@ compiler.defines={build.led}
4242
compiler.includes="-iprefix{runtime.platform.path}/" "@{runtime.platform.path}/lib/platform_inc.txt"
4343
compiler.flags=-Os -march=armv6-m -mcpu=cortex-m0plus -mthumb -ffunction-sections -fdata-sections -fno-exceptions
4444
compiler.wrap="@{runtime.platform.path}/lib/platform_wrap.txt"
45+
compiler.libpico="{runtime.platform.path}/lib/libpico.a"
4546

4647
compiler.c.cmd=arm-none-eabi-gcc
4748
compiler.c.flags=-c {compiler.defines} {compiler.flags} {compiler.includes} -std=gnu17 -g
4849
compiler.c.elf.cmd=arm-none-eabi-g++
49-
compiler.c.elf.flags={compiler.defines} {compiler.flags} -Wl,--gc-sections -u _printf_float -u _scanf_float
50+
compiler.c.elf.flags={compiler.defines} {compiler.flags} -u _printf_float -u _scanf_float
5051
compiler.S.cmd=arm-none-eabi-gcc
5152
compiler.S.flags=-c -g -x assembler-with-cpp -MMD {compiler.includes} -g
5253
compiler.cpp.cmd=arm-none-eabi-g++
@@ -107,9 +108,14 @@ recipe.S.o.pattern="{compiler.path}{compiler.S.cmd}" {compiler.S.flags} {build.u
107108
archive_file_path={build.path}/{archive_file}
108109
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}"
109110

110-
## Combine gc-sections, archives, and objects
111+
## Generate the linker map with specific flash sizes/locations
111112
recipe.hooks.linking.prelink.1.pattern="{runtime.tools.pqt-python3.path}/python3" "{runtime.platform.path}/tools/simplesub.py" --input "{runtime.platform.path}/lib/memmap_default.ld" --out "{build.path}/memmap_default.ld" --sub __FLASH_LENGTH__ {build.flash_length} --sub __EEPROM_START__ {build.eeprom_start} --sub __FS_START__ {build.fs_start} --sub __FS_END__ {build.fs_end}
112-
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" "-L{build.path}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} "-Wl,--script={build.path}/memmap_default.ld" "-Wl,-Map,{build.path}/{build.project_name}.map" --specs=nosys.specs -Wl,--as-needed -Wl,--start-group {compiler.ldflags} -o "{build.path}/{build.project_name}.elf" {object_files} "{build.path}/{archive_file}" -Wl,--whole-archive "{runtime.platform.path}/lib/libpico.a" -Wl,--no-whole-archive -lm "-I{runtime.platform.path}/pico-sdk/src/rp2040/hardware_regs/include/" "-I{runtime.platform.path}/pico-sdk/src/common/pico_binary_info/include" "{runtime.platform.path}/assembly/{build.boot2}.S" -lc -lstdc++ -Wl,--end-group
113+
114+
## Compile the boot stage 2 blob
115+
recipe.hooks.linking.prelink.2.pattern="{compiler.path}{compiler.S.cmd}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} -c "{runtime.platform.path}/assembly/{build.boot2}.S" "-I{runtime.platform.path}/pico-sdk/src/rp2040/hardware_regs/include/" "-I{runtime.platform.path}/pico-sdk/src/common/pico_binary_info/include" -o "{build.path}/boot2.o"
116+
117+
## Combine gc-sections, archives, and objects
118+
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" "-L{build.path}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} {compiler.ldflags} "-Wl,--script={build.path}/memmap_default.ld" "-Wl,-Map,{build.path}/{build.project_name}.map" -o "{build.path}/{build.project_name}.elf" -Wl,--start-group {object_files} "{build.path}/{archive_file}" "{build.path}/boot2.o" {compiler.libpico} -lm -lc -lstdc++ -lc -Wl,--end-group
113119

114120
## Create output (UF2 file)
115121
recipe.objcopy.uf2.pattern="{runtime.tools.pqt-elf2uf2.path}/elf2uf2" "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.uf2"

0 commit comments

Comments
 (0)