3717|1

6366

帖子

4914

TA的资源

版主

楼主
 

Linux环境下的MSP430 Launchpad 开发步骤 [复制链接]

How to develop MSP430 Launchpad code on Linux PDF Print E-mail

The LaunchPad is an easy-to-use, affordable, and scalable introduction to the world of microcontrollers and the MSP430 family.

The LaunchPad development kit is a part of TI's MSP430 Value Line series. It has an integrated DIP target socket that supports up to 20 pins, allowing MSP430 Value Line devices to be dropped into the LaunchPad board. Also, an on-board flash emulation tool allows direct interface to a PC for easy programming, debugging, and evaluation.

Unfortunately, the TI supported tools for this kit are Windows only.

It is, however, quite possible to use Linux based tools with Launchpad.  The procedure below outlines the steps to build a Linux based tool chain and debugger, as well as create and test a short C program.

The procedure below should work on either your x86 Linux machine or on an OMAP system using the GNOME image from this site.

If you are using the GNOME image from this site all necessary packages to build the msp430 tools are included.  If you are using an x86 machine you may need to install a few required packages (the below assumes you are using Ubuntu, modify as needed for your distro):

$ sudo aptitude install git-core gcc-4.4 texinfo patch libncurses5-dev
$ sudo aptitude install zlibc zlib1g-dev libx11-dev libusb-dev libreadline6-dev

Next we will download and build the mspgcc compiler:

git clone git://mspgcc4.git.sourceforge.net/gitroot/mspgcc4/mspgcc4
cd mspgcc4
sudo sh buildgcc.sh

The build script will ask a number of questions.  Accept the default by pressing Enter for each question except "Do you want to start build right now?"  The proper response here is of course "yes"!

Next we download and build mspdebug:

cd ..
git clone git://mspdebug.git.sourceforge.net/gitroot/mspdebug/mspdebug
cd mspdebug
make
sudo make install

At this point we're ready to test our first MSP430 program: blinking the red LED connected to the P1 pin.

Create a blink.c file using your favorite editor:

/* Demo app to blink the red LED on the TI Launchpad */

#include <msp430g2231.h>

int main(void) {
volatile int i;

// stop watchdog timer
WDTCTL = WDTPW | WDTHOLD;
// set up bit 0 of P1 as output
P1DIR = 0x01;
// intialize bit 0 of P1 to 0
P1OUT = 0x00;

// loop forever
for (;;) {
// toggle bit 0 of P1
P1OUT ^= 0x01;
// delay for a while
for (i = 0; i < 0x6000; i++);
}
}

Next compile your program:

$ /opt/msp430-gcc-4.4.5/bin/msp430-gcc -oS -o blink.elf blink.c

Connect the Launchpad to your development machine using the supplied USB cable.  Use MSPDebug to download and launch your program.

$ sudo mspdebug rf2500
(mspdebug) prog blink.elf
Erasing...
Programming...
Writing 104 bytes to fc00...
Writing 32 bytes to ffe0...
(mspdebug) run
Running. Press Ctrl+C to interrupt...

You should now see the red LED blinking!

How to develop MSP430 Launchpad code on Linux PDF Print E-mail

The LaunchPad is an easy-to-use, affordable, and scalable introduction to the world of microcontrollers and the MSP430 family.

The LaunchPad development kit is a part of TI's MSP430 Value Line series. It has an integrated DIP target socket that supports up to 20 pins, allowing MSP430 Value Line devices to be dropped into the LaunchPad board. Also, an on-board flash emulation tool allows direct interface to a PC for easy programming, debugging, and evaluation.

Unfortunately, the TI supported tools for this kit are Windows only.

It is, however, quite possible to use Linux based tools with Launchpad.  The procedure below outlines the steps to build a Linux based tool chain and debugger, as well as create and test a short C program.

The procedure below should work on either your x86 Linux machine or on an OMAP system using the GNOME image from this site.

If you are using the GNOME image from this site all necessary packages to build the msp430 tools are included.  If you are using an x86 machine you may need to install a few required packages (the below assumes you are using Ubuntu, modify as needed for your distro):

$ sudo aptitude install git-core gcc-4.4 texinfo patch libncurses5-dev
$ sudo aptitude install zlibc zlib1g-dev libx11-dev libusb-dev libreadline6-dev

Next we will download and build the mspgcc compiler:

git clone git://mspgcc4.git.sourceforge.net/gitroot/mspgcc4/mspgcc4
cd mspgcc4
sudo sh buildgcc.sh

The build script will ask a number of questions.  Accept the default by pressing Enter for each question except "Do you want to start build right now?"  The proper response here is of course "yes"!

Next we download and build mspdebug:

