Skip to content

hello_world fails to build for rpi_pico2 #85217

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
samblenny opened this issue Feb 5, 2025 · 9 comments
Closed

hello_world fails to build for rpi_pico2 #85217

samblenny opened this issue Feb 5, 2025 · 9 comments
Assignees
Labels
bug The issue is a bug, or the PR is fixing a bug platform: Raspberry Pi Pico Raspberry Pi Pico (RPi Pico) priority: low Low impact/importance bug Stale

Comments

@samblenny
Copy link

samblenny commented Feb 5, 2025

Describe the bug

west build -p always -b rpi_pico2/rp2350a/m33 samples/hello_world fails during linking.

Error messages include:

  • "FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map /home/sam/code/zephyr-workspace/zephyr/build/zephyr/zephyr_pre0.map"
  • "...conflicting CPU architectures 17/2"
  • "...failed to merge target specific data of file..."

(see console log section below for additional details)

I get similar errors if I attempt to build other samples including samples/basic/blinky and samples/basic/minimal.

Target platform: Raspberry Pi Pico 2

Diagnosis: Searching for similar error messages comes up with discussions of an ABI mismatch between code compiled with ARM soft floating point and hard floating point.

I do not know if this is a regression or not.

To Reproduce

  1. Prepare Zephyr workspace with zephyr commit d3d7e18 and zephyr-sdk-0.17.0
  2. cd zephyr
  3. west build -p always -b rpi_pico2/rp2350a/m33 samples/hello_world

Expected behavior

The west build ... command should finish without errors.

Impact

It may be the case that building anything for rpi_pico2 is currently broken?

Logs and console output

(.venv) $ west build -p always -b rpi_pico2/rp2350a/m33 samples/hello_world
-- west build: making build dir /home/sam/code/zephyr-workspace/zephyr/build pristine
-- west build: generating a build system
Loading Zephyr default modules (Zephyr base).
-- Application: /home/sam/code/zephyr-workspace/zephyr/samples/hello_world
-- CMake version: 3.25.1
-- Found Python3: /home/sam/code/zephyr-workspace/.venv/bin/python3 (found suitable version "3.11.2", minimum required is "3.10") found components: Interpreter 
-- Cache files will be written to: /home/sam/.cache/zephyr
-- Zephyr version: 4.0.99 (/home/sam/code/zephyr-workspace/zephyr)
-- Found west (found suitable version "1.3.0", minimum required is "0.14.0")
-- Board: rpi_pico2, qualifiers: rp2350a/m33
-- ZEPHYR_TOOLCHAIN_VARIANT not set, trying to locate Zephyr SDK
-- Found host-tools: zephyr 0.17.0 (/home/sam/zephyr-sdk-0.17.0)
-- Found toolchain: zephyr 0.17.0 (/home/sam/zephyr-sdk-0.17.0)
-- Found Dtc: /home/sam/zephyr-sdk-0.17.0/sysroots/x86_64-pokysdk-linux/usr/bin/dtc (found suitable version "1.6.0", minimum required is "1.4.6") 
-- Found BOARD.dts: /home/sam/code/zephyr-workspace/zephyr/boards/raspberrypi/rpi_pico2/rpi_pico2_rp2350a_m33.dts
-- Generated zephyr.dts: /home/sam/code/zephyr-workspace/zephyr/build/zephyr/zephyr.dts
-- Generated pickled edt: /home/sam/code/zephyr-workspace/zephyr/build/zephyr/edt.pickle
-- Generated devicetree_generated.h: /home/sam/code/zephyr-workspace/zephyr/build/zephyr/include/generated/zephyr/devicetree_generated.h
-- Including generated dts.cmake file: /home/sam/code/zephyr-workspace/zephyr/build/zephyr/dts.cmake
Parsing /home/sam/code/zephyr-workspace/zephyr/Kconfig
Loaded configuration '/home/sam/code/zephyr-workspace/zephyr/boards/raspberrypi/rpi_pico2/rpi_pico2_rp2350a_m33_defconfig'
Merged configuration '/home/sam/code/zephyr-workspace/zephyr/samples/hello_world/prj.conf'
Configuration saved to '/home/sam/code/zephyr-workspace/zephyr/build/zephyr/.config'
Kconfig header saved to '/home/sam/code/zephyr-workspace/zephyr/build/zephyr/include/generated/zephyr/autoconf.h'
-- Found GnuLd: /home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/arm-zephyr-eabi/bin/ld.bfd (found version "2.38") 
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- The ASM compiler identification is GNU
-- Found assembler: /home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
-- Using ccache: /usr/bin/ccache
-- Configuring done
-- Generating done
-- Build files have been written to: /home/sam/code/zephyr-workspace/zephyr/build
-- west build: building application
[1/138] Preparing syscall dependency handling

