本帖最后由 年轻的国王 于 2020-8-10 16:27 编辑
RTEMS
RTEMS(多处理系统实时可执行体)是一个为嵌入式系统而设计的自由的开源实时操作系统。
在缩写词RTEMS取其现在的含义之前,初始时代表导弹系统实时可执行体,然后变成了军用系统实时可执行体。
RTEMS曾被移殖到多个以不同类型的中央处理器(CPU)为基础的计算机系统上。这些计算机系统所采用的CPU,计有:ARM、i386、m68k、MIPS、PowerPC、SH等多种不同的处理器。RTEMS被设计为支持多种开放的API如POSIX和uITRON。FreeBSD和TCP/IP栈还有多种文件系统也被支持。OAR公司当前在维护和管理RTEMS项目。RTEMS也被一些EPICS站点所使用。
RTEMS是在GPL授权条款下分发,但它允许将RTEMS的目标文件链接至其它文件而不需将整个文件以GPL授权覆盖,这方面有点像LGPL。
RTEMS的源代码下已经支持了stm32f4系列,用户只要配置编译即可运行在f4系列的设备,本实验基于STM32F446 Nucleo开发板,编译成功后会生成如下的开发工具包。
- rtems-4.11.3/c/src/lib/libbsp/arm/stm32f4/
- ├── aclocal.m4
- ├── autom4te.cache
- │ ├── output.0
- │ ├── output.1
- │ ├── requests
- │ ├── traces.0
- │ └── traces.1
- ├── bsp_specs
- ├── configure
- ├── configure.ac
- ├── console
- │ ├── console-config.c
- │ └── usart.c
- ├── i2c
- │ ├── i2c.c
- │ └── i2c-config.c
- ├── include
- │ ├── bsp.h
- │ ├── bspopts.h.in
- │ ├── i2c.h
- │ ├── io.h
- │ ├── irq.h
- │ ├── rcc.h
- │ ├── stm32f10xxx_exti.h
- │ ├── stm32f10xxx_gpio.h
- │ ├── stm32f10xxx_rcc.h
- │ ├── stm32f4.h
- │ ├── stm32f4xxxx_adc.h
- │ ├── stm32f4xxxx_exti.h
- │ ├── stm32f4xxxx_flash.h
- │ ├── stm32f4xxxx_gpio.h
- │ ├── stm32f4xxxx_otgfs.h
- │ ├── stm32f4xxxx_pwr.h
- │ ├── stm32f4xxxx_rcc.h
- │ ├── stm32f4xxxx_syscfg.h
- │ ├── stm32f4xxxx_tim.h
- │ ├── stm32_i2c.h
- │ ├── stm32_usart.h
- │ └── usart.h
- ├── make
- │ └── custom
- │ ├── stm32f105rc.cfg
- │ ├── stm32f105rc-testsuite.tcfg
- │ ├── stm32f4.cfg
- │ └── stm32f4-testsuite.tcfg
- ├── Makefile.am
- ├── Makefile.in
- ├── preinstall.am
- ├── README
- └── startup
- ├── bspreset.c
- ├── bspstart.c
- ├── bspstarthook.c
- ├── io.c
- ├── linkcmds.stm32f105rc
- ├── linkcmds.stm32f4
- ├── rcc.c
- └── start-config-io.c
- 7 directories, 51 files
[color=rgb(51, 102, 153) !important]复制代码
一,编译工具链的编译配置。 ①下载rtems-source-builder-4.11.3 编译工具,下载链接如下:
https://ftp.rtems.org/pub/rtems/releases/4.11/4.11.3/rtems-source-builder-4.11.3.tar.xz
②编译配置,ubantu16.04下安装依赖工具包:
- -------------------------------------------------------------
- $ sudo apt-get build-dep binutils gcc g++ gdb unzip git python2.7-dev
- -------------------------------------------------------------
[color=rgb(51, 102, 153) !important]复制代码
检测编译主机(Ubantu 16.04)环境:
- $ cd rtems-source-builder
- $ source-builder/sb-check
[color=rgb(51, 102, 153) !important]复制代码
Checking 成功后,编译交叉工具链:
- $ cd rtems
- $ sudo ../source-builder/sb-set-builder --log=l-arm.txt --prefix=/opt/sdk/rtems4.11.3 4.11/rtems-arm.bset
[color=rgb(51, 102, 153) !important]复制代码
编译过程会持续2小时左右,编译成功后会在--prefix=/opt/sdk/rtems4.11.3 路径下安装交叉工具链
- /opt/sdk/rtems4.11.3/bin/
- ├── aclocal
- ├── aclocal-1.12
- ├── arm-rtems4.11-addr2line
- ├── arm-rtems4.11-ar
- ├── arm-rtems4.11-as
- ├── arm-rtems4.11-c++
- ├── arm-rtems4.11-c++filt
- ├── arm-rtems4.11-cpp
- ├── arm-rtems4.11-elfedit
- ├── arm-rtems4.11-g++
- ├── arm-rtems4.11-gcc
- ├── arm-rtems4.11-gcc-4.9.3
- ├── arm-rtems4.11-gcc-ar
- ├── arm-rtems4.11-gcc-nm
- ├── arm-rtems4.11-gcc-ranlib
- ├── arm-rtems4.11-gcov
- ├── arm-rtems4.11-gdb
- ├── arm-rtems4.11-gprof
- ├── arm-rtems4.11-ld
- ├── arm-rtems4.11-ld.bfd
- ├── arm-rtems4.11-nm
- ├── arm-rtems4.11-objcopy
- ├── arm-rtems4.11-objdump
- ├── arm-rtems4.11-ranlib
- ├── arm-rtems4.11-readelf
- ├── arm-rtems4.11-run
- ├── arm-rtems4.11-size
- ├── arm-rtems4.11-strings
- ├── arm-rtems4.11-strip
- ├── autoconf
- ├── autoheader
- ├── autom4te
- ├── automake
- ├── automake-1.12
- ├── autoreconf
- ├── autoscan
- ├── autoupdate
- ├── covoar
- ├── ifnames
- ├── rtems-ld
- ├── rtems-ra
- ├── rtems-rap
- ├── rtems-syms
- ├── rtems-test
- ├── rtems-tld
- ├── trace-converter
- └── xmlwf
[color=rgb(51, 102, 153) !important]复制代码
测试 arm-rtems4.11-gcc 版本如下:
- andey@ubuntu:/opt/sdk/rtems4.11.3$ /opt/sdk/rtems4.11.3/bin/arm-rtems4.11-gcc -v
- Using built-in specs.
- COLLECT_GCC=/opt/sdk/rtems4.11.3/bin/arm-rtems4.11-gcc
- COLLECT_LTO_WRAPPER=/opt/sdk/rtems4.11.3/libexec/gcc/arm-rtems4.11/4.9.3/lto-wrapper
- Target: arm-rtems4.11
- Configured with: ../gcc-4.9.3/configure --prefix=/opt/sdk/rtems4.11.3 --bindir=/opt/sdk/rtems4.11.3/bin --exec_prefix=/opt/sdk/rtems4.11.3 --includedir=/opt/sdk/rtems4.11.3/include --libdir=/opt/sdk/rtems4.11.3/lib --libexecdir=/opt/sdk/rtems4.11.3/libexec --mandir=/opt/sdk/rtems4.11.3/share/man --infodir=/opt/sdk/rtems4.11.3/share/info --datadir=/opt/sdk/rtems4.11.3/share --build=i686-linux-gnu --host=i686-linux-gnu --target=arm-rtems4.11 --disable-libstdcxx-pch --with-gnu-as --with-gnu-ld --verbose --with-newlib --with-system-zlib --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-obsolete --enable-libgomp --enable-languages=c,c++
- Thread model: rtems
- gcc version 4.9.3 20150626 (RTEMS 4.11.3, RSB no-repo, Newlib 2.2.0.20150423) (GCC)
[color=rgb(51, 102, 153) !important]复制代码
二 编译开发SDK:
下载rtems源码,链接如下:https://ftp.rtems.org/pub/rtems/releases/4.11/4.11.3/rtems-4.11.3.tar.xz使用自带的bootstrap 工具配置工程,使用方法如下:
- usage()
- {
- echo
- echo "usage: ${progname} [-c|-p|-h] [-q][-v]"
- echo
- echo "options:"
- echo " -c .. clean, remove all aclocal/autoconf/automake generated files"
- echo " -h .. display this message and exit"
- echo " -p .. regenerate preinstall.am files"
- echo " -q .. quiet, don't display directories"
- echo " -v .. verbose, pass -v to autotools"
- echo
- exit 1
- }
[color=rgb(51, 102, 153) !important]复制代码
[color=rgb(51, 102, 153) !important]复制代码
配置成功后,编译SDK:- ../rtems-4.11.3/configure --target=arm-rtems4.11 --disable-itron --disable-cxx --disable-networking --enable-rtemsbsp="stm32f4" --prefix=/home/andey/Download/RTEMS4.11.3/stm32f4
- make
- make install
[color=rgb(51, 102, 153) !important]复制代码
编译成功会在安装目录下生成编译好的测试程序:以下烧写hello测试程序
- stm32f4/arm-rtems4.11/c/stm32f4/testsuites/samples/hello
[color=rgb(51, 102, 153) !important]复制代码
- 生成bin文件:arm-rtems4.11-objcopy -O binary hello.exe hello.bin
[color=rgb(51, 102, 153) !important]复制代码
烧写测试程序运行效果如下:
rtems-docs-4.11.3.zip (13.47 MB, 下载次数: 6)
rtems-source-builder-4.11.3.tar.zip (293.88 KB, 下载次数: 7) rtems-4.11.3.tar.zip (7.25 MB, 下载次数: 7)
|
|