Skip to content

Commit d54c66f

Browse files
keith-packardhenrikbrixandersen
authored andcommitted
hal_rpi_pico: Pass CONFIG_PICOLIBC to bootloader. Fix compile_options
Oops. #103436 tried to make the bootloader select the correct specs file using CONFIG_PICOLIBC, but that variable wasn't set while configuring the bootloader. Pass that from the Zephyr build into the bootloader build. This also uncovered a gap in the target_compile_options setting when picolibc is not the default C library -- the bootloader was getting linked with --specs=picolibc.specs but it wasn't getting compiled with that flag, so compilation was happening using the default C library headers. Signed-off-by: Keith Packard <keithp@keithp.com>
1 parent eb3a081 commit d54c66f

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

‎modules/hal_rpi_pico/CMakeLists.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ if(CONFIG_HAS_RPI_PICO)
3838
-DFLASH_TYPE=${flash_type}
3939
-DPYTHON_EXECUTABLE=${Python3_EXECUTABLE}
4040
-DRP2_BOOTLOADER_BYPRODUCT=${rp2_bootloader_asm}
41+
-DCONFIG_PICOLIBC=${CONFIG_PICOLIBC}
4142
INSTALL_COMMAND "" # No installation needed
4243
BUILD_BYPRODUCTS ${rp2_bootloader_asm}
4344
BUILD_ALWAYS TRUE

‎modules/hal_rpi_pico/bootloader/CMakeLists.txt‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,14 @@ target_include_directories(boot_stage2 PUBLIC
4545
)
4646

4747
if(CONFIG_PICOLIBC)
48-
set(boot_specs "picolibc.specs")
48+
target_compile_options(boot_stage2 PRIVATE "--specs=picolibc.specs")
49+
target_link_options(boot_stage2 PRIVATE "--specs=picolibc.specs")
4950
else()
50-
set(boot_specs "nosys.specs")
51+
target_link_options(boot_stage2 PRIVATE "--specs=nosys.specs")
5152
endif()
5253

5354
target_link_options(boot_stage2 PRIVATE
5455
"-nostartfiles"
55-
"--specs=${boot_specs}"
5656
"-T${boot_stage_dir}/boot_stage2.ld"
5757
)
5858

0 commit comments

Comments
 (0)