新闻中心

EEPW首页>嵌入式系统>设计应用> msp430几种不同开发平台的对比

msp430几种不同开发平台的对比

作者: 时间:2016-11-25 来源:网络 收藏
TinyOS (moteiv & mica)
编辑器
没有特定的编辑器,记事本类似的都行,保证所编辑的源文件是“.nc”结尾的nesC程序。
工程管理
一个目录即为一个工程,包括一个makefile檔和一个或多个“components”,组件有两种:
1. 配件(configuration):描述不同组件之间的关系;
2. 模块:(module):描述组件提供的接口中的函数功能的实验过程。
开发环境
在windows下安装cygwin环境,并在cygwin下安装TinyOS的开发工具包,其中包括
avr-binutils, 二进制代码工具
avr-gcc,
avr-insight,
avr-libc,
nesC-1.1.2 nesC编译器
编译、运行和下载
TinyOS支持多种硬件平台,每个硬件平台在tos/platform有自己的目录。
在应用程序的目录里/app/Blink下输入:
make tmote //其中tmote代表的是平台种类。如果target为pc,刚生成的main.exe可
//用于GDB的调试。
上面的语句实际上是按照当前目录的makefile文件运行的,makefile檔中包含了编译、连接等。具体的实现如下:
1.ncc编译链接: #ncc –o main.exe –target=tmote Blink.nc //编译生成了main.exe,可以作
//PC机上的模拟之用。
2.转换: #msp430-objcopy –output-target=ihex main.exe main.ihex //生成了main.ihex
下载:运行: #make tmote reinstall,1 //设置网络地址为1
其中运行过程中主要的两个命令如下:
installing tmote bootloader using bsl ####安装启动引导檔,根据开发板的不同而不同。
tos-bsl –telosb –c 7 –r –I –p C:/cygwin/opt/moteiv/tos/lib/Deluge/TOSBoot/build/tmote/main.ihex
installing tmote binary using bsl #####安装二进制程序。ihex与ihex.out-1文件相同
tos-bsl –telosb –c 7 –r –I –p build/tmote/main.ihex.out-1
make过程分析
其中提到的目录说明如下:(具体参照上面的图)
opt inyos-1.x oslib ----------------------------------------包括了用到的库函数.
opt inyos-1.x osinterfaces----------------------------------包括接口函数,
opt inyos-1.x osplatform----------包括了不同硬件平台间的配置文件.(启动引导檔在这里)
opt inyos-1.x ossensorboards ------------------------------包括板载传感器的具体实现
可以看到所有的程序都是调用了同一个make规则,除了工程本身所在目录的makefile文件与本工程相关外,在opt inyos-1.xapps目录下的makerule文件是公用的,其中定义了选用的编译器及硬件平台的选择。
TinyOS操作系统设计思想
1.轻量级线程技术(lightweight thread)
2.主动消息通信技术(active message)
3.事件驱动模块(event driver)
4.组件化编程(component-based programming)
nesC语言把组件化/模块化思想和基于事件驱动的执行模型结合起来。
组件化:其中的组件即“Configuration”(配件)、“Module”。两个东西就像零件一样组合在一起。
模块化:
MSPGCC
编辑器
可以配置一些IDE(集成开发环境),如VIM、UltraEdit、CodeBlocks等,其中VIM是命令行的,用起来很有感觉,CodeBlocks是开源的,UltraEdit为商业软件。但不管怎么样,都是调用的mspgcc安装程序里的make.exe,调试环境是msp430-insight
工程管理
用UltraEdit可以很好的管理工程文件,在工程目录里面应该有一个makefile檔,告诉make如何去生成所要的目录文件和文件之间的依赖关系。同样,用开源的CodeBlocks也可以自己搭建一个很好的IDE,鉴于对CodeBlocks都比较熟悉,即采用之!
开发环境
在windows下安装mspgcc-2007021.exe,注意,这里最好是安装最新版的,在之前我下载的是2003版的,又很多工具都不全,导致一个人摸索了好久。
然后在CodeBlocks里的“settings”项里配置相关的compiler和debugger,最重要的部分是库函数所在的目录位置。
编译、运行和下载
编译和链接部分基本上和相同,只是分别调用的是msp430-gcc.exe、msp430-ld.exe
下载是通过msp430-downloader.exe来下载的。
make过程分析
下面是makefile文件的部分分析:
${NAME}.elf: ${OBJECTS} #######################msp430-gcc进行编译
msp43o-gcc.exe -mmcu=${CPU} -o $@ ${OBJECTS} ####生成了 “*.elf”文件
${NAME}.a43: ${NAME}.elf ##################目标文件进行转换
msp430-objcopy -O ihex $^ $@ ##################将elf文件转换为*.a43文件
${NAME}.lst: ${NAME}.elf ##################反汇编,生成*.lst文件,其中
msp430-objdump -dSt $^ >$@ ##################这个文件包含了c源码,汇 ##################编原码
download-jtag: all
msp430-jtag -e ${NAME}.elf
download-bsl: all #####这里的下载工具也是bsl,和TinyOS的tos-bsl类似
msp430-bsl -e ${NAME}.elf
其中,*.a43为TI-Text格式, *.hex为Intel-hex格式.
IAR_MSP430
编辑器
IAR Embedded Workbench IDE一个瑞士开发的商用软件的,价格好象在6500.00;目前个人感觉相比开源的MSPGCC也没太大的优势。
工程管理
一个“.eww ”即为一个工程,
开发调试环境
编译、运行和下载
编译:调用“icc430.exe”编译器和已经设定好的一些参数,包括指定的动态库文件,输出文件所在的目录,具体的代码好下:
icc430.exe -I D:Program FilesIAR SystemsEmbedded Workbench 4.0430INC
-I D:Program FilesIAR SystemsEmbedded Workbench 4.0430INCDLIB
-o C:Documents and SettingsAdministratorMy DocumentsDebugObj
-z3 --no_cse --no_unroll --no_inline --no_code_motion --no_tbaa --debug -e --double=32
-D_DLIB_CONFIG_FILE=D:ProgramFilesIARSystemsEmbeddedWorkbench4.0430LIBDLIBdl430fn.h
D:Program FilesIAR SystemsEmbedded Workbench 4.0430FET_examplesfet140C-sourcefet140_1.c
运行上面的命令之后,在“..obj”目录下生成了“*.r43”文件。(The Obj directory is the destination directory for the object files from the compiler and the assembler. These files have the extension r43 and will be used as input to the IAR XLINK Linker.)
链接:这里调用的是“xlink.exe”,具体的代码好下:
xlink.exe C:Documents and SettingsAdministratorMy DocumentsDebugObjfet140_1.r43
-o C:Documents and SettingsAdministratorMy DocumentsDebugExeSMC4200.d43 –I D:Program FilesIAR SystemsEmbedded Workbench 4.0430LIB
-f D:Program FilesIAR SystemsEmbedded Workbench 4.0430CONFIGlnk430F149.xcl
-f D:Program FilesIAR SystemsEmbedded Workbench 4.0430configmultiplier.xcl -D_STACK_SIZE=50
-rt D:Program FilesIAR SystemsEmbedded Workbench 4.0430LIBDLIBdl430fn.r43
-e_PrintfLarge=_Printf
-e_ScanfLarge=_Scanf
-D_HEAP_SIZE=50
-s __program_start
##### -o This option creates a UBROF output file, with a DE>d43DE> filename extension, to be used with the IAR C-SPY Debugger. (The Exe directory is the destination directory for the executable file. It has the extension d43 and will be used as input to the IAR C-SPY Debugger. Note that this
directory will be empty until you have linked the object files.) < > P66
下载:
在下载部分,IAR没有给出很详细的,
总结:
下面是和IAR、Jennic及TinyOS平台做的对比:
开发工具包
IAR
Jennic
TinyOS
MSPGCC
compiler
编译器
C Compiler
icc430.exe
ba-elf-gcc.exe
ncc.exe
msp430-gcc.exe
msp430-gcc.exe
C++ Compiler
ba-elf-g++.exe
msp430-g++.exe
Linker
链接器
动态库的链接器
xlink.exe
ba-elf-ld.exe
msp430-ld.exe
静态库的链接器
?
ba-elf-ar.exe
msp430-ar.exe
Debugger
ba-elf-gdb.exe
msp430-gdb.exe
make
Make.exe
Make.exe
Make.exe
Download file
?
*.bin
*.hex.out-1 (tmote)
*.elf *.hex *.txt
downloader
tos-bsl
download-bsl
AVRGCC、ARMGCC和MSPGCC
IAR
ü application and library projects.
ü The Obj directory is the destination directory for the object files from the compiler and the assembler. These files have the extension r43 and will be used as input to the IAR XLINK Linker(< > P69)
嵌入式开发,C语言不可或缺。优秀的编译器直如倚天屠龙。读书时,用过MSP430,编译器为IAR(盗版),code有2K限制。为此,曾攻读过专门以此器为背景的C语言书(蓝封面,北航社,忘其名)。此器,功能强大,调试方便,硬件寄存器皆有显示。窥430之门径,离Hello World之苦海,伴我几易寒暑,初踏嵌入式之地者,正是此器。
后,一直未曾用430。前些天,某任务要用。我重拾往日之事。IAR终为不完全盗版,破解太烦。懒,不愿做。放狗搜,见mspgcc,版本号:20081230。与gcc一脉传承,想必不错。试用几日,感觉这才是利器!
上一页 1 2 下一页

关键词:msp430开发平

评论


技术专区

关闭