cd ..
git clone git://mspdebug.git.sourceforge.net/gitroot/mspdebug/mspdebug
cd mspdebug
make
sudo make install

At this point we're ready to test our first MSP430 program: blinking the red LED connected to the P1 pin.

Create a blink.c file using your favorite editor:

/* Demo app to blink the red LED on the TI Launchpad */

#include <msp430g2231.h>

int main(void) {
volatile int i;

// stop watchdog timer
WDTCTL = WDTPW | WDTHOLD;
// set up bit 0 of P1 as output
P1DIR = 0x01;
// intialize bit 0 of P1 to 0
P1OUT = 0x00;

// loop forever
for (;;) {
// toggle bit 0 of P1
P1OUT ^= 0x01;
// delay for a while
for (i = 0; i < 0x6000; i++);
}
}

Next compile your program:

$ /opt/msp430-gcc-4.4.5/bin/msp430-gcc -oS -o blink.elf blink.c

Connect the Launchpad to your development machine using the supplied USB cable.  Use MSPDebug to download and launch your program.

$ sudo mspdebug rf2500
(mspdebug) prog blink.elf
Erasing...
Programming...
Writing 104 bytes to fc00...
Writing 32 bytes to ffe0...
(mspdebug) run
Running. Press Ctrl+C to interrupt...

You should now see the red LED blinking!

How to develop MSP430 Launchpad code on Linux

 

The LaunchPad is an easy-to-use, affordable, and scalable introduction to the world of microcontrollers and the MSP430 family.

The LaunchPad development kit is a part of TI's MSP430 Value Line series. It has an integrated DIP target socket that supports up to 20 pins, allowing MSP430 Value Line devices to be dropped into the LaunchPad board. Also, an on-board flash emulation tool allows direct interface to a PC for easy programming, debugging, and evaluation.

Unfortunately, the TI supported tools for this kit are Windows only.

It is, however, quite possible to use Linux based tools with Launchpad.  The procedure below outlines the steps to build a Linux based tool chain and debugger, as well as create and test a short C program.

The procedure below should work on either your x86 Linux machine or on an OMAP system using the GNOME image from this site.

If you are using the GNOME image from this site all necessary packages to build the msp430 tools are included.  If you are using an x86 machine you may need to install a few required packages (the below assumes you are using Ubuntu, modify as needed for your distro):

$ sudo aptitude install git-core gcc-4.4 texinfo patch libncurses5-dev
$ sudo aptitude install zlibc zlib1g-dev libx11-dev libusb-dev libreadline6-dev

Next we will download and build the mspgcc compiler:

git clone git://mspgcc4.git.sourceforge.net/gitroot/mspgcc4/mspgcc4
cd mspgcc4
sudo sh buildgcc.sh

The build script will ask a number of questions.  Accept the default by pressing Enter for each question except "Do you want to start build right now?"  The proper response here is of course "yes"!

Next we download and build mspdebug:

cd ..
git clone git://mspdebug.git.sourceforge.net/gitroot/mspdebug/mspdebug
cd mspdebug
make
sudo make install

At this point we're ready to test our first MSP430 program: blinking the red LED connected to the P1 pin.

Create a blink.c file using your favorite editor:

/* Demo app to blink the red LED on the TI Launchpad */

#include <msp430g2231.h>

int main(void) {
  volatile int i;

  // stop watchdog timer
  WDTCTL = WDTPW | WDTHOLD;
  // set up bit 0 of P1 as output
  P1DIR = 0x01;
  // intialize bit 0 of P1 to 0
  P1OUT = 0x00;

  // loop forever
  for (;;) {
    // toggle bit 0 of P1
    P1OUT ^= 0x01;
    // delay for a while
    for (i = 0; i < 0x6000; i++);
  }
}

Next compile your program:

$ /opt/msp430-gcc-4.4.5/bin/msp430-gcc -oS -o blink.elf blink.c

Connect the Launchpad to your development machine using the supplied USB cable.  Use MSPDebug to download and launch your program.

$ sudo mspdebug rf2500
(mspdebug) prog blink.elf
Erasing...
Programming...
Writing 104 bytes to fc00...
Writing  32 bytes to ffe0...
(mspdebug) run
Running. Press Ctrl+C to interrupt...

You should now see the red LED blinking!

 

最新回复

非常感谢!!!!!!!!!!!  详情 回复 发表于 2012-7-19 10:08
 
点赞 关注

回复
举报

10

帖子

0

TA的资源

一粒金砂(中级)

沙发
 
非常感谢!!!!!!!!!!!
 
 

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

随便看看
查找数据手册?

EEWorld Datasheet 技术支持

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

 
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
快速回复 返回顶部 返回列表