编译树莓派4环境下的rt-thread系统
交叉编译rt-thread
https://gitee.com/rtthread/rt-thread
准备
- 下载交叉编译链
https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-a/downloads
按说明下载(gcc-arm-8.3-2019.03-x86_64-aarch64-elf.tar.xz) - 下载源码
git clone https://gitee.com/rtthread
- 安装编译工具
sudo apt-get install scons
编译
将交叉编译工具链解压缩到对应目录或自定义目录,保证路径与rtconfig.py中的EXEC_PATH定义相同。
$ cd rtthread/bsp/raspberry-pi/raspi4-64
$ vi rtconfig.py
16 PLATFORM = 'gcc'
17 EXEC_PATH = r'/opt/gcc-arm-8.3-2019.03-x86_64-aarch64-elf/bin/'
$ scons
如果报错
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
scons: building associated VariantDir targets: build
CC build/applications/main.o
In file included from /media/wii/storage2/ros-dev/gcc-arm-8.3-2019.03-x86_64-aarch64-elf/aarch64-elf/include/signal.h:6,
from /media/wii/storage2/ros-dev/rt-thread/include/libc/libc_signal.h:72,
from /media/wii/storage2/ros-dev/rt-thread/include/rtlibc.h:21,
from /media/wii/storage2/ros-dev/rt-thread/include/rtdef.h:1103,
from /media/wii/storage2/ros-dev/rt-thread/include/rtthread.h:24,
from applications/main.c:11:
/media/wii/storage2/ros-dev/gcc-arm-8.3-2019.03-x86_64-aarch64-elf/aarch64-elf/include/sys/signal.h:42:7: error: redefinition of 'union sigval'
union sigval {
^~~~~~
In file included from /media/wii/storage2/ros-dev/rt-thread/include/rtlibc.h:21,
from /media/wii/storage2/ros-dev/rt-thread/include/rtdef.h:1103,
from /media/wii/storage2/ros-dev/rt-thread/include/rtthread.h:24,
from applications/main.c:11:
/media/wii/storage2/ros-dev/rt-thread/include/libc/libc_signal.h:28:7: note: originally defined here
union sigval
^~~~~~
In file included from /media/wii/storage2/ros-dev/gcc-arm-8.3-2019.03-x86_64-aarch64-elf/aarch64-elf/include/signal.h:6,
from /media/wii/storage2/ros-dev/rt-thread/include/libc/libc_signal.h:72,
from /media/wii/storage2/ros-dev/rt-thread/include/rtlibc.h:21,
from /media/wii/storage2/ros-dev/rt-thread/include/rtdef.h:1103,
from /media/wii/storage2/ros-dev/rt-thread/include/rtthread.h:24,
from applications/main.c:11:
/media/wii/storage2/ros-dev/gcc-arm-8.3-2019.03-x86_64-aarch64-elf/aarch64-elf/include/sys/signal.h:47:8: error: redefinition of 'struct sigevent'
struct sigevent {
^~~~~~~~
In file included from /media/wii/storage2/ros-dev/rt-thread/include/rtlibc.h:21,
from /media/wii/storage2/ros-dev/rt-thread/include/rtdef.h:1103,
from /media/wii/storage2/ros-dev/rt-thread/include/rtthread.h:24,
from applications/main.c:11:
/media/wii/storage2/ros-dev/rt-thread/include/libc/libc_signal.h:36:8: note: originally defined here
struct sigevent
^~~~~~~~
In file included from /media/wii/storage2/ros-dev/gcc-arm-8.3-2019.03-x86_64-aarch64-elf/aarch64-elf/include/signal.h:6,
from /media/wii/storage2/ros-dev/rt-thread/include/libc/libc_signal.h:72,
from /media/wii/storage2/ros-dev/rt-thread/include/rtlibc.h:21,
from /media/wii/storage2/ros-dev/rt-thread/include/rtdef.h:1103,
from /media/wii/storage2/ros-dev/rt-thread/include/rtthread.h:24,
from applications/main.c:11:
/media/wii/storage2/ros-dev/gcc-arm-8.3-2019.03-x86_64-aarch64-elf/aarch64-elf/include/sys/signal.h:72:3: error: conflicting types for 'siginfo_t'
} siginfo_t;
^~~~~~~~~
In file included from /media/wii/storage2/ros-dev/rt-thread/include/rtlibc.h:21,
from /media/wii/storage2/ros-dev/rt-thread/include/rtdef.h:1103,
from /media/wii/storage2/ros-dev/rt-thread/include/rtthread.h:24,
from applications/main.c:11:
/media/wii/storage2/ros-dev/rt-thread/include/libc/libc_signal.h:55:24: note: previous declaration of 'siginfo_t' was here
typedef struct siginfo siginfo_t;
^~~~~~~~~
scons: *** [build/applications/main.o] Error 1
scons: building terminated because of errors.
则执行
$ scons -c
$ scons 重新编译
编译成功生成三个文件
文件 | 说明 |
---|---|
rtthread.bin | |
rtthread.elf | |
rtthread.map |