Toggle navigation
首页
问答
文章
积分商城
专家
专区
更多专区...
文档中心
返回主站
搜索
提问
会员
中心
登录
注册
开发环境
编译
ubuntu20搭建rtthead5.2.0开发环境
发布于 2025-06-09 12:16:03 浏览:150
订阅该版
[tocm] ## 下载 [gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2][https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu-rm/10.3-2021.10/gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2] [rt-thread_v5.2.0][https://codeload.github.com/RT-Thread/rt-thread/tar.gz/refs/tags/v5.2.0] [ubuntu-20.04.6-desktop-amd64.iso][https://mirrors.tuna.tsinghua.edu.cn/ubuntu-releases/20.04.6/ubuntu-20.04.6-desktop-amd64.iso] 目录 ```shell evan@evan-vpc:~/work$ tree -L 2 . ├── rt-thread-5.2.0 │ ├── bsp │ ├── ChangeLog.md │ ├── components │ ├── documentation │ ├── examples │ ├── include │ ├── Kconfig │ ├── libcpu │ ├── LICENSE │ ├── README_de.md │ ├── README_es.md │ ├── README.md │ ├── README_zh.md │ ├── src │ └── tools ├── rt-thread-5.2.0.tar.gz └── tools ├── gcc-arm-none-eabi-10.3-2021.10 └── gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2 11 directories, 9 files ``` ```shell sudo apt install git ``` ## 编译器 ```shell # ~/.bashrc export PATH=/home/evan/work/tools/gcc-arm-none-eabi-10.3-2021.10/bin:$PATH ``` ```shell $ arm-none-eabi-gcc -v Using built-in specs. COLLECT_GCC=arm-none-eabi-gcc COLLECT_LTO_WRAPPER=/home/evan/work/tools/gcc-arm-none-eabi-10.3-2021.10/bin/../lib/gcc/arm-none-eabi/10.3.1/lto-wrapper Target: arm-none-eabi Configured with: /mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-338_20211018_1634516203/src/gcc/configure --target=arm-none-eabi --prefix=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-338_20211018_1634516203/install-native --libexecdir=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-338_20211018_1634516203/install-native/lib --infodir=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-338_20211018_1634516203/install-native/share/doc/gcc-arm-none-eabi/info --mandir=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-338_20211018_1634516203/install-native/share/doc/gcc-arm-none-eabi/man --htmldir=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-338_20211018_1634516203/install-native/share/doc/gcc-arm-none-eabi/html --pdfdir=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-338_20211018_1634516203/install-native/share/doc/gcc-arm-none-eabi/pdf --enable-languages=c,c++ --enable-plugins --disable-decimal-float --disable-libffi --disable-libgomp --disable-libmudflap --disable-libquadmath --disable-libssp --disable-libstdcxx-pch --disable-nls --disable-shared --disable-threads --disable-tls --with-gnu-as --with-gnu-ld --with-newlib --with-headers=yes --with-python-dir=share/gcc-arm-none-eabi --with-sysroot=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-338_20211018_1634516203/install-native/arm-none-eabi --build=x86_64-linux-gnu --host=x86_64-linux-gnu --with-gmp=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-338_20211018_1634516203/build-native/host-libs/usr --with-mpfr=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-338_20211018_1634516203/build-native/host-libs/usr --with-mpc=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-338_20211018_1634516203/build-native/host-libs/usr --with-isl=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-338_20211018_1634516203/build-native/host-libs/usr --with-libelf=/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-338_20211018_1634516203/build-native/host-libs/usr --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --with-pkgversion='GNU Arm Embedded Toolchain 10.3-2021.10' --with-multilib-list=rmprofile,aprofile Thread model: single Supported LTO compression algorithms: zlib gcc version 10.3.1 20210824 (release) (GNU Arm Embedded Toolchain 10.3-2021.10) ``` ## scons工具 ```shell $ python3 --version Python 3.8.10 $ sudo apt install python3-pip $ sudo pip3 install scons==4.9.1 $ scons -v SCons by Steven Knight et al.: SCons: v4.9.1.39a12f34d532ab2493e78a7b73aeab2250852790, Thu, 27 Mar 2025 11:44:24 -0700, by bdbaddog on M1Dog2021 SCons path: ['/usr/local/lib/python3.8/dist-packages/SCons'] Copyright (c) 2001 - 2025 The SCons Foundation ``` ## 编译 ```shell $ pip3 install kconfiglib ``` ```shell $ cd ~/work/rt-thread-5.2.0/bsp/stm32 $ cp -r libraries/templates/stm32f4xx/ ./ $ cd stm32f4xx/ ``` 删除无用文件 ```shell evan@evan-vpc:~/work/rt-thread-5.2.0/bsp/stm32/stm32f4xx$ git status 位于分支 master 尚未暂存以备提交的变更: (使用 "git add/rm <文件>..." 更新要提交的内容) (使用 "git restore <文件>..." 丢弃工作区的改动) 删除: project.ewd 删除: project.ewp 删除: project.eww 删除: project.uvopt 删除: project.uvoptx 删除: project.uvproj 删除: project.uvprojx 删除: template.ewp 删除: template.eww 删除: template.uvopt 删除: template.uvoptx 删除: template.uvproj 删除: template.uvprojx 修改尚未加入提交(使用 "git add" 和/或 "git commit -a") ``` 首次使用需要刷新`.config` ```shell $ scons --menuconfig scons: Reading SConscript files ... **ERROR**: Failed to import kconfiglib, No module named 'kconfiglib' You may need to install it using: pip install kconfiglib ``` ```shell $ pip3 install kconfiglib ``` ```shell $ scons scons: Reading SConscript files ... Error: the toolchain path (C:\Users\XXYYZZ) is not exist, please check 'EXEC_PATH' in path or rtconfig.py. ``` ```diff $ git diff diff --git a/bsp/stm32/stm32f4xx/rtconfig.py b/bsp/stm32/stm32f4xx/rtconfig.py index 5e5bc020..ba43f369 100644 --- a/bsp/stm32/stm32f4xx/rtconfig.py +++ b/bsp/stm32/stm32f4xx/rtconfig.py @@ -17,7 +17,7 @@ if os.getenv('RTT_ROOT'): # EXEC_PATH is the compiler execute path, for example, CodeSourcery, Keil MDK, IAR if CROSS_TOOL == 'gcc': PLATFORM = 'gcc' - EXEC_PATH = r'C:\Users\XXYYZZ' + EXEC_PATH = r'/home/evan/work/tools/gcc-arm-none-eabi-10.3-2021.10/bin' elif CROSS_TOOL == 'keil': PLATFORM = 'armcc' EXEC_PATH = r'C:/Keil_v5' ``` ```shell evan@evan-vpc:~/work/rt-thread-5.2.0/bsp/stm32/stm32f4xx$ scons scons: Reading SConscript files ... Newlib version: 4.1.0 scons: done reading SConscript files. scons: Building targets ... scons: building associated VariantDir targets: build CC build/applications/main.o CC /home/evan/work/rt-thread-5.2.0/bsp/stm32/libraries/HAL_Drivers/drivers/drv_usart.o AS /home/evan/work/rt-thread-5.2.0/bsp/stm32/libraries/STM32F4xx_HAL/CMSIS/Device/ST/STM32F4xx/Source/Templates/gcc/startup_stm32f407xx.o LINK rt-thread.elf Memory region Used Size Region Size %age Used ROM: 76228 B 1 MB 7.27% RAM: 4584 B 128 KB 3.50% arm-none-eabi-objcopy -O binary rt-thread.elf rtthread.bin arm-none-eabi-size rt-thread.elf text data bss dec hex filename 76228 1876 2704 80808 13ba8 rt-thread.elf scons: done building targets. ... ``` ## cmake编译 ```shell sudo apt install cmake ``` ```shell $ cd ~/work/rt-thread-5.2.0/bsp/stm32/stm32f4xx $ scons --target=cmake scons: Reading SConscript files ... Newlib version: 4.1.0 Update setting files for CMakeLists.txt... Cannot find the param of the c standard in build flag, set to default 11 Cannot find the param of the cpp standard in build flag, set to default 17 Done! $ mkdir cmake_build $ cmake .. ``` ```shell evan@evan-vpc:~/work/rt-thread-5.2.0/bsp/stm32/stm32f4xx/cmake_build$ cmake .. -- The C compiler identification is GNU 10.3.1 -- The CXX compiler identification is GNU 10.3.1 -- The ASM compiler identification is GNU -- Found assembler: /home/evan/work/tools/gcc-arm-none-eabi-10.3-2021.10/bin/arm-none-eabi-gcc -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Configuring done -- Generating done -- Build files have been written to: /home/evan/work/rt-thread-5.2.0/bsp/stm32/stm32f4xx/cmake_build evan@evan-vpc:~/work/rt-thread-5.2.0/bsp/stm32/stm32f4xx/cmake_build$ make Scanning dependencies of target rtt_DeviceDrivers [ 1%] Building C object CMakeFiles/rtt_DeviceDrivers.dir/home/evan/work/rt-thread-5.2.0/components/drivers/core/device.c.obj [ 2%] Building C object CMakeFiles/rtt_DeviceDrivers.dir/home/evan/work/rt-thread-5.2.0/components/drivers/ipc/completion_comm.c.obj ... [ 97%] Building C object CMakeFiles/rtt_libcpu.dir/home/evan/work/rt-thread-5.2.0/libcpu/arm/cortex-m4/cpuport.c.obj [ 97%] Built target rtt_libcpu Scanning dependencies of target rtthread.elf [ 98%] Building C object CMakeFiles/rtthread.elf.dir/applications/main.c.obj [100%] Linking C executable rtthread.elf Memory region Used Size Region Size %age Used ROM: 76276 B 1 MB 7.27% RAM: 4584 B 128 KB 3.50% text data bss dec hex filename 76276 1876 2704 80856 13bd8 rtthread.elf [100%] Built target rtthread.elf evan@evan-vpc:~/work/rt-thread-5.2.0/bsp/stm32/stm32f4xx/cmake_build$ evan@evan-vpc:~/work/rt-thread-5.2.0/bsp/stm32/stm32f4xx/cmake_build$ ls CMakeCache.txt CMakeFiles cmake_install.cmake Makefile rtthread.bin rtthread.elf rt-thread.map ``` ## 打包项目 ```shell evan@evan-vpc:~/work/rt-thread-5.2.0/bsp/stm32/stm32f4xx$ scons --target=cmake scons: Reading SConscript files ... Newlib version: 4.1.0 Update setting files for CMakeLists.txt... Cannot find the param of the c standard in build flag, set to default 11 Cannot find the param of the cpp standard in build flag, set to default 17 Done! evan@evan-vpc:~/work/rt-thread-5.2.0/bsp/stm32/stm32f4xx$ scons --dist --project_name=my_project scons: Reading SConscript files ... Newlib version: 4.1.0 make distribution.... => stm32f4xx => start dist handle => copy stm32 bsp library => copy bsp drivers => components => include => libcpu => src => tools Update configuration files... suggest to use command scons --dist [--target=xxx] [--project-name="xxx"] [--project-path="xxx"] dist project successfully! evan@evan-vpc:~/work/rt-thread-5.2.0/bsp/stm32/stm32f4xx$ tree dist -L 2 dist ├── project │ ├── applications │ ├── board │ ├── CMakeLists.txt │ ├── figures │ ├── Kconfig │ ├── libraries │ ├── __pycache__ │ ├── README.md │ ├── rtconfig.h │ ├── rtconfig.py │ ├── rt-thread │ ├── SConscript │ └── SConstruct └── project.zip 7 directories, 8 files ```
0
条评论
默认排序
按发布时间排序
登录
注册新账号
关于作者
橘长o
这家伙很懒,什么也没写!
文章
1
回答
1
被采纳
0
关注TA
发私信
相关文章
1
Rtthread-studio编译报错
2
编译及下载必要进程的名称
3
studio 命令行编译
4
BSP首次使用编译不过
5
ART-PI factory demo在gcc 9.3.1 上无法编译.
6
ART-PI中 ART-Pi_W25Q64.stldr是怎么制作和应用的
7
RT-Thread Studio编译操作失败
8
ART-PI的例子工程文件导入后编译不通过
9
如何选择只编译部分文件经验
10
lv7_rtthread_f1c100s编译问题
推荐文章
1
RT-Thread应用项目汇总
2
玩转RT-Thread系列教程
3
国产MCU移植系列教程汇总,欢迎查看!
4
机器人操作系统 (ROS2) 和 RT-Thread 通信
5
【技术三千问】之《玩转ART-Pi》,看这篇就够了!干货汇总
6
五分钟玩转RT-Thread新社区
7
关于STM32H7开发板上使用SDIO接口驱动SD卡挂载文件系统的问题总结
8
STM32的“GPU”——DMA2D实例详解
9
RT-Thread隐藏的宝藏之completion
10
【ART-PI】RT-Thread 开启RTC 与 Alarm组件
热门标签
RT-Thread Studio
串口
Env
LWIP
SPI
Bootloader
AT
Hardfault
CAN总线
ART-Pi
FinSH
DMA
USB
文件系统
RT-Thread
SCons
RT-Thread Nano
线程
MQTT
STM32
FAL
RTC
rt-smart
I2C_IIC
UART
cubemx
BSP
ESP8266
PWM
ota在线升级
WIZnet_W5500
packages_软件包
flash
freemodbus
GD32
潘多拉开发板_Pandora
ADC
编译报错
keil_MDK
定时器
flashDB
ulog
socket
rt_mq_消息队列_msg_queue
msh
中断
Debug
SFUD
C++_cpp
at_device
本月问答贡献
踩姑娘的小蘑菇
6
个答案
3
次被采纳
加缪
9
个答案
1
次被采纳
RTT_逍遥
5
个答案
1
次被采纳
用户名由3_15位
5
个答案
1
次被采纳
Ryan_CW
4
个答案
1
次被采纳
本月文章贡献
纯白酱
2
篇文章
3
次点赞
530china
1
篇文章
7
次点赞
rv666
1
篇文章
7
次点赞
踩姑娘的小蘑菇
1
篇文章
3
次点赞
Lipiah
1
篇文章
3
次点赞
回到
顶部
发布
问题
投诉
建议
回到
底部