MSP430开发环境MSPGCC + Codeblocks
codeblocks本身就集成MSPGCC编译器的模板,但是新版的MSPGCC比起旧版的似乎有点不一样,所以需要做一些配置的工作。
理论上,搭建方法也适用于linux系统,我个人还没在linux下搭建。
相比Eclipse,codeblocks显得很小巧(不想要MinGW的话也不到30M),无需JAVA环境,运行速度也很快,支持搭建多种开发环境,是我摆弄东西的首选平台。至于它的其它优点,自行google吧。
我的mspgcc是放在D:mspgcc目录下,TI官方的烧录软件我放在"D:mspgccflash_fet"目录下 ,请读者自行修改。
开始:
1) 先安装好codeblocks 10.05,这个很简单。下面的一个是不带minGW的只有23M,带minGW的74M
http://sourceforge.net/projects/codeblocks/files/Binaries/10.05/Windows/codeblocks-10.05-setup.exe/download
http://sourceforge.net/projects/codeblocks/files/Binaries/10.05/Windows/codeblocks-10.05mingw-setup.exe/download
2)下载MSPGCC(新版的只有37M),解压到“D:mspgcc”
http://sourceforge.net/projects/mspgcc/files/Windows/mingw32/mspgcc-20120406-p20120502.zip/download
3)下载TI LuanchPad软件包,并将里面Flasher,driver等解压到“D:mspgcc”目录下。(附件)
4)运行codeblocks,点击Setting->Compiler and debugger..
选择编译器“GNU GCC Compiler for MSP430”
注意:如果你只用到一种编译设置只用一种型号的MCU的话,Complier Flags的话可以也可以在这里设置。(我个人不推荐~~)
切换到"Toolchain executables",修改如下
本页下切换到“Addition Paths”,将msp430的目录也加上
切换到"Search directories", 添加Compiler的include目录和linker的lib目录
保存。
5)新建一个项目。File->New->project->Empty project
一般我都只勾选Release,不要Debug
7)新建空白文件,并添加到项目中File->New->Empty file
输入测试代码。我的LaunchPad代码(没注释的,见笑了):
#include
void delay(int duration)
{
volatile int d = duration;
while((d--) > 0)
{
}
}
int main(void)
{
WDTCTL = WDTPW | WDTHOLD;
P1OUT = 0x00;
P1DIR = 0x41;
while(1)
{
P1OUT = 0x40;
delay(5000);
P1OUT = 0x01;
delay(5000);
}
return 0;
}
提醒一下:delay函数里面的变量要加上volatile修饰。
8)在编译之前还有一些重要的工作要做。
Project->Propertise..->Build targets
以下内容也可以在上面红色字体的页面设置(不推荐)
9)Project->Build Options..
我的设置:
msp430-objcopy -O ihex bin/Release/CB_MSP430_test001.elfbin/Release/CB_MSP430_test001.a43
D:/mspgcc/msp_fet/MSP430Flasher.exe -n msp4302553 -w bin/Release/CB_MSP430_test001.a43 -v -g -z [VCC]
至此,设置完成。
可以点击运行了。成功后显示信息~~
-------------- Build: Release in CB_MSP430_test001 ---------------
msp430-gcc.exe -Wall -mmcu=msp430g2553-Os -O3 -ID:mspgccmsp430include -ID:mspgccinclude-c CB_MSP430_test001.c -o objReleaseCB_MSP430_test001.o
msp430-gcc.exe -LD:mspgccmsp430libldscriptsmsp430g2553 -LD:mspgccmsp430lib -LD:mspgcclib-o binReleaseCB_MSP430_test001.elf objReleaseCB_MSP430_test001.o -s
Output size is 584.00 bytes
Running target post-build steps
msp430-objcopy -O ihex bin/Release/CB_MSP430_test001.elfbin/Release/CB_MSP430_test001.a43
D:/mspgcc/msp_fet/MSP430Flasher.exe -n msp4302553 -w bin/Release/CB_MSP430_test001.a43 -v -g -z [VCC]
**ERROR: Unable to access log file. Log disabled.
**Please make sure the directory Log exists inlinewith the executable.
Evaluating additional triggers...done
Initializing interface on TIUSB port...done
Checking firmware compatibility...done
Reading FW version...done
Reading HW version...done
Powering up...done
Configuring...done
Accessing device...done
Reading device information...done
Loading file into device...done
Verifying transfer...done
Resettingdevice...done
Refreshing registers...
/* ----------------------------------------------------------------------------
* UseCase : MSP430Flasher.exe
* Arguments : -n MSP4302553 -w bin/Release/CB_MSP430_test001.a43 -v -g -z [VCC]
* ATTENTION: Default options used due to invalid argument list.
* ----------------------------------------------------------------------------
* Driver : loaded
* Dll Version : 20409001
* FwVersion : 30394216
* Interface : TIUSB
* HwVersion : E 2.0
* Mode : AUTO
* Device : MSP430G2xx3
* EEM : Level 1, ClockCntrl 1
* Prog.File : bin/Release/CB_MSP430_test001.a43 (ERASE_ALL, verified = TRUE)
* BSL Unlock: FALSE
* InfoA Access: FALSE
* VCC ON : TRUE
* UseCase specific tasks: ----------------------------------------------------
* Powering up...done
* Disconnectingfromdevice...
* ----------------------------------------------------------------------------
* Driver : closed (No error)
* ----------------------------------------------------------------------------
*/
Process terminated withstatus0 (0 minutes, 7 seconds)
0 errors, 0 warnings
MSP430开发环境MSPGCC+Codeblock 相关文章:
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)
- Windows CE 进程、线程和内存管理(二)(11-09)