[2/138] Generating include/generated/zephyr/version.h
-- Zephyr version: 4.0.99 (/home/sam/code/zephyr-workspace/zephyr), build: d3d7e185babb
[133/138] Linking C executable zephyr/zephyr_pre0.elf
FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map /home/sam/code/zephyr-workspace/zephyr/build/zephyr/zephyr_pre0.map 
: && ccache /home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc  -gdwarf-4 zephyr/CMakeFiles/zephyr_pre0.dir/misc/empty_file.c.obj -o zephyr/zephyr_pre0.elf  zephyr/CMakeFiles/offsets.dir/./arch/arm/core/offsets/offsets.c.obj  -T  zephyr/linker_zephyr_pre0.cmd  -Wl,-Map=/home/sam/code/zephyr-workspace/zephyr/build/zephyr/zephyr_pre0.map  -Wl,--whole-archive  app/libapp.a  zephyr/libzephyr.a  zephyr/arch/common/libarch__common.a  zephyr/arch/arch/arm/core/libarch__arm__core.a  zephyr/arch/arch/arm/core/cortex_m/libarch__arm__core__cortex_m.a  zephyr/arch/arch/arm/core/cortex_m/cmse/libarch__arm__core__cortex_m__cmse.a  zephyr/lib/libc/picolibc/liblib__libc__picolibc.a  zephyr/lib/libc/common/liblib__libc__common.a  zephyr/soc/soc/rp2350a/rp2350/libsoc__raspberrypi__rpi_pico__rp2350.a  zephyr/drivers/clock_control/libdrivers__clock_control.a  zephyr/drivers/console/libdrivers__console.a  zephyr/drivers/gpio/libdrivers__gpio.a  zephyr/drivers/pinctrl/libdrivers__pinctrl.a  zephyr/drivers/reset/libdrivers__reset.a  zephyr/drivers/serial/libdrivers__serial.a  zephyr/drivers/timer/libdrivers__timer.a  modules/hal_rpi_pico/libmodules__hal_rpi_pico.a  -Wl,--no-whole-archive  zephyr/kernel/libkernel.a  -L/home/sam/code/zephyr-workspace/zephyr/build/zephyr  zephyr/arch/common/libisr_tables.a  -Wl,--gc-sections  -Wl,--build-id=none  -Wl,--sort-common=descending  -Wl,--sort-section=alignment  -Wl,-u,_OffsetAbsSyms  -Wl,-u,_ConfigAbsSyms  -nostdlib  -static  -Wl,-X  -Wl,-N  -Wl,--orphan-handling=warn  -Wl,-no-pie  -specs=picolibc.specs  -DPICOLIBC_LONG_LONG_PRINTF_SCANF -L"/home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/thumb/v8-m.main/nofp" -lc -lgcc && cd /home/sam/code/zephyr-workspace/zephyr/build/zephyr && /usr/bin/cmake -E true
/home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld: error: /home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/../../picolibc/arm-zephyr-eabi/lib/./libc.a(strcmp.S.o): conflicting CPU architectures 17/2
/home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld: failed to merge target specific data of file /home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/../../picolibc/arm-zephyr-eabi/lib/./libc.a(strcmp.S.o)
/home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld: error: /home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/../../picolibc/arm-zephyr-eabi/lib/./libc.a(memcpy.c.o): conflicting CPU architectures 17/2
/home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld: failed to merge target specific data of file /home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/../../picolibc/arm-zephyr-eabi/lib/./libc.a(memcpy.c.o)
/home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld: error: /home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/../../picolibc/arm-zephyr-eabi/lib/./libc.a(memset.c.o): conflicting CPU architectures 17/2
/home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld: failed to merge target specific data of file /home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/../../picolibc/arm-zephyr-eabi/lib/./libc.a(memset.c.o)
/home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld: error: /home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/../../picolibc/arm-zephyr-eabi/lib/./libc.a(strlen.c.o): conflicting CPU architectures 17/2
/home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld: failed to merge target specific data of file /home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/../../picolibc/arm-zephyr-eabi/lib/./libc.a(strlen.c.o)
/home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld: error: /home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/../../picolibc/arm-zephyr-eabi/lib/./libc.a(libc_errno_errno.c.o): conflicting CPU architectures 17/2
/home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld: failed to merge target specific data of file /home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/../../picolibc/arm-zephyr-eabi/lib/./libc.a(libc_errno_errno.c.o)
/home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld: error: /home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/../../picolibc/arm-zephyr-eabi/lib/./libc.a(libc_string_strnlen.c.o): conflicting CPU architectures 17/2
/home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld: failed to merge target specific data of file /home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/../../picolibc/arm-zephyr-eabi/lib/./libc.a(libc_string_strnlen.c.o)
/home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld: error: /home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/../../picolibc/arm-zephyr-eabi/lib/./libc.a(libc_tinystdio_printf.c.o): conflicting CPU architectures 17/2
/home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld: failed to merge target specific data of file /home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/../../picolibc/arm-zephyr-eabi/lib/./libc.a(libc_tinystdio_printf.c.o)
/home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld: error: /home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/../../picolibc/arm-zephyr-eabi/lib/./libc.a(libc_tinystdio_puts.c.o): conflicting CPU architectures 17/2
/home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld: failed to merge target specific data of file /home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/../../picolibc/arm-zephyr-eabi/lib/./libc.a(libc_tinystdio_puts.c.o)
/home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld: error: /home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/../../picolibc/arm-zephyr-eabi/lib/./libc.a(libc_tinystdio_vflprintf.c.o): conflicting CPU architectures 17/2
/home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld: failed to merge target specific data of file /home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/../../picolibc/arm-zephyr-eabi/lib/./libc.a(libc_tinystdio_vflprintf.c.o)
/home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld: error: /home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/../../picolibc/arm-zephyr-eabi/lib/./libc.a(libc_tinystdio_vflscanf.c.o): conflicting CPU architectures 17/2
/home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld: failed to merge target specific data of file /home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/../../picolibc/arm-zephyr-eabi/lib/./libc.a(libc_tinystdio_vflscanf.c.o)
/home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld: error: /home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/../../picolibc/arm-zephyr-eabi/lib/./libc.a(libc_tinystdio_vprintf.c.o): conflicting CPU architectures 17/2
/home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld: failed to merge target specific data of file /home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/../../picolibc/arm-zephyr-eabi/lib/./libc.a(libc_tinystdio_vprintf.c.o)
/home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld: error: /home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/../../picolibc/arm-zephyr-eabi/lib/./libc.a(libc_string_strchr.c.o): conflicting CPU architectures 17/2
/home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld: failed to merge target specific data of file /home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/../../picolibc/arm-zephyr-eabi/lib/./libc.a(libc_string_strchr.c.o)
/home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld: error: /home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/../../picolibc/arm-zephyr-eabi/lib/./libc.a(libc_tinystdio_fgetc.c.o): conflicting CPU architectures 17/2
/home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld: failed to merge target specific data of file /home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/../../picolibc/arm-zephyr-eabi/lib/./libc.a(libc_tinystdio_fgetc.c.o)
/home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld: error: /home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/../../picolibc/arm-zephyr-eabi/lib/./libc.a(libc_tinystdio_ungetc.c.o): conflicting CPU architectures 17/2
/home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld: failed to merge target specific data of file /home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/../../picolibc/arm-zephyr-eabi/lib/./libc.a(libc_tinystdio_ungetc.c.o)
/home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld: error: /home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/../../picolibc/arm-zephyr-eabi/lib/./libc.a(libc_tinystdio_compare_exchange.c.o): conflicting CPU architectures 17/2
/home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld: failed to merge target specific data of file /home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/../../picolibc/arm-zephyr-eabi/lib/./libc.a(libc_tinystdio_compare_exchange.c.o)
/home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld: error: /home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/../../picolibc/arm-zephyr-eabi/lib/./libc.a(libc_tinystdio_exchange.c.o): conflicting CPU architectures 17/2
/home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld: failed to merge target specific data of file /home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/../../picolibc/arm-zephyr-eabi/lib/./libc.a(libc_tinystdio_exchange.c.o)
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: /usr/bin/cmake --build /home/sam/code/zephyr-workspace/zephyr/build

