2349|0

2781

帖子

419

TA的资源

五彩晶圆(中级)

楼主
 

在linux下构建msp430 launchpad开发环境 [复制链接]

按照网上的方法搭好IAR开发环境,试着跑了一个亮灯的程序,倒是很顺利,但是问题也来了,我的Windows8系统上驱动还是比较匮乏,好不容易装上模拟器的驱动,但在想使用串口的时候,发现没有我的USB-TTL转换器的驱动,也就读不了温度传感器,加上我本人比较爱好linux,在经过一番纠结之后,终于成功作出了基于mspgcc开发环境,鉴于网络上很缺乏这方面的资料,我在这里给出我的方法。
我的环境是搭建在Fedora17上,开发板是MSP-EXP430G2,芯片是MSP430G2553IN20和MSP430G2452IN20,下载和调试用的是套件里的USB线(和quick start里windows的连接方式差不多),下面主要介绍mspgcc的构建。
我主要参考了这个网页 http://sourceforge.net/apps/medi ... =Install:fromsource
我根据这个页面编写了一个脚本

export PREFIX=/usr
export MAKEFLAGS='-j 5'

#Create a temporary build directory
mkdir msp430-build
cd msp430-build

wget http://sourceforge.net/projects/ ... cc-20120406.tar.bz2
wget http://sourceforge.net/projects/ ... cu-20120406.tar.bz2
wget http://sourceforge.net/projects/ ... bc-20120224.tar.bz2
wget http://ftpmirror.gnu.org/binutils/binutils-2.21.1a.tar.bz2
wget http://ftpmirror.gnu.org/gcc/gcc-4.6.3/gcc-core-4.6.3.tar.bz2
wget http://ftpmirror.gnu.org/gdb/gdb-7.2a.tar.bz2
wget http://sourceforge.net/projects/ ... spdebug-0.19.tar.gz

wget http://sourceforge.net/projects/ ... 406-sf3540953.patch
wget http://sourceforge.net/projects/ ... 406-sf3559978.patch

# extract all the following files into the msp430-build directory
tar xvfj binutils-2.21.1a.tar.bz2
tar xvfj gcc-core-4.6.3.tar.bz2
tar xvfj gdb-7.2a.tar.bz2
tar xvfj mspgcc-20120406.tar.bz2
tar xvfj msp430mcu-20120406.tar.bz2
tar xvfj msp430-libc-20120224.tar.bz2

# Make sure any additional patch files (from LTS) are located here as well


# The next line is optional for the debugger and is not officially part of the mspgcc project.
tar xvfz mspdebug-0.19.tar.gz

cd gcc-4.6.3
./contrib/download_prerequisites

# Return to the build directory
cd ..

# patch binutils (using the files provided in the Release Files, and repeat for any additional patches or LTS files)
cd binutils-2.21.1
# Patch binutils to bring it to Release 20120406 (still at 20120406)
patch -p1<../mspgcc-20120406/msp430-binutils-2.21.1a-20120406.patch


# Return to the build directory
cd ..

# patch GCC to bring it up to Release 20120406
cd gcc-4.6.3
patch -p1<../mspgcc-20120406/msp430-gcc-4.6.3-20120406.patch

# update with LTS files
patch -p1<../msp430-gcc-4.6.3-20120406-sf3540953.patch
patch -p1<../msp430-gcc-4.6.3-20120406-sf3559978.patch

# Return to the build directory
cd ..

# Patch GDB to bring it to release 20120406
cd gdb-7.2
patch -p1<../mspgcc-20120406/msp430-gdb-7.2a-20111205.patch

# Return to the build directory
cd ..

#Create a sub-set of Build Directories
mkdir binutils-2.21.1-msp430
mkdir gcc-4.6.3-msp430
mkdir gdb-7.2-msp430

# Configure Binutils
cd binutils-2.21.1-msp430
# We need to build binutils for the msp430
../binutils-2.21.1/configure --target=msp430 --program-prefix="msp430-" --prefix=$PREFIX

make
# Do the install as root (e.g., 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

#Configure GCC
cd ../gcc-4.6.3-msp430
../gcc-4.6.3/configure --target=msp430 --enable-languages=c --program-prefix="msp430-"  --prefix=$PREFIX


make
# Do the install as root (e.g., sudo)
make install

#Configure GDB

cd ../gdb-7.2-msp430
../gdb-7.2/configure --target=msp430 --program-prefix="msp430-"  --prefix=$PREFIX


make
# Do the install as root (e.g., sudo)
make install

#Install the mspgcc-mcu files
cd ../msp430mcu-20120406
MSP430MCU_ROOT=`pwd` ./scripts/install.sh $PREFIX

# Install the mspgcc-libc
cd ../msp430-libc-20120224

#  If you need to disable features, run configure here with any of the following flags to enable/disable features.
#  --disable-printf-int64 : Remove 64-bit integer support to printf formats
#  --disable-printf-int32 : Remove 32-bit integer support from printf formats
#  --enable-ieee754-errors : Use IEEE 754 error checking in libfp functions

cd src
make
# Do the install as root (e.g., sudo)
PATH=$PATH make PREFIX=$PREFIX install
cd ..

# Now let's build the debugger
cd ../mspdebug-0.19
PREFIX=$PREFIX make
# Do the install as root (e.g., sudo)
make install
cd ../..

# ALL DONE

可以根据自己的需要修改PREFIX来改变安装目录
MAKEFLAGS='-j 5'表示5进程编译。
如果没有安装在/usr/的话,需要修改PATH变量来制指定可执行文件的位置

下面是我纠结很久的部分,就是这个环境的使用
编译
msp430-gcc -mmcu=msp430g2553 main.c
根据所用的芯片信号更改-mmcu=的取值
下载和运行(需要root权限)
mspdebug rf2500
>prog a.out
>run
prog命令将制定的程序下载到开发板
run就可以执行,当然你也可以做单步执行等调试操作(不过不能像gdb那样使用r、b等缩写)
我会的也就是这么多,放在这里希望能帮到需要的人。

 
点赞 关注
个人签名

回复
举报
您需要登录后才可以回帖 登录 | 注册

随便看看
查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
关闭
站长推荐上一条 1/9 下一条

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2025 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表