Ubuntu16.04安装RTEMS4.12-4.11 RSB及BSP

前端之家收集整理的这篇文章主要介绍了Ubuntu16.04安装RTEMS4.12-4.11 RSB及BSP前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

新手,从0开始,系统:ubuntu 16.04.3 LTS

按照如下教程开始

https://docs.rtems.org/rsb/#_ubuntu

https://docs.rtems.org/rsb/#_setup

一 安装RSB

1.创建文件夹,安装交叉工具链

2.下载git

wangjc@wangjc-Inspiron-3668:~/development/rtems/src$ git clone git://git.rtems.org/rtems-source-builder.git

如果安装4.11,指令为

git clone -b 4.11 https://github.com/rtems/rtems-source-builder.git

直接下载出现错误,缺少依赖包,安装依赖包时仍出错

按如下命令安装:

sudo gedit /etc/apt/sources.list

修改sources.list文件,

3.使用如下命令中的最后一行,成功:

Some times our systems may not be up-to-date to receive an install so we can update with:

sudo apt-get update --> update package information
sudo apt-get dist-upgrade --> upgrade packages on system
sudo apt-get -f install --> fix broken packages

4.下载git后检查工具包是否完善,报错:

wangjc@wangjc-Inspiron-3668:~/development/rtems/src/rtems-source-builder$ source-builder/sb-check
RTEMS Source Builder - Check,4.12.not_released
error: exe: not found: (__bison) /usr/bin/bison
error: exe: not found: (__flex) /usr/bin/flex
error: exe: not found: (__makeinfo) /usr/bin/makeinfo
Environment is not correctly set up

丢失了bison等执行文件,运行指令可安装bison和flex

sudo apt-get install bison

安装makeinfo时报错

E: Unable to locate package makeinfo

发现安装texinfo即可,测试后发现环境OK

sudo apt-get install texinfo

5.编译SPARC工具集,需要从internet下载,查看2.4 Building的解释内容

wangjc@wangjc-Inspiron-3668:~/development/rtems/src/rtems-source-builder/rtems$ ../source-builder/sb-set-builder --log=l-sparc.txt --prefix=$HOME/development/rtems/4.12 4.12/rtems-sparc

报错:

building: sparc-rtems4.12-gdb-7.12-x86_64-linux-gnu-1
error: building sparc-rtems4.12-gdb-7.12-x86_64-linux-gnu-1
Build Failed
  See error report: rsb-report-sparc-rtems4.12-gdb-7.12-x86_64-linux-gnu-1.txt
error: building sparc-rtems4.12-gdb-7.12-x86_64-linux-gnu-1
Build Set: Time 0:27:01.555189
Build Failed

查看对应的rsb-report文件后发现,可能是python崩溃导致

可能是需要python的以来开发包python-dev,安装python-dev

wangjc@wangjc-Inspiron-3668:~$ sudo apt-get install python2.7-dev

安装完后再编译,爆出错误为:

