RT-Thread / RT-Thread/rt-thread

[Bug][BSP][Pico] generate_headers.py fails to find arm-none-eabi-gcc on Linux/WSL

Open
#11,206 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
12.2k
Forks
5.4k
Avg merge
4d 12h
Merged PRs (30d)
40

Description

RT-Thread Version

latest master branch: 85b656b14dcfe8a3ab27c819e168dde082ab39ef

Hardware Type/Architectures

RP2040

Develop Toolchain

GCC

Describe the bug
  1. clone rt-thread
wight@LAPTOP-I3HTH5KO:~/pico/pico/embeddedproject$ git clone https://github.com/RT-Thread/rt-thread.git
  1. clone env
dwight@LAPTOP-I3HTH5KO:~/pico/pico/embeddedproject$ git clone https://github.com/RT-Thread/env
  1. Install for ubuntu (using ubuntu via wsl)
dwight@LAPTOP-I3HTH5KO:~/pico/pico/embeddedproject/env$ ./install_ubuntu.sh

Source the environment script.

source ~/.env/env.sh

cd into the rp2040 folder and download the pico sdk with the now available pkgs command.

dwight@LAPTOP-I3HTH5KO:~/pico/pico/embeddedproject/rt-thread/bsp/raspberry-pico/RP2040$ pkgs --update
[Use Github server - default GitHub (no env .config)]
Cloning into '/home/dwight/pico/pico/embeddedproject/rt-thread/bsp/raspberry-pico/RP2040/packages/raspberrypi-pico-sdk-latest'...
remote: Enumerating objects: 7517, done.
remote: Counting objects: 100% (1101/1101), done.
remote: Compressing objects: 100% (243/243), done.
remote: Total 7517 (delta 875), reused 858 (delta 858), pack-reused 6416 (from 1)
Receiving objects: 100% (7517/7517), 2.74 MiB | 4.19 MiB/s, done.
Resolving deltas: 100% (4054/4054), done.
remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0)
From https://github.com/RT-Thread-packages/raspberrypi-pico-sdk
 * branch            master     -> FETCH_HEAD
==============================>  RASPBERRYPI_PICO_SDK latest is downloaded successfully.

/home/dwight/pico/pico/embeddedproject/rt-thread/bsp/raspberry-pico/RP2040/packages/raspberrypi-pico-sdk-latest
==============================>  raspberrypi-pico-sdk update done

Operation completed successfully.

6,

scons -c

dwight@LAPTOP-I3HTH5KO:~/pico/pico/embeddedproject/rt-thread/bsp/raspberry-pico/RP2040$ scons -c
scons: Reading SConscript files ...
Newlib version: 3.3.0
Enter /home/dwight/pico/pico/embeddedproject/rt-thread/bsp/raspberry-pico/RP2040/packages/raspberrypi-pico-sdk-latest
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Cleaning targets ...
scons: done cleaning targets.
scons: done reading SConscript files.
scons: Cleaning targets ...
scons: done cleaning targets.

scons cannot find arm-none-eabi-gcc:

dwight@LAPTOP-I3HTH5KO:~/pico/pico/embeddedproject/rt-thread/bsp/raspberry-pico/RP2040$ scons
scons: Reading SConscript files ...
Newlib version: 3.3.0
Enter /home/dwight/pico/pico/embeddedproject/rt-thread/bsp/raspberry-pico/RP2040/packages/raspberrypi-pico-sdk-latest
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
python3 tools/generate_headers.py
arm-none-eabi-gcc -DPICO_BOARD="pico" -DPICO_BUILD=1 -DPICO_NO_HARDWARE=0 -DDPICO_ON_DEVICE=1 -Isrc/rp2_common/boot_stage2/asminclude -Isrc/rp2040/hardware_regs/include -Isrc/rp2_common/hardware_base/include -Isrc/common/pico_base/include -Isrc/boards/include -Isrc/rp2_common/pico_platform/include -Isrc/rp2_common/boot_stage2/include -Isrc/boards/include -c -o src/rp2_common/boot_stage2/compile_time_choice.o src/rp2_common/boot_stage2/compile_time_choice.S
sh: 1: arm-none-eabi-gcc: not found
scons: *** [src/rp2_common/boot_stage2/compile_time_choice.o] Error 127
scons: building terminated because of errors.
scons: done reading SConscript files.
scons: Building targets ...
scons: building associated VariantDir targets: build
CC build/applications/main.o
CC build/board/board.o
CC build/kernel/components/drivers/core/device.o
CC build/kernel/components/drivers/ipc/completion_comm.o
CC build/kernel/components/drivers/ipc/completion_up.o
CC build/kernel/components/drivers/ipc/condvar.o
CC build/kernel/components/drivers/ipc/dataqueue.o
CC build/kernel/components/drivers/ipc/pipe.o
CC build/kernel/components/drivers/ipc/ringblk_buf.o
CC build/kernel/components/drivers/ipc/ringbuffer.o
CC build/kernel/components/drivers/ipc/waitqueue.o
CC build/kernel/components/drivers/ipc/workqueue.o
CC build/kernel/components/drivers/pin/dev_pin.o
CC build/kernel/components/drivers/serial/dev_serial.o
CC build/kernel/components/finsh/cmd.o
CC build/kernel/components/finsh/msh.o
CC build/kernel/components/finsh/msh_parse.o
CC build/kernel/components/finsh/shell.o
CC build/kernel/components/libc/compilers/common/cctype.o
CC build/kernel/components/libc/compilers/common/cstdlib.o
CC build/kernel/components/libc/compilers/common/cstring.o
CC build/kernel/components/libc/compilers/common/ctime.o
CC build/kernel/components/libc/compilers/common/cunistd.o
CC build/kernel/components/libc/compilers/common/cwchar.o
CC build/kernel/components/libc/compilers/newlib/syscalls.o
CC build/kernel/libcpu/arm/common/div0.o
CC build/kernel/libcpu/arm/common/showmem.o
CC build/kernel/src/clock.o
CC build/kernel/src/components.o
CC build/kernel/src/cpu_up.o
CC build/kernel/src/defunct.o
CC build/kernel/src/idle.o
CC build/kernel/src/ipc.o
CC build/kernel/src/irq.o
CC build/kernel/src/klibc/kerrno.o
CC build/kernel/src/klibc/kstdio.o
CC build/kernel/src/klibc/kstring.o
CC build/kernel/src/klibc/rt_vsnprintf_tiny.o
CC build/kernel/src/klibc/rt_vsscanf.o
CC build/kernel/src/kservice.o
CC build/kernel/src/mem.o
CC build/kernel/src/mempool.o
CC build/kernel/src/object.o
CC build/kernel/src/scheduler_comm.o
CC build/kernel/src/scheduler_up.o
CC build/kernel/src/thread.o
CC build/kernel/src/timer.o
AS build/libcpu/context_gcc.o
CC build/libcpu/cpuport.o
scons: *** [build/packages/raspberrypi-pico-sdk-latest/bs2_default_padded_checksummed.o] Source `packages/raspberrypi-pico-sdk-latest/bs2_default_padded_checksummed.S' not found, needed by target `build/packages/raspberrypi-pico-sdk-latest/bs2_default_padded_checksummed.o'.
scons: building terminated because of errors.

