Skip to content

Commit 27d9ef7

Browse files
Add library build and update via CLI
pico-sdk-lib/build.sh will compile a libpico.a file from scratch using the selected pico SDK directory.
1 parent 2a80cfa commit 27d9ef7

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed
250 KB
Binary file not shown.

pico-sdk-lib/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,13 @@ pico_stdlib
6262
pico_unique_id
6363
tinyusb
6464
)
65+
add_custom_command(TARGET pico PRE_BUILD
66+
COMMAND ../../system/arm-none-eabi/bin/arm-none-eabi-gcc -g -c ../../assembly/crt0.S -I ../../pico-sdk/src/rp2040/hardware_regs/include -I ../../pico-sdk/src/common/pico_binary_info/include/
67+
)
6568

6669
add_custom_command(TARGET pico POST_BUILD
67-
COMMAND ar dv libpico.a stdio_uart.c.obj stdio.c.obj printf.c.obj
70+
COMMAND ar d libpico.a crt0.S.obj
71+
COMMAND ar r libpico.a crt0.o
6872
)
73+
# COMMAND ar dv libpico.a stdio_uart.c.obj stdio.c.obj printf.c.obj
6974

platform.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ archive_file_path={build.path}/{archive_file}
106106
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}"
107107

108108
## Combine gc-sections, archives, and objects
109-
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.variant.path}/{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" --specs=nosys.specs {compiler.ldflags} -o "{build.path}/{build.project_name}.elf" {object_files} "{build.path}/{archive_file}" {runtime.platform.path}/lib/pico.a -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/bs2_default_padded_checksummed.S
109+
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.variant.path}/{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" --specs=nosys.specs {compiler.ldflags} -o "{build.path}/{build.project_name}.elf" {object_files} "{build.path}/{archive_file}" {runtime.platform.path}/lib/libpico.a -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/bs2_default_padded_checksummed.S
110110

111111
## Create output (UF2 file)
112112
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)