../../readline/libreadline.a(terminal.o):/home/wangjc/development/rtems/src/rtems-source-builder/rtems/build/sparc-rtems4.12-gdb-7.12-x86_64-linux-gnu-1/build/readline/../../gdb-7.12/readline/terminal.c:765: more undefined references to `tputs' follow
collect2: error: ld returned 1 exit status
make[3]: *** [sis] Error 1
make[3]: *** Waiting for unfinished jobs....
make[2]: *** [all] Error 1
Makefile:8272: recipe for target 'all-sim' Failed
make[1]: *** [all-sim] Error 2
make[1]: Leaving directory '/home/wangjc/development/rtems/src/rtems-source-builder/rtems/build/sparc-rtems4.12-gdb-7.12-x86_64-linux-gnu-1/build'
Makefile:849: recipe for target 'all' Failed
make: *** [all] Error 2
shell cmd Failed: /bin/sh -ex  /home/wangjc/development/rtems/src/rtems-source-builder/rtems/build/sparc-rtems4.12-gdb-7.12-x86_64-linux-gnu-1/doit
error: building sparc-rtems4.12-gdb-7.12-x86_64-linux-gnu-1

尝试更新

$sudo apt-get update 
$ sudo apt-get build-dep binutils gcc g++ gdb unzip

更新后再编译,编译成功

config: tools/rtems-gcc-7.1.0-newlib-2.5.0.20170720-1.cfg
package: sparc-rtems4.12-gcc-7.1.0-newlib-2.5.0.20170720-x86_64-linux-gnu-1
building: sparc-rtems4.12-gcc-7.1.0-newlib-2.5.0.20170720-x86_64-linux-gnu-1
reporting: tools/rtems-gcc-7.1.0-newlib-2.5.0.20170720-1.cfg -> sparc-rtems4.12-gcc-7.1.0-newlib-2.5.0.20170720-x86_64-linux-gnu-1.txt
reporting: tools/rtems-gcc-7.1.0-newlib-2.5.0.20170720-1.cfg -> sparc-rtems4.12-gcc-7.1.0-newlib-2.5.0.20170720-x86_64-linux-gnu-1.xml
config: tools/rtems-gdb-7.12-1.cfg
package: sparc-rtems4.12-gdb-7.12-x86_64-linux-gnu-1
building: sparc-rtems4.12-gdb-7.12-x86_64-linux-gnu-1
reporting: tools/rtems-gdb-7.12-1.cfg -> sparc-rtems4.12-gdb-7.12-x86_64-linux-gnu-1.txt
reporting: tools/rtems-gdb-7.12-1.cfg -> sparc-rtems4.12-gdb-7.12-x86_64-linux-gnu-1.xml
config: tools/rtems-tools-4.12-1.cfg
package: rtems-tools-HEAD-1
Creating source directory: sources/git
git: clone: git://git.rtems.org/rtems-tools.git -> sources/git/rtems-tools.git
git: reset: git://git.rtems.org/rtems-tools.git
git: fetch: git://git.rtems.org/rtems-tools.git -> sources/git/rtems-tools.git
git: checkout: git://git.rtems.org/rtems-tools.git => HEAD
git: pull: git://git.rtems.org/rtems-tools.git
building: rtems-tools-HEAD-1
reporting: tools/rtems-tools-4.12-1.cfg -> rtems-tools-HEAD-1.txt
reporting: tools/rtems-tools-4.12-1.cfg -> rtems-tools-HEAD-1.xml
config: tools/rtems-kernel-4.12.cfg
package: sparc-rtems4.12-kernel-4.12-1
building: sparc-rtems4.12-kernel-4.12-1
reporting: tools/rtems-kernel-4.12.cfg -> sparc-rtems4.12-kernel-4.12-1.txt
reporting: tools/rtems-kernel-4.12.cfg -> sparc-rtems4.12-kernel-4.12-1.xml
installing: expat-2.1.0-x86_64-linux-gnu-1 -> /home/wangjc/development/rtems/4.12
installing: sparc-rtems4.12-binutils-2.29-x86_64-linux-gnu-1 -> /home/wangjc/development/rtems/4.12
installing: sparc-rtems4.12-gcc-7.1.0-newlib-2.5.0.20170720-x86_64-linux-gnu-1 -> /home/wangjc/development/rtems/4.12
installing: sparc-rtems4.12-gdb-7.12-x86_64-linux-gnu-1 -> /home/wangjc/development/rtems/4.12
installing: rtems-tools-HEAD-1 -> /home/wangjc/development/rtems/4.12
installing: sparc-rtems4.12-kernel-4.12-1 -> /home/wangjc/development/rtems/4.12
cleaning: expat-2.1.0-x86_64-linux-gnu-1
cleaning: sparc-rtems4.12-binutils-2.29-x86_64-linux-gnu-1
cleaning: sparc-rtems4.12-gcc-7.1.0-newlib-2.5.0.20170720-x86_64-linux-gnu-1
cleaning: sparc-rtems4.12-gdb-7.12-x86_64-linux-gnu-1
cleaning: rtems-tools-HEAD-1
cleaning: sparc-rtems4.12-kernel-4.12-1
Build Set: Time 0:28:16.129294
wangjc@wangjc-Inspiron-3668:~/development/rtems/src/rtems-source-builder/rtems$  

6.检查gcc版本

wangjc@wangjc-Inspiron-3668:~/development/rtems/4.12/sparc-rtems4.12$ ~/development/rtems/4.12/bin/sparc-rtems4.12-gcc -v
Using built-in specs.
COLLECT_GCC=/home/wangjc/development/rtems/4.12/bin/sparc-rtems4.12-gcc
COLLECT_LTO_WRAPPER=/home/wangjc/development/rtems/4.12/libexec/gcc/sparc-rtems4.12/7.1.0/lto-wrapper
Target: sparc-rtems4.12
Configured with: ../gcc-7.1.0/configure --prefix=/home/wangjc/development/rtems/4.12 --bindir=/home/wangjc/development/rtems/4.12/bin --exec_prefix=/home/wangjc/development/rtems/4.12 --includedir=/home/wangjc/development/rtems/4.12/include --libdir=/home/wangjc/development/rtems/4.12/lib --libexecdir=/home/wangjc/development/rtems/4.12/libexec --mandir=/home/wangjc/development/rtems/4.12/share/man --infodir=/home/wangjc/development/rtems/4.12/share/info --datadir=/home/wangjc/development/rtems/4.12/share --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=sparc-rtems4.12 --disable-libstdcxx-pch --with-gnu-as --with-gnu-ld --verbose --with-newlib --disable-nls --without-included-gettext --disable-win32-registry --enable-version-specific-runtime-libs --disable-lto --enable-newlib-io-c99-formats --enable-newlib-iconv --enable-newlib-iconv-encodings=big5,cp775,cp850,cp852,cp855,cp866,euc_jp,euc_kr,euc_tw,iso_8859_1,iso_8859_10,iso_8859_11,iso_8859_13,iso_8859_14,iso_8859_15,iso_8859_2,iso_8859_3,iso_8859_4,iso_8859_5,iso_8859_6,iso_8859_7,iso_8859_8,iso_8859_9,iso_ir_111,koi8_r,koi8_ru,koi8_u,koi8_uni,ucs_2,ucs_2_internal,ucs_2be,ucs_2le,ucs_4,ucs_4_internal,ucs_4be,ucs_4le,us_ascii,utf_16,utf_16be,utf_16le,utf_8,win_1250,win_1251,win_1252,win_1253,win_1254,win_1255,win_1256,win_1257,win_1258 --enable-threads --disable-plugin --enable-libgomp --enable-languages=c,c++
Thread model: rtems
gcc version 7.1.0 20170502 (RTEMS 4.12,RSB 7208ab69e1fc068bdf23edc51e862db2f2a6a189,Newlib 2.5.0.20170720) (GCC) 
wangjc@wangjc-Inspiron-3668:~/development/rtems/4.12/sparc-rtems4.12$ 

二 安装BSP

交叉工具链安装完毕

下载rtems源文件到/home/wangjc/development/rtems/source/rtems-source-builder

$ git clone git://git.rtems.org/rtems.git

添加运行环境变量

$ export PATH=$HOME/development/rtems/4.11/bin:$PATH

编译

$ cd rtems
$ ./bootstrap

新建编译结果文件

$ cd ..
$ mkdir rtems-build
$ cd rtems-build

编译bsp,/home前面打两点‘..’时会报错,找不到文件

wangjc@wangjc-Inspiron-3668:~/development/rtems/rtems-build$ /home/wangjc/development/rtems/source/rtems-source-builder/rtems/configure --prefix=`pwd`/../rtems_stm32f4xx --target=arm-rtems4.11 --disable-maintainer-mode --disable-multiprocessing --disable-posix --disable-networking --disable-cxx --disable-tests --disable-rtems-debug --disable-multilib --disable-paravirt --disable-drvmgr --disable-docs --enable-rtemsbsp=stm32f4

make时报错

make

错误代码

Making all in stm32f4
make[2]: Entering directory '/home/wangjc/development/rtems/rtems-build/arm-rtems4.11/c/stm32f4'
make[2]: *** No rule to make target 'all'.  Stop.
make[2]: Leaving directory '/home/wangjc/development/rtems/rtems-build/arm-rtems4.11/c/stm32f4'
Makefile:286: recipe for target 'all-recursive' Failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/wangjc/development/rtems/rtems-build/arm-rtems4.11/c'
Makefile:410: recipe for target 'all-recursive' Failed
make: *** [all-recursive] Error 1

可能原因为我编译的RSB环境时针对sparc,但是 建立BSP时候用的是arm

注意:建立RSB环境需要在原始的rtems RSB文件下建立,否则提示找不到bset文件,建立后会创建一个环境文件夹,若为/rtems/4.11 4.11/rtems-arm则文件夹为4.11,文件夹下颚bin文件有对应平台的gcc编译器

建立bsp需要在新下载的rtems系统源文件上进行

按arm来建立bsp时报错:

checking for style of include used by make... GNU
checking for arm-rtems4.11-gcc... no
configure: error: no acceptable cc found in $PATH
Makefile:804: recipe for target 'stm32f4' Failed
make[2]: *** [stm32f4] Error 1
make[2]: Leaving directory '/home/wangjc/development/rtems/rtems-build/arm-rtems4.11/c'
Makefile:359: recipe for target 'all-recursive' Failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/wangjc/development/rtems/rtems-build/arm-rtems4.11/c'
Makefile:483: recipe for target 'all-recursive' Failed
make: *** [all-recursive] Error 1

应该是gcc不在环境变量中,增加arm-rtems4.11-gcc所在的文件夹路径 rtems4.11/bin

wangjc@wangjc-Inspiron-3668:~$ sudo gedit /etc/environment
wangjc@wangjc-Inspiron-3668:~$ source /etc/environment

此时再编译,之前的错误问题仍在

Making all in stm32f4
make[2]: Entering directory '/home/wangjc/development/rtems/rtems-build/arm-rtems4.11/c/stm32f4'
make[2]: *** No rule to make target 'all'.  Stop.
make[2]: Leaving directory '/home/wangjc/development/rtems/rtems-build/arm-rtems4.11/c/stm32f4'
Makefile:359: recipe for target 'all-recursive' Failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/wangjc/development/rtems/rtems-build/arm-rtems4.11/c'
Makefile:483: recipe for target 'all-recursive' Failed
make: *** [all-recursive] Error 1

运行指令,清除原来的makefile

wangjc@wangjc-Inspiron-3668:~/development/rtems/source/rtems-source-builder/rtems$ ./bootstrap -c

运行指令重新编译

wangjc@wangjc-Inspiron-3668:~/development/rtems/source/rtems-source-builder/rtems$ ./bootstrap -p

wangjc@wangjc-Inspiron-3668:~/development/rtems/source/rtems-source-builder/rtems$ /home/wangjc/development/rtems/source/rtems-source-builder/source-builder/sb-
bootstrap

再来编译bsp

wangjc@wangjc-Inspiron-3668:~/development/rtems$ mkdir rtems-build
wangjc@wangjc-Inspiron-3668:~/development/rtems/rtems-build$ /home/wangjc/development/rtems/source/rtems-source-builder/rtems/configure --prefix=`pwd`/../rtems_stm32f4xx --target=arm-rtems4.11 --disable-maintainer-mode --disable-multiprocessing --disable-posix --disable-networking --disable-cxx --disable-tests --disable-rtems-debug --disable-multilib --disable-paravirt --disable-drvmgr --disable-docs --enable-rtemsbsp=stm32f4
wangjc@wangjc-Inspiron-3668:~/development/rtems/rtems-build$ make

此时不会报错,一定要从./bootstrap -c开始重新来一遍,否则会报错。make成功

三 下载编译例程

build$ git clone git://git.rtems.org/examples-v2.git example-v2

建立makefile环境变量

build/example-v2$ export RTEMS_MAKEFILE_PATH=/home/wangjc/development/rtems/sour
ce/rtems-source-builder/rtems_stm32f4xx/arm-rtems4.11/stm32f4

建立arm gcc环境变量,否则会报错

export PATH=$HOME/development/rtems/4.11/bin:$PATH

make后生成了hello.exe文件,所在目录为/home/wangjc/development/rtems/source/rtems-source-builder/arm-build/example-v2/hello/hello_world_c/o-optimize

wangjc@wangjc-Inspiron-3668:~/development/rtems/source/rtems-source-builder/arm-build/example-v2$ make

fileIO的例子中也有生成,这个生成应该有一个配置文件指定

9.为简便,可在home目录下的.bashrc文件中增加上面两条路径(ctrl+H可见),避免编译出错。出处

export PATH=$HOME/development/rtems/4.11/bin:$PATH
export RTEMS_MAKEFILE_PATH=/home/wangjc/development/rtems/source/rtems-source-builder/rtems_stm32f4xx/arm-rtems4.11/stm32f4

一定要多读文档!!!

原文链接:https://www.f2er.com/ubuntu/351667.html

猜你在找的Ubuntu相关文章