完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
|
|
相关推荐
1个回答
|
|
#!/bin/bash
#rtems4.11在linuxmint-16-cinnamon-64bit上测试通过 #设置 TARGET=arm-rtemseabi4.11 PREFIX=/opt/rtems-4.11 BSP=stm32f4 BASEDIR=`pwd` TOPDIR=my_rtems binutils_name=binutils-2.24.tar.bz2 gcc_name=gcc-4.8.2.tar.bz2 gcc_diff_name=gcc-4.8.2-rtems4.11-20131031.diff gdb_name=gdb-7.6.2.tar.bz2 gdb_diff_name=gdb-7.6.2-rtems4.11-20131208.diff newlib_name=newlib-1.20.0.tar.gz newlib_diff_name=newlib-1.20.0-rtems4.11-20130325.diff binutils_basename=`echo $binutils_name | awk -F. ‘NF-=2’ OFS=。` gcc_basename=`echo $gcc_name | awk -F. ‘NF-=2’ OFS=。` gdb_basename=`echo $gdb_name | awk -F. ‘NF-=2’ OFS=。` newlib_basename=`echo $newlib_name | awk -F. ‘NF-=2’ OFS=。` #“按任意键继续。。。”的处理函数 get_char() { SAVEDSTTY=`stty -g` stty -echo stty raw dd if=/dev/tty bs=1 count=1 2》 /dev/null stty -raw stty echo stty $SAVEDSTTY } usage() { cat 《《EOF -d 下载安装并创建压缩包-》引导rtems-》配置rtems-》编译安装rtems-》编译应用程序 -e 从本地压缩包安装-》引导rtems-》配置rtems-》编译安装rtems-》编译应用程序 -b 引导rtems-》配置rtems-》编译安装rtems-》编译应用程序 -c 配置rtems-》编译安装rtems-》编译应用程序 -m 编译安装rtems-》编译应用程序 -a 编译应用程序 EOF } if [ -z “$1” ]; then usage exit 1 fi DOWNLOAD=no EXTRACT=no BOOTSTRAP=no CONFIGURE=no MAKERTEMS=no APPLICATION=no while getopts debcma OPT do case “$OPT” in d) DOWNLOAD=yes; BOOTSTRAP=yes; CONFIGURE=yes; MAKERTEMS=yes; APPLICATION=yes;; e) EXTRACT=yes; BOOTSTRAP=yes; CONFIGURE=yes; MAKERTEMS=yes; APPLICATION=yes;; b) BOOTSTRAP=yes; CONFIGURE=yes; MAKERTEMS=yes; APPLICATION=yes;; c) CONFIGURE=yes; MAKERTEMS=yes; APPLICATION=yes;; m) MAKERTEMS=yes; APPLICATION=yes;; a) APPLICATION=yes;; *) usage; exit 1;; esac done if [ $DOWNLOAD = ‘yes’ ] || [ $EXTRACT = ‘yes’ ]; then echo “创建交叉工具链安装目录” if [ ! -d “$PREFIX” ]; then sudo mkdir $PREFIX sudo chown $USER:$USER $PREFIX fi if [ -d “$TOPDIR” ]; then echo “错误:目录$TOPDIR已经存在” exit 1 fi echo “设置环境变量” if [ ! -f “$HOME/.bashrc” ]; then touch $HOME/.bashrc fi if !(grep -q “export PATH=$PREFIX/bin:”‘$PATH’ $HOME/.bashrc); then echo export PATH=$PREFIX/bin:‘$PATH’ 》》 $HOME/.bashrc fi if !(grep -q “export RTEMS_MAKEFILE_PATH=$PREFIX/$TARGET/$BSP” $HOME/.bashrc); then echo export RTEMS_MAKEFILE_PATH=$PREFIX/$TARGET/$BSP 》》 $HOME/.bashrc fi source $HOME/.bashrc echo “安装依赖项” sudo apt-get -d update 2》&1 | tee apt-get_update.log if (grep -q -E ‘^E:|^Err|^W:’ apt-get_update.log); then if (grep -q ‘/var/lib/apt/lists/lock’ apt-get_update.log); then sudo rm -vf /var/lib/apt/lists/* sudo apt-get update if [ $? -ne 0 ]; then echo “更新源出现错误,请稍候重试1” exit 1 fi else echo “更新源出现错误,请稍候重试2” exit 1 fi fi sudo apt-get install -y autoconf automake autotools-dev build-essential git dpkg-dev g++ libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libdpkg-perl libgmp-dev libgmp3-dev libgmpxx4ldbl libltdl-dev libmpc-dev libmpfr-dev libtimedate-perl libtool texinfo flex libncurses5-dev libc6-dev if [ $? -ne 0 ]; then echo “安装依赖项出现错误,请稍候重试” exit 1 fi #echo “按任意键继续。。。” && char=`get_char` if [ $DOWNLOAD = ‘yes’ ]; then echo “下载安装并创建压缩包” which proz 》 /dev/null 2》&1 if [ $? -ne 0 ]; then echo “安装多线程下载工具” wget -c http://dxdown1.onlinedown.net/down/prozilla-2.0.4.tar.zip unzip prozilla-2.0.4.tar.zip prozilla-2.0.4.tar.bz2 tar -xf prozilla-2.0.4.tar.bz2 cd prozilla-2.0.4 sed -i ‘s/DL_Window:://’ src/download_win.h 。/configure make sudo make install cd 。. fi which proz 》 /dev/null 2》&1 if [ $? -ne 0 ]; then echo “安装多线程下载工具出现错误,中止运行” exit 1 fi if [ -d “$TOPDIR” ]; then echo “错误:目录$TOPDIR已经存在” exit 1 fi mkdir $TOPDIR cd $TOPDIR down_cmd=‘proz -k=20 ’ host1=‘http://mirrors.ustc.edu.cn/gnu’ #host2=‘http://mirror.bjtu.edu.cn/gnu’ $down_cmd$host1/binutils/$binutils_name $down_cmd$host1/gcc/$gcc_basename/$gcc_name $down_cmd$host1/gdb/$gdb_name host1=‘http://www.rtems.org/ftp/pub/rtems/SOURCES/4.11’ $down_cmd$host1/$gcc_diff_name $down_cmd$host1/$gdb_diff_name $down_cmd$host1/$newlib_name $down_cmd$host1/$newlib_diff_name git_cmd=‘git clone git://git.rtems.org’ $git_cmd/examples-v2.git examples-v2 $git_cmd/rtems.git rtems $git_cmd/rtems-schedsim.git rtems-schedsim $git_cmd/rtems-testing.git rtems-testing $git_cmd/rtems-addon-packages.git rtems-addon-packages cd 。. echo “打包。..” tar -zcf $TOPDIR-$(date +%Y%m%d-%H%M%S).tar.gz $TOPDIR else echo “从本地压缩包安装” rtems_pkg=`find 。 -maxdepth 1 -type f -name “$TOPDIR-????????-??????.tar.gz” | sort -r | head -1` if [ -z “$rtems_pkg” ]; then echo “错误:没有找到压缩包,中止执行” exit 1 fi if [ -d “$TOPDIR” ]; then echo “错误:目录$TOPDIR已经存在” exit 1 fi echo “解包。..” tar -xf $rtems_pkg fi #echo “按任意键继续。。。” && char=`get_char` echo “编译安装交叉工具链” cd $BASEDIR/$TOPDIR tar -xf $binutils_name tar -xf $gcc_name patch -p0 《 $gcc__diff_name tar -xf $gdb_name patch -p0 《 $gdb_diff_name tar -xf $newlib_name patch -p0 《 $newlib_diff_name mkdir b-binutils cd b-binutils 。./$binutils_basename/configure --target=$TARGET --prefix=$PREFIX && make && make install cd 。. cd $gcc_basename ln -s 。./$newlib_basename/newlib 。 cd 。. mkdir b-gcc cd b-gcc 。./$gcc_basename/configure --target=$TARGET --with-gnu-as --with-gnu-ld --with-newlib --verbose --enable-threads --enable-obsolete --enable-languages=“c,c++” --prefix=$PREFIX make if [ $? -ne 0 ]; then echo “编译安装交叉工具链出现错误,中止执行” exit 1 fi #echo “按任意键继续。。。” && char=`get_char` make install cd 。. mkdir b-gdb cd b-gdb 。./$gdb_basename/configure --target=$TARGET --prefix=$PREFIX && make && make install cd 。. echo “删除多余的BSP” #注释掉的行将被保留 delbsps=‘ arm/c***336 arm/c***337 arm/edb7312 arm/gba arm/gdbarmsim arm/gp32 arm/gumstix arm/lm3s69xx arm/lpc24xx arm/lpc32xx arm/nds arm/raspberrypi arm/realview-pbx-a9 arm/rtl22xx arm/smdk2410 #arm/stm32f4 arm/xilinx-zynq avr bfin h8300 i386 lm32 m32c m32r m68k mips moxie nios2 no_cpu powerpc sh sparc sparc64 v850 ’ for i in $delbsps; do if [ -d “rtems/c/src/lib/libbsp/$i” ]; then rm -r rtems/c/src/lib/libbsp/$i fi if [ -d “rtems/c/src/lib/libcpu/$i” ]; then rm -r rtems/c/src/lib/libcpu/$i fi if [ -d “rtems/cpukit/score/cpu/$i” ]; then rm -r rtems/cpukit/score/cpu/$i fi ii=`echo $i | sed ‘s#/#\/#g’` sed -i “/$ii/d” rtems/cpukit/configure.ac sed -i “/$ii/d” rtems/cpukit/score/cpu/Makefile.am done echo “删除自带的示例” rm -r rtems/testsuites rm -r rtems/c/src/ada-tests #echo “按任意键继续。。。” && char=`get_char` fi #end [ $DOWNLOAD = ‘yes’ ] || [ $EXTRACT = ‘yes’ ] if [ $BOOTSTRAP = ‘yes’ ]; then echo “引导rtems” cd $BASEDIR/$TOPDIR/rtems 。/bootstrap -c 。/bootstrap -p 。/bootstrap if [ $? -ne 0 ]; then echo “引导rtems出现错误,中止执行” exit 1 fi #echo “按任意键继续。。。” && char=`get_char` cd 。. fi #end BOOTSTRAP if [ $CONFIGURE = ‘yes’ ]; then echo “配置rtems” cd $BASEDIR/$TOPDIR if [ -d “b-$BSP” ]; then rm -r b-$BSP fi mkdir b-$BSP cd b-$BSP 。./rtems/configure --target=$TARGET --enable-rtem***sp=$BSP --disable-tests --enable-posix --disable-networking --prefix=$PREFIX | tee configure.log if [ $? -ne 0 ]; then echo “配置rtems出现错误,中止执行1” exit 1 fi if !(grep -q “‘make all’ will build the following BSPs” configure.log); then echo “配置rtems出现错误,中止执行2” exit 1 fi echo “如果上面几行出现如下类似语句说明配置成功” echo “‘make all’ will build the following BSPs: stm32f107.” echo “other BSPs can be built with ‘make RTEMS_BSP=”bsp1 bsp2 。..“’” #echo “按任意键继续。。。” && char=`get_char` fi #end CONFIGURE if [ $MAKERTEMS = ‘yes’ ]; then echo “编译安装rtems” cd $BASEDIR/$TOPDIR/b-$BSP make clean make if [ $? -ne 0 ]; then echo “编译安装rtems出现错误,中止执行” exit 1 fi #echo “按任意键继续。。。” && char=`get_char` make install fi #end MAKERTEMS if [ $APPLICATION = ‘yes’ ]; then echo “编译应用程序” cd $BASEDIR/$TOPDIR/examples-v2/hello/hello_world_c make clean make if [ $? -ne 0 ]; then echo “编译应用程序出现错误,中止执行” exit 1 fi echo “如果上面几行出现如下类似语句说明编译成功” echo “ text data bss dec hex filename” echo “ 76032 1908 129160 207100 328fc o-optimize/hello.exe” #echo “按任意键继续。。。” && char=`get_char` cd o-optimize $TARGET-objdump -x hello.exe 》 hello.out $TARGET-objdump -d -j .start -j .vector -j .text -j .init -j .fini -j .rodata -j .ARM.exidx -j .eh_frame -j .init_array -j .fini_array -j .jcr -j .data -j .bss -j .work -j .comment -j .ARM.attributes hello.exe 》 hello.S $TARGET-objcopy -O binary hello.exe -S hello.bin cp hello.exe hello.out hello.S hello.bin $BASEDIR fi #end APPLICATION time=$SECONDS hour=$[$time/3600] min=$[$[$time/60]%60] sec=$[$time%60] echo “执行时间:$hour小时$min分$sec秒” |
|
|
|
只有小组成员才能发言,加入小组>>
调试STM32H750的FMC总线读写PSRAM遇到的问题求解?
1801 浏览 1 评论
X-NUCLEO-IHM08M1板文档中输出电流为15Arms,15Arms是怎么得出来的呢?
1629 浏览 1 评论
1096 浏览 2 评论
STM32F030F4 HSI时钟温度测试过不去是怎么回事?
735 浏览 2 评论
ST25R3916能否对ISO15693的标签芯片进行分区域写密码?
1684 浏览 2 评论
1944浏览 9评论
STM32仿真器是选择ST-LINK还是选择J-LINK?各有什么优势啊?
745浏览 4评论
STM32F0_TIM2输出pwm2后OLED变暗或者系统重启是怎么回事?
579浏览 3评论
601浏览 3评论
stm32cubemx生成mdk-arm v4项目文件无法打开是什么原因导致的?
565浏览 3评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-27 13:45 , Processed in 0.916523 second(s), Total 76, Slave 60 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号