最近在做关于Contiki操作系统在TelosB节点上的一些实验,但是在编译一些Contiki样例的时候遇到了".text"和".rodata"段出现重合无法成功编译的情况,查阅资料显示需要更新Instant Contiki中自带的msp430-gcc来解决这个问题。 本文将我的操作过程做一个记录,希望对读者有所帮助。
Instant Contiki3.0(Ubuntu 14.04LTS)
外网上也有不少关于重新编译msp430-gcc的教程,但是他们的要求都是TEXINFO版本<5,但是上一步直接安装的texinfo的版本>5,需要卸载后从源码安装其4.xx版本:
ubuntu应该直接用apt卸载即可
解压源码:
gzip -dc < texinfo-4.13.tar.gz | tar -xf - cd texinfo-4.13Configure, build and install:
./configure make sudo make install仍然是使用apt卸载,不再赘述
创建放置源码的文件夹
# Switch to the tmp directory mkdir tmp cd tmp下载所需源码
wget http://sourceforge.net/projects/mspgcc/files/mspgcc/DEVEL-4.7.x/mspgcc-20120911.tar.bz2 wget http://sourceforge.net/projects/mspgcc/files/msp430mcu/msp430mcu-20120716.tar.bz2 wget http://sourceforge.net/projects/mspgcc/files/msp430-libc/msp430-libc-20120716.tar.bz2 wget http://ftpmirror.gnu.org/binutils/binutils-2.22.tar.bz2 wget http://mirror.ibcp.fr/pub/gnu/gcc/gcc-4.7.2/gcc-4.7.2.tar.bz2 wget http://sourceforge.net/p/mspgcc/bugs/352/attachment/0001-SF-352-Bad-code-generated-pushing-a20-from-stack.patch wget http://sourceforge.net/p/mspgcc/bugs/_discuss/thread/fd929b9e/db43/attachment/0001-SF-357-Shift-operations-may-produce-incorrect-result.patch # Unpacking the tars tar xvfj binutils-2.22.tar.bz2 tar xvfj gcc-4.7.2.tar.bz2 tar xvfj mspgcc-20120911.tar.bz2 tar xvfj msp430mcu-20120716.tar.bz2 tar xvfj msp430-libc-20120716.tar.bz2安装patch过的binutil
# 4) installing binutils in INSTALL_PREFIX cd binutils-2.22-msp430/ ../binutils-2.22/configure --target=msp430 --program-prefix="msp430-" --prefix=$INSTALL_PREFIX make make install安装patch过的gcc
# 5) Download the prerequisites cd ../gcc-4.7.2 ./contrib/download_prerequisites # 6) compiling gcc-4.7.0 in INSTALL_PREFIX cd ../gcc-4.7.2-msp430 ../gcc-4.7.2/configure --target=msp430 --enable-languages=c --program-prefix="msp430-" --prefix=$INSTALL_PREFIX make make install使用命令查看msp430-gcc的版本,如果是4.7.2则完成
msp430-gcc --version