ubuntu上搭建rtt开发环境并编译2K1000 bsp

系统介绍:

RT-Thread是一个集实时操作系统(RTOS)内核、中间件组件的物联网操作系统;

rt-thread特点:

资源占用极低,超低功耗设计,组件丰富,支持高性能应用,跨平台;类似vxWorks 6.8bsp;

参考书记:<<嵌入式实时操作系统:RT-Thread设计与实现>>rtt创始人熊谱翔编写;

rt-thread官网:

https://www.rt-thread.org/

源码地址:https://github.com/RT-Thread/rt-thread.git

重要配置文件:.git/config(url = https://github.com/RT-Thread/rt-thread.git);

源码目录文件

jdm@jdm:~/os/rt-thread/rt-thread$ ls
AUTHORS  
bsp //各个平台的工程目录
 ChangeLog.md  
components  //组件源码目录
documentation  //文档目录
examples  //测试用例目录
include  //头文件目录
Jenkinsfile  Kconfig  
libcpu  //存放各个平台底层启动程序,线程切换程序
LICENSE  README.md  README_zh.md  
src  //rtt内核源码目录
tools //脚本目录

针对体系结构的bsp介绍:

jdm@jdm:~/os/rt-thread/rt-thread/bsp/ls2kdev$ ls  //此为工程bsp目录
applications  应用层代码	
drivers  //rt-thread提供的底层驱动
figures  //此目录有loongsonpi的插图	
Kconfig  ls2k_ram.lds  
README.md  //应该关注的说明文档
rtconfig.h  rtconfig.py  SConscript  Sconstruct

ubuntu开发环境搭建:

安装qemu,命令如下:
sudo apt-get install qemu
安装scons,命令如下:
sudo apt-get install scons
安装 ncurses 库,使用命令:
sudo apt-get install libncurses5-dev

下面编译以龙芯2K1000为例:

1.参照README.md配置文件进行配置,主要是下载龙芯编译器,并配置rtconfig.py指定EXEC_PATH编译器路径;
2.配置完后,如果是刚安装的64位系统,会报错如下:

root@jdm:/home/jdm/os/rt-thread/rt-thread/bsp/ls2kdev# scons
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
scons: building associated VariantDir targets: build
CC build/applications/main.o
sh: 1: mips-sde-elf-gcc: not found
scons: *** [build/applications/main.o] Error 127
scons: building terminated because of errors.

此为未安装32位库的原因,安装即可,下面是ubuntu1604的安装命令:

sudo apt-get install lib32z1
sudo apt-get install lib32ncurses5

3.上述完后,可以直接通过scons编译工程,编译完如下:
在这里插入图片描述

也可以在编译之前通过scons –menuconfig配置驱动组件等,界面如下:
在这里插入图片描述在这里插入图片描述
启动rtt,在龙芯2k上进入pmon后加载编译好的rtthread.elf文件,然后输入g,即可进入rtt;
rtt系统命令:

msh />help
RT-Thread shell commands:
reboot           - reset cpu
poweroff         - shutdown cpu
list_fd          - list file descriptor
clear            - clear the terminal screen
version          - show RT-Thread version information
list_thread      - list thread
list_sem         - list semaphore in system
list_event       - list event in system
list_mutex       - list mutex in system
list_mailbox     - list mail box in system
list_msgqueue    - list message queue in system
list_mempool     - list memory pool in system
list_timer       - list timer in system
list_device      - list device in system
exit             - return to RT-Thread shell mode.
help             - RT-Thread shell help.
ps               - List threads in the system.
free             - Show the memory usage in the system.
ls               - List information about the FILEs.
cp               - Copy SOURCE to DEST.
mv               - Rename SOURCE to DEST.
cat              - Concatenate FILE(s)
rm               - Remove(unlink) the FILE(s).
cd               - Change the shell working directory.
pwd              - Print the name of the current working directory.
mkdir            - Create the DIRECTORY.
mkfs             - format disk with file system
df               - disk free
echo             - echo string to file
ifconfig         - list the information of all network interfaces
ping             - ping network host
dns              - list and set the information of dns
netstat          - list the information of TCP / IP

查看系统时间;

msh />date
Wed Nov  3 17:56:30 B275

列举所有的设备

msh />list_device
device                                 type         ref count
------------------------------ -------------------- ----------
e0                             Network Interface    0       
rtc                            RTC                  0       
pin                            Miscellaneous Device 0       
uart                           Character Device     2       

rtt使用总结:
龙芯2k上的rtt bsp,可以直接在官网上下载,有人已经移植好了(哈哈哈,小白也蹭了一波热度),跑起来不难,但目前能用的驱动比较少,仅仅能起,如果基于此开发的话,甚至想要把这个架构做的标准,高效和贴近需求,工作量和难度还有很多很多.

																														TO BE CONTINUED
  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

打工人1379号

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值