2012年3月30日 星期五

MSPGCC 4.6.2 AND Ubuntu 10.04

在 Ubuntu 上建置 TI MSP430 的 C Compiler 過程

參考來源
http://sourceforge.net/apps/mediawiki/mspgcc/index.php?title=Install:fromsource#Sample_script_to_install_mspgcc_.26_mspdebug

動作過程如下

 cd ~
 mkdir temp
 cd temp
 wget http://sourceforge.net/projects/mspgcc/files/mspgcc/mspgcc-20120311.tar.bz2
 wget http://sourceforge.net/projects/mspgcc/files/msp430mcu/msp430mcu-20120311.tar.bz2
 wget http://sourceforge.net/projects/mspgcc/files/msp430-libc/msp430-libc-20120224.tar.bz2
 wget http://ftpmirror.gnu.org/binutils/binutils-2.21.1a.tar.bz2
 wget http://ftpmirror.gnu.org/gcc/gcc-4.6.2/gcc-core-4.6.2.tar.bz2
 wget http://ftpmirror.gnu.org/gdb/gdb-7.2a.tar.bz2
 wget http://sourceforge.net/projects/mspdebug/files/mspdebug-0.19.tar.gz
 mkdir msp430-build
 cd msp430-build
 tar xvfj binutils-2.21.1a.tar.bz2
 tar xvfj gcc-core-4.6.2.tar.bz2
 tar xvfj gdb-7.2a.tar.bz2
 tar xvfj mspgcc-20120311.tar.bz2
 tar xvfj msp430mcu-20120311.tar.bz2
 tar xvfj msp430-libc-20120224.tar.bz2
 tar xvfz mspdebug-0.19.tar.gz
 cd gcc-4.6.2
 ./contrib/download_prerequisites
 cd binutils-2.21.1
 patch -p1<../mspgcc-20120311/msp430-binutils-2.21.1a-20120224.patch
 cd ..
 cd gcc-4.6.1
 patch -p1<../mspgcc-20120311/msp430-gcc-4.6.2-20120311.patch
 cd ..
 cd gdb-7.2
# 我下載的內容沒有 20120311 只有 20111205
# patch -p1<../mspgcc-20120311/msp430-gdb-7.2a-20120311.patch
 patch -p1<../mspgcc-20120311/msp430-gdb-7.2a-20111205.patch
 cd ..

 mkdir binutils-2.21.1-msp430
 mkdir gcc-4.6.2-msp430
 mkdir gdb-7.2-msp430
 
 cd binutils-2.21.1-msp430
 ../binutils-2.21.1/configure --target=msp430 --program-prefix="msp430-" 
 
 make
 sudo make install
 
 #  I have seen issues where the msp430-ranlib doesn't get detected correctly causing build issues later.
 #  if that happens uncomment the following:
 #  cd /usr/bin
 #  sudo ln -s /usr/local/bin/msp430-ranlib
 
 
 cd ../gcc-4.6.2-msp430
 ../gcc-4.6.2/configure --target=msp430 --enable-languages=c --program-prefix="msp430-" 
 make
 sudo make install
 
 cd ../gdb-7.2-msp430
 ../gdb-7.2/configure --target=msp430 --program-prefix="msp430-" 
 make
 sudo make install
 
 cd ../msp430mcu-20120311
 sudo MSP430MCU_ROOT=`pwd` ./scripts/install.sh /usr/local/
 cd ../msp430-libc-20120224
 cd src
 make 
 sudo PATH=$PATH make PREFIX=/usr/local install
 cd ..
 
 cd mspdebug-0.19
 make
 sudo make install
 cd ../..
這樣就可以完成開發工具的建置了
記得要去 /etc/profile 加上下面這行
export PATH=${PATH}:/usr/local/msp430/bin
然後再執行 source /etc/profile
才可以找得到 msp430-gcc 相關檔案

沒有留言:

張貼留言