Environment (please complete the following information):

  • OS: Linux (Debian 12)
  • Toolchain: zephyr-sdk-0.17.0
  • Commit: d3d7e18

Additional context

For comparison, when I build for the Pi Pico with west build -p always -b rpi_pico samples/hello_world, it works fine.

@samblenny samblenny added the bug The issue is a bug, or the PR is fixing a bug label Feb 5, 2025
@henrikbrixandersen henrikbrixandersen added the platform: Raspberry Pi Pico Raspberry Pi Pico (RPi Pico) label Feb 5, 2025
@samblenny
Copy link
Author

samblenny commented Feb 5, 2025

I'm not an expert on tracking down this type of error, so I may be off the mark here. But, from what I can tell, the first error,

...picolibc/arm-zephyr-eabi/lib/./libc.a(strcmp.S.o): conflicting CPU architectures 17/2

is probably happening as a result of trying to link these two files:

  • zephyr/kernel/libkernel.a
  • zephyr-sdk-0.17.0/arm-zephyr-eabi/picolibc/arm-zephyr-eabi/lib/libc.a

I say that because, if I use grep to look for strcmp in build/zephyr/zephyr_pre0.map, I get this:

(.venv) $ grep strcmp build/zephyr/zephyr_pre0.map 
/home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/../../picolibc/arm-zephyr-eabi/lib/./libc.a(strcmp.S.o)
                              zephyr/kernel/libkernel.a(device.c.obj) (strcmp)
 .text          0x0000000000000000       0x1c /home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/../../picolibc/arm-zephyr-eabi/lib/./libc.a(strcmp.S.o)
 .data          0x0000000000000000        0x0 /home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/../../picolibc/arm-zephyr-eabi/lib/./libc.a(strcmp.S.o)
 .bss           0x0000000000000000        0x0 /home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/../../picolibc/arm-zephyr-eabi/lib/./libc.a(strcmp.S.o)
 .ARM.extab     0x0000000000000000        0x0 /home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/../../picolibc/arm-zephyr-eabi/lib/./libc.a(strcmp.S.o)
 .ARM.exidx     0x0000000000000000        0x8 /home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/../../picolibc/arm-zephyr-eabi/lib/./libc.a(strcmp.S.o)
 .debug_frame   0x0000000000000000       0x20 /home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/../../picolibc/arm-zephyr-eabi/lib/./libc.a(strcmp.S.o)
                0x000000000000109a       0x1a /home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/../../picolibc/arm-zephyr-eabi/lib/./libc.a(strcmp.S.o)