Even though arm-none-eabi-gcc is available on the path:

dwight@LAPTOP-I3HTH5KO:~/pico/pico/embeddedproject/rt-thread/bsp/raspberry-pico/RP2040$ which arm-none-eabi-gcc
/opt/arm-toolchain/arm-gnu-toolchain-15.2.rel1-x86_64-arm-none-eabi/bin/arm-none-eabi-gcc

dwight@LAPTOP-I3HTH5KO:~/pico/pico/embeddedproject/rt-thread/bsp/raspberry-pico/RP2040$ arm-none-eabi-gcc -v
Using built-in specs.
COLLECT_GCC=arm-none-eabi-gcc
COLLECT_LTO_WRAPPER=/opt/arm-toolchain/arm-gnu-toolchain-15.2.rel1-x86_64-arm-none-eabi/bin/../libexec/gcc/arm-none-eabi/15.2.1/lto-wrapper
Target: arm-none-eabi
Configured with: /data/jenkins/workspace/GNU-toolchain/arm-15/src/gcc/configure --target=arm-none-eabi --prefix=/data/jenkins/workspace/GNU-toolchain/arm-15/build-arm-none-eabi/install --with-gmp=/data/jenkins/workspace/GNU-toolchain/arm-15/build-arm-none-eabi/host-tools --with-mpfr=/data/jenkins/workspace/GNU-toolchain/arm-15/build-arm-none-eabi/host-tools --with-mpc=/data/jenkins/workspace/GNU-toolchain/arm-15/build-arm-none-eabi/host-tools --with-isl=/data/jenkins/workspace/GNU-toolchain/arm-15/build-arm-none-eabi/host-tools --disable-shared --disable-nls --disable-threads --enable-checking=release --enable-languages=c,c++,fortran --with-newlib --with-gnu-as --with-headers=yes --with-gnu-ld --with-native-system-header-dir=/include --with-sysroot=/data/jenkins/workspace/GNU-toolchain/arm-15/build-arm-none-eabi/install/arm-none-eabi --with-bugurl=https://gitlab.arm.com/tooling/gnu-devtools-for-arm/-/issues/ --with-multilib-list=aprofile,rmprofile --with-pkgversion='Arm GNU Toolchain 15.2.Rel1 (Build arm-15.86)'
Thread model: single
Supported LTO compression algorithms: zlib zstd
gcc version 15.2.1 20251203 (Arm GNU Toolchain 15.2.Rel1 (Build arm-15.86))

Workaround:

Okay apparently as I figured out RT-Thread requires the arm cross compiler to be inside /usr/bin.

I thought by going into the rtconfig.py and changing the exec path

# EXEC_PATH is the compiler execute path, for example, CodeSourcery, Keil MDK, IAR
if  CROSS_TOOL == 'gcc':
    PLATFORM    = 'gcc'
    #EXEC_PATH   = r'/usr/bin'
    EXEC_PATH = r'/opt/arm-toolchain/arm-gnu-toolchain-15.2.rel1-x86_64-arm-none-eabi/bin/' 

That I could make it work.
But that was not the case.

Some other part of the program is dependent on that it is inside /usr/bin/

So what ended up working was to set up symlinks in /usr/bin

 sudo ln -s /opt/arm-toolchain/arm-gnu-toolchain-15.2.rel1-x86_64-arm-none-eabi/bin/arm-none-eabi-* /usr/bin/

Since arm no longer updates the apt packages, but rather the new arm toolchain has to be installed via arms webpage, I put it in /opt/ to keep it separated from the apt installed packages.

What would be nice is a global configuration option. Like setting the EXEC_PATH.

Other additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with tools/generate_headers.py and the RP2040 rtconfig.py, then reproduce the failure with scons using the toolchain installed outside /usr/bin. Trace where the compiler path is selected and verify that the configured EXEC_PATH is honored without symlinks. Done means the RP2040 build completes with the documented external toolchain layout.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, python
Domain
build-system, embedded-iot
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.