When I use objdump to look at the picolibc file from the zephyr-sdk-0.17.0/arm-zephyr-eabi toolchain, I see it appears to have been compiled for armv4t:

(.venv) $ ~/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/arm-zephyr-eabi-objdump -f \
    ~/zephyr-sdk-0.17.0/arm-zephyr-eabi/picolibc/arm-zephyr-eabi/lib/libc.a | grep -A 4 strcmp.S.o
strcmp.S.o:     file format elf32-littlearm
architecture: armv4t, flags 0x00000011:
HAS_RELOC, HAS_SYMS
start address 0x00000000

When I look at libkernel.a, it seems to have been built for armv8-m.main

(.venv) $ ~/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/arm-zephyr-eabi-objdump -f \
    build/zephyr/kernel/libkernel.a | head -n 6
In archive build/zephyr/kernel/libkernel.a:

main_weak.c.obj:     file format elf32-littlearm
architecture: armv8-m.main, flags 0x00000011:
HAS_RELOC, HAS_SYMS
start address 0x00000000

@samblenny
Copy link
Author

If I build for Pi Pico, which links successfully, the architecture in build/zephyr/kernel/libkernel.a is armv6s-m:

(.venv) $ rm -r build/
(.venv) $ west build -p always -b rpi_pico samples/hello_world
...
(.venv) $ ~/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/arm-zephyr-eabi-objdump -f build/zephyr/kernel/libkernel.a | head -n 6
In archive build/zephyr/kernel/libkernel.a:

main_weak.c.obj:     file format elf32-littlearm
architecture: armv6s-m, flags 0x00000011:
HAS_RELOC, HAS_SYMS
start address 0x00000000

@samblenny
Copy link
Author

samblenny commented Feb 5, 2025

Maybe the problem is that west build is trying to link Cortex-M33 code for the Pico2 against the armv4t picolibc library that comes with zephyr-sdk-0.17.0/arm-zephyr-eabi. Perhaps it should instead build picolibc from source using the picolibc module?

@samblenny
Copy link
Author

If I turn on CONFIG_PICOLIBC_USE_MODULE, the hello_world sample builds successfully for rpi_pico2, like this:

(.venv) $ west build -p always -b rpi_pico2/rp2350a/m33 samples/hello_world -- -DCONFIG_PICOLIBC_USE_MODULE=y
...[irrelevant stuff edited out]...
-- west build: building application
[1/1095] Preparing syscall dependency handling

[6/1095] Generating include/generated/zephyr/version.h
-- Zephyr version: 4.0.99 (/home/sam/code/zephyr-workspace/zephyr), build: v4.0.0-4610-gb7cfa54c1837
[1095/1095] Linking C executable zephyr/zephyr.elf
Memory region         Used Size  Region Size  %age Used
 IMAGE_DEF_FLASH:          28 B        128 B     21.88%
           FLASH:       15716 B    4194048 B      0.37%
             RAM:        3968 B       520 KB      0.75%
        IDT_LIST:          0 GB        32 KB      0.00%
Generating files from /home/sam/code/zephyr-workspace/zephyr/build/zephyr/zephyr.elf for board: rpi_pico2
Converted to uf2, output size: 32256, start address: 0x10000000
Wrote 32256 bytes to zephyr.uf2

@xudongzheng
Copy link
Contributor

Did you upgrade your Zephyr SDK recently?

The error message seems quite similar to zephyrproject-rtos/sdk-ng#854, which was resolved with rm -rf ~/.cache.

@samblenny
Copy link
Author

samblenny commented Feb 5, 2025

Did you upgrade your Zephyr SDK recently?

No. For the development machine I've been using, 0.17.0 was the first and only Zephyr SDK version that I've installed. But, I did initially install the full SDK with all toolchains, delete that, and then switch to the minimal SDK with only the specific toolchains that I needed.

The error message seems quite similar to zephyrproject-rtos/sdk-ng#854, which was resolved with rm -rf ~/.cache.

Hmm... deleting the cache helps. When I tried this, the build worked:

rm -r ~/.cache/zephyr
rm -r build
west build -p always -b rpi_pico2/rp2350a/m33 samples/hello_world

This time, when I grep the map file for strcmp, it's looking in zephyr-sdk-0.17.0/arm-zephyr-eabi/picolibc/arm-zephyr-eabi/lib/thumb/v8-m.main/nofp/libc.a:

(.venv) $ grep strcmp build/zephyr/zephyr_pre0.map
/home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/../../picolibc/arm-zephyr-eabi/lib/thumb/v8-m.main/nofp/libc.a(strcmp.S.o)
                              zephyr/kernel/libkernel.a(device.c.obj) (strcmp)
 .text          0x0000000000000000       0x14 /home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/../../picolibc/arm-zephyr-eabi/lib/thumb/v8-m.main/nofp/libc.a(strcmp.S.o)
 .data          0x0000000000000000        0x0 /home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/../../picolibc/arm-zephyr-eabi/lib/thumb/v8-m.main/nofp/libc.a(strcmp.S.o)
 .bss           0x0000000000000000        0x0 /home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/../../picolibc/arm-zephyr-eabi/lib/thumb/v8-m.main/nofp/libc.a(strcmp.S.o)
 .ARM.extab     0x0000000000000000        0x0 /home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/../../picolibc/arm-zephyr-eabi/lib/thumb/v8-m.main/nofp/libc.a(strcmp.S.o)
 .ARM.exidx     0x0000000000000000        0x8 /home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/../../picolibc/arm-zephyr-eabi/lib/thumb/v8-m.main/nofp/libc.a(strcmp.S.o)
 .debug_frame   0x0000000000000000       0x20 /home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/../../picolibc/arm-zephyr-eabi/lib/thumb/v8-m.main/nofp/libc.a(strcmp.S.o)
                0x000000000000109a       0x20 /home/sam/zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/../../picolibc/arm-zephyr-eabi/lib/thumb/v8-m.main/nofp/libc.a(strcmp.S.o)

@fabiobaltieri fabiobaltieri added the priority: low Low impact/importance bug label Feb 11, 2025
@WilliamGFish
Copy link
Collaborator

Hello_world is not compiling for the RPi_Pico/rp2040/w...failure in 'sys_rand_get'

@soburi
Copy link
Member

soburi commented Mar 14, 2025

@WilliamGFish

Hello_world is not compiling for the RPi_Pico/rp2040/w...failure in 'sys_rand_get'

I've checked, and there are no issues.
Please create a new issue if necessary.

Copy link

This issue has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time.

@github-actions github-actions bot added the Stale label May 14, 2025
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug, or the PR is fixing a bug platform: Raspberry Pi Pico Raspberry Pi Pico (RPi Pico) priority: low Low impact/importance bug Stale
Projects
None yet
Development

No branches or pull requests

6 participants