TinyOS2.x安装
安装TinyOS需要六个步骤

安装TinyOS需要六个步骤。
1.Installing a Java 1.5 JDK.安装java jdk 1.5需要配置环境变量2.Install Cygwin.安装Windows下的Linux模拟器,cygwin3.Installing native compilers.安装单片机工具,AVR或MSP430,根据自己需要。
4.Installing the nesC compiler.安装nesC和TinyOS_tool5.Installing the TinyOS source tree.安装TinyOS2.0.2主文件。
6.Installing the Graphviz visualization tool安装Graphviz并配置环境变量一.安装JDK 1.5下载JDK 2.5 在SUN的官方网站/. 安装并配置JDK的环境变量。
二.安装Cygwin下装Cygwin-1.2a于/dist-1.2.0/tools/windows/cygwin-1.2a.tgz这个版本TinyOS官方测试过,和TinyOS兼容度高。
三.安装单片机工具下载以下五个rpm包1.avr-binutils-2.15tinyos-3.cygwin.i386.rpm(/di st-2.0.0/tools/windows/avr-binutils-2.15tinyos-3.cygwin.i386.rpm)2.avr-gcc-3.4.3-1.cygwin.i386.rpm(/dist-2.0.0/t ools/windows/avr-gcc-3.4.3-1.cygwin.i386.rpm)3.avr-libcavr-libc-1.2.3-1.cygwin.i386.rpm(/dist-2.0.0/too ls/windows/avr-libc-1.2.3-1.cygwin.i386.rpm)4.avariceavarice-2.4-1.cygwin.i386.rpm(/dist-2.0.0/tools/ windows/avarice-2.4-1.cygwin.i386.rpm)5.insight (avr-gdb) avr-insight-6.3-1.cygwin.i386.rpm(/dist-1.2.0/to ols/windows/avr-insight-6.3-1.cygwin.i386.rpm)下载完成之后把五个包都拷贝到Cygwin的tmp文件夹(在Windows操作即可) 依次安装(要按照顺序安装,它们之间有依赖关系),安装命令如下。
TinyOS2.x安装指南

一.TinyOS安装官方说明:/tinyos-2.x/doc/html/install-tinyos.html/index.php/Installing_TinyOS_2.1#Manual_installation_on_your_host_OS_ with_RPMs开发基础:熟悉Linux环境及常用Linux命令;熟悉嵌入式系统开发流程;精通模块设计的思想;能深刻理解交叉编译和MAKE等概念;熟悉C,nesC两种编程语言;对C++,JAVA有一定了解;对ZigBee协议熟悉且具有一定的通信基础,能深刻理解地址、通道等概念。
1.JAVE JDK 安装首先,我们安装JAVE 开发工具JAVE JDK :Java SE Development Kit (JDK) 5/6下载地址:/javase/downloads/index.jsp 下载的默认文件名为:jdk-6u10-windows-i586-p.exe / jdk-1_5_0-windows-i586.exe安装过程只需下一步……下一步便可……然后,我们需要设置电脑的环境变量,需要新建两个环境变量,以便使用JDK具体过程如下:右击我的电脑——〉属性——〉高级——〉环境变量——〉系统变量(S)栏——〉新建(W)——〉新建系统变量对话框如下图:变量名(N):JAVA_HOME变量值(V):JDK安装的路径,默认路径为:C:\Program Files\Java\jdk1.6.0_10C:\Program Files\Java\jdk1.5.0变量名(N):CLASSPATH变量值(V):.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;;%JAVA_HOME%\bin;%JAVA_HOME%\jr e\bin;在用户变量的PATH中添加:;%JAVA_HOME%\bin:$PATH;%JAVA_HOME%\jer\bin:$PATH;在系统变量(S)栏选中变量为Path的选项,点编辑在变量值(V)的末尾添加:;%JAVA_HOME%\bin; ;%JAVA_HOME%\jre\bin;系统变量里最好也同样再设置一个CLASSPATH。
tinyos编译环境搭建(windows)

将Tinyos2.x移植到cc2530编译环境的搭建流程:在windows下建立cygwin平台,并搭建Tinyos的编译环境,然后将基于Tinyos的应用程序编译成hex文件,通过仿真器下载到cc2530片子上运行。
原材料:硬件(cc2530节点,仿真器等)、软件(Cygwin,Keil,TinyOS 2.x,编译环境配置软件包,SmartRF04 Flash Programer等)。
注意:硬件是原来在IAR下能正常使用的CC2530开发硬件就OK声明:一.里面很多东西我借鉴了网上的资料,并写在后面的参考文献中。
并对一些内容进行了修改和强调,以及我遇到的一些问题的解决方法。
= = = = = = = = = = = = = = = = = = = = = =1.安装Keil (Keil uVersion4)这些资源网上很多,百度和谷歌都可以搜到(注:一定要下载keil uVersion4,不可以下载4以下的版本,因为要运行的是cc2530,4以下的版本会找不到相关的编译平台环境)2.安装java 1.5 JDK我开始用1.6了的,反正一直没成功,不知道是不是这个原因。
最好就用1.5这个版本吧。
安装完了在命令行中:java –verson ,出现“java version “1.5.0”表示是1.5版本了。
3.安装Cygwin(1)下载Cygwin,我是在这里下载的:/index.php/Installing_TinyOS_2.0.2#Manual_installation_on_your_host_OS_with_RPMs,在Setp 2: Install Cygwin中第一步有个cygwin-files.zip,点击即可下载。
这个地址好像也可以下载:rmatik.uni-freiburg.de/people/aslam/cygwin-files.zip(2)安装时先解压下载的cygwin,点击setup.exe即可,默认安装在c盘下。
TinyOS 2.x 入门教程

TinyOS 2.x 编程入门教程Version 1.02010/12/17目录前言 (1)第1章编程环境的建立 (2)1.1安装J AVA 1.6JDK (2)1.2安装CWGWIN(WINDOW ONLY) (2)1.3安装编译器 (3)1.4安装T INY OS工具 (3)1.5设置环境变量 (4)1.6安装G RAPHVIZ (4)1.7检测软件安装情况 (4)1.8USB串口驱动下载及安装 (5)第2章TINYOS简介 (7)2.1NES C语言简介 (7)2.1.1组件(components) (7)2.1.2并发模型 (11)2.2常用MAKE命令简介 (12)2.3应用举例:B LINK ---T INY OS编程的“H ELLO W ORLD”程序 (12)2.3.1Blink配件 (13)2.3.2BlinkC模块 (14)2.3.3事件evenst和命令commands (16)2.3.4编译Blink应用程序 (17)2.3.5安装Blink程序到Telosb节点并运行 (17)2.4下载程序出错故障排除 (18)2.5小结 (20)第3章TELOSB硬件平台常用可编程器件和对应的TINYOS组件介绍 (21)3.1L ED (22)3.1.1Telosb硬件平台上的Led器件展示 (22)3.1.2TinyOS中Led编程组件介绍 (22)3.2传感器 (23)3.2.1Telosb硬件平台上的传感器展示 (23)3.2.2TinyOS中传感器编程组件介绍 (24)3.3串口 (25)3.3.1Telosb硬件平台上的串口展示 (25)3.3.2TinyOS中串口编程组件介绍 (26)3.4R ADIO (26)3.4.1Telosb硬件平台上的Radio相关器件展示 (26)3.4.2TinyOS中Radio编程组件介绍 (27)3.5小结 (27)第4章用事件驱动方式从传感器获取数据 (27)4.1模块实现 (28)4.2ADC (30)第5章TINYOS任务及应用举例 (32)5.1任务的创建和调度 (32)5.2举例:S ENSE T ASK应用程序 (33)5.3小结 (33)第6章TINYOS串口编程 (34)6.1T EST S ERIAL应用程序 (34)6.2串口助手:PC上显示从串口读取的数据 (38)6.3T ELOSB从串口读取数据 (39)6.4O SCILLOSCOPE应用程序——数据感知 (41)6.5B ASE S TATION应用程序 (45)6.6小结 (51)附录1 TINYOS命名约定 (52)附录2 NESC语言特有关键字 (54)前言随着传感器技术、微机电系统、现代网络、无线通信、低功耗等技术的飞速发展,推动了无线传感器网络 (WSN:wireless sensor network) 的产生和发展。
TinyOs的安装方法

Windows环境下安装TinyOs的方法第一步: Install Java 1.5 JDKWindowsDownload and install Sun's 1.5 JDK from .安装jkd环境变量设置如下:变量名变量值path C:\Program Files\Java\jdk1.5.0_11\binjava_home C:\Program Files\Java\jdk1.5.0_11classpath C:\Program Files\Java\jdk1.5.0_11\lib\tools.jar;C:\ProgramFiles\Java\jdk1.5.0_11\jre\lib\rt.jarWARNING: CLASSPA TH may not include '.' (that is, the symbol for the current working directory). Please add '.' to your CLASSPA TH or you may experience configuration problem.问题解决方法:1.CLASSPA TH=`.:$TOSROOT/tools/java/javapath`2..;C:\tinyos\jdk1.4.1_02\j2sdk1.4.1_02\bin;C:\tinyos\jdk1.4.1_02\j2sdk1.4.1_02\lib\tools.jar第二步: Install CygwinThis step is required for Windows installations only. If you are installing on Linux, skip to step 3. We have put online the cygwin packages that we've confirmed to be compatible with TinyOS. The instructions below use those packages. Y ou can also upgrade your cygwin environment according to the instructions at and your environment will most likely work. A large number of TinyOS users, upgrade their cygwin packages at least monthly from cygnus. However, since we can't test what packages are compatible as they become available daily, we can't confirm that today's set will work.1.Download and install Cygwin from .2.Download the confirmed-compatible cygwin packages from the tinyos web site here.3.In a cygwin shell, unzip the above package into some directory. In these instructions the directory is /cygdrive/c/newcygpkgs.$ cd /cygdrive/c/newcygpkgs$ tar zxvf cygwin-1.2a.tgzThis unzips the packages.4.In Windows Explorer, navigate to /cygdrive/c/newcygpkgs and click on the file setup.exe. Setup.exe is the setup program distributed by Cygnus Solutions.5.Follow these steps when the Cygwin Setup windows appears:Opt to disable the virus scanner (it will be enabled when you're finished).Opt to Install from Local Directory.6.Specify the Root directory to be where your current cygwin installation is. This would be the directory that directories like 'opt' and 'usr' are in. For example, mine is rooted at c:\tinyos\cygwin, so I enter that.7.Select to Install for All Users8.Select the Unix file type (very important!)9.For the Local Packages Directory, specify where you unzipped the cygwin packages tarfile. For example, I would specify c:\newcygpkgs. (The setup.exe program will probably select the right default directory.)10.The next window will allow you to select packages to install. Y ou should see that most of the packages have an X-ed box next to them; these are the packages that are to be installed.11.Click install. Some notes:Y ou might see a message explaining that you need to reboot because some files are in use. This most likely means that your cygwin DLL is loaded and in-use and, therefore, cannot be replaced. When you reboot, the new DLL will be loaded.Related to the above warnings, if you see warnings about the cygwin1.dll not being found, don't worry. All will be well once you reboot and the right DLL is loaded.第三步:Download and install Sun's m package在cygwin下unzip javacomm20-win32.zipcd commapicp win32com.dll "C:\Program Files\Java\jdk1.5.0_11\jre\bin"chmod 755 "C:\Program Files\Java\jdk1.5.0_11\jre\bin\win32com.dll"cp comm.jar "C:\Program Files\Java\jdk1.5.0_11\jre\lib\ext"cp m.properties "C:\Program Files\Java\jdk1.5.0_11\jre\lib"第四步Install native compilersInstall the appropriate version of the following (Windows or Linux, avr or msp430 or both) with the rpm command 'rpm -ivh '. On windows, if you get an error claiming that the rpm was build for an NT computer and you're on a windows NT computer, bypass the erroneous error by using 'rpm -ivh --ignoreos rpmname'. (We have xscale compiler tools online at /dist-1.2.0/tools/ but they have not yet been extensively tested by a large community.)Atmel AVR ToolsTool Windows/Cygwin Linuxavr-binutils†avr-binutils-2.15tinyos-3.cygwin.i386.rpm avr-binutils-2.15tinyos-3.i386.rpm avr-gcc avr-gcc-3.4.3-1.cygwin.i386.rpm avr-gcc-3.4.3-1.i386.rpmavr-libc avr-libc-1.2.3-1.cygwin.i386.rpm avr-libc-1.2.3-1.i386.rpmavarice avarice-2.4-1.cygwin.i386.rpm avarice-2.4-1.i386.rpminsight(avr-gdb)avr-insight-6.3-1.cygwin.i386.rpm avr-insight-6.3-1.i386.rpm†If you receive an rpm error that indicates that you have a newer version already installed, try rpm -Uvh --force第五步Install TinyOS toolchainThe TinyOS-specific tools are the NesC compiler and a set of tools developed in the tinyos-2.x/tools source code repository. They are also installed using rpms. If you using the Cygwin version recommended in these install instructions, you should install the "Recommended" Windows/Cygwin nesC RPM. If you get strange errors when you try to compile TinyOS programs, such as the error message "the procedure entry point basename could not be located in the dynamic link library cygwin1.dll", this is likely due to a Cygwin version incompatibility: try the "Other" Windows/Cygwin RPM (1.2.7a). If you are using Cygwin and installing the nesC RPM causes an error that the RPM was built for Cygwin, add the --ignoreos option.TinyOS-specific ToolsTool RecommendedWindows/CygwinOther Windows/Cygwin Linux CommandNesC nesc-1.2.8a-1.cygwin.i386.rpmnesc-1.2.8b-1.cygwin.i386.rpmnesc-1.2.8a-1.i386.rpmrpm-Uvhrpm-Uvh--ignoreos (ifCygwincomplains)tinyos-t ools tinyos-tools-1.2.3-1.cygwin.i386.rpmtinyos-tools-1.2.3-1.cygwin.i386.rpmtinyos-tools-1.2.3-1.i386.rpmrpm-ivh--force (1.x tree)rpm-Uvh (no1.x tree)第六步Install the TinyOS 2.x source treeNow that the tools are installed, you need only install the tinyos 2.x source tree and then set your environment variables. Install the appropriate version of the following (Window or Linux) with the rpm command 'rpm -ivh '. As with the previous rpms, if you get an error claiming that the rpm was build for an NT computer and you're on a windows NT computer, bypass the erroneous error by using 'rpm -ivh --ignoreos rpmname'.∙Install tinyos-2.xTinyOS 2.xWindows/Cygwin LinuxTinyOS tinyos-2.0.1-5.cygwin.noarch.rpm tinyos-2.0.1-5.noarch.rpm ∙Configure your environmentIdeally, you'll put these environment variables in a shell script that will run when yourshell starts, but you needn't put such a script under /etc/profile.d.The example settings below assume that the tinyos-2.x installation is in /opt/tinyos-2.x.Change the settings to be correct for where you've put your tinyos-2.x tree. Note that thewindows CLASSPATH must be a windows-style path, not a cygwin path. You cangenerate a windows style path from a cygwin-style path using 'cygpath -w'. For example:export CLASSPATH=`cygpath -w$TOSROOT/support/sdk/java/tinyos.jar`export CLASSPATH="$CLASSPATH;."TinyOS 2.xEnvironment VariableWindows Linux TOSROOT /opt/tinyos-2.x same as in Cygwin TOSDIR $TOSROOT/tos same as in CygwinCLASSPAT H C:\tinyos\cygwin\opt\tinyos-2.x\support\sdk\java\tinyos.jar;.$TOSROOT/support/sdk/java/tinyos.jar:.MAKERULES$TOSROOT/support/make/Makerules same as in CygwinPATH†/opt/msp430/bin:$PATH same as in Cygwin†Only necessary if you're using the MSP430 platform/tools.In addition to the above environment variables, do the following on Linux machines:1.Change the ownership on your /opt/tinyos-2.x files: chown -R <youruid> /opt/tinyos-2.x2.Change the permissions on any serial (/dev/ttyS<N>), usb (/dev/tts/usb<N>,/dev/ttyUSB<N>), or parallel (/dev/parport) devices you are going to use:chmod 666 /dev/<devicename>Finally, if you have installed TinyOS 2.0.1, there is a bug in TOSSIM (which will be fixed in 2.0.2). The bug is in file tos/chips/atm128/sim/atm128_sim.h. Change these lines 22 and 23 from:#define _SFR_IO8(io_addr) _MMIO_BYTE((io_addr) + 0x20)#define _SFR_IO16(io_addr) _MMIO_WORD((io_addr) + 0x20) to#define _SFR_IO8(io_addr) _MMIO_BYTE((io_addr))#define _SFR_IO16(io_addr) _MMIO_WORD((io_addr)) If you do not do this, then timers will not work correctly.第七步Installing GraphvizGo to download page of the Graphviz project and download the appropriate RPM. Y ou only need the basic graphviz RPM (graphviz-); you don't need all of the add-ons, such as -devel, -doc, -perl, etc. If you're not sure what version of Linux you're running,uname -amight give you some useful information. Install the rpm with rpm -i rpm-name. In the case ofWindows, there is a simple install program, so you don't need to deal with RPMs. 下载1.10版/tos/dist-1.1.0/tools/windows/graphviz-1.10.exeand install it by executing it.第八步在/etc/profile.d下建立tinyos.sh文件内容如下:export TOSROOT=/opt/tinyos-2.xexport TOSDIR=$TOSROOT/tosexport CLASSPA TH=`cygpath -w $TOSROOT/support/sdk/java/tinyos.jar` export CLASSPA TH="$CLASSPA TH;."export MAKERULES=$TOSROOT/support/make/Makerulestype java >/dev/null 2>/dev/null || PA TH='/usr/local/bin/locate-jre --java':$PA TH type javac >/dev/null 2>/dev/null || PA TH='/usr/local/bin/locate-jre --javac':$PA TH echo $PA TH | grep -q /usr/local/bin || PA TH=/usr/local/bin:$PA TH第九步Tos-check-env。
TinyOS在windows中安装步骤

1.TinyOS1.1概要TinyOS应用程序都是有一个或多个组件链接起来,从而形成一个完整的可执行程序。
组件中实现了功能接口,同时也能使用其它组件提供的接口。
在接口定义中可以申明命令函数和事件函数,命令函数由接口提供者实现,事件函数由接口使用者实现。
对于一个组件而言,如果它要使用某个组件接口中的命令,它必须实现这个接口的事件。
一个组件可以使用或提供多个接口以及同一个接口的多个实例。
组件有两种类型:模块(module)和配置(configuration)。
模块提供应用程序代码,实现一个或多个接口;配置则是用来将其它组件装配起来,将各个组件所使用的接口与其它组件提供的接口连接在一起,进行导通。
每个应用程序都由一个顶级配置所描述,其内容就是将该应用程序所用到的所有组件导通起来,形成一个有机整体。
TinyOS应用程序必须包含Main 组件,Main组件是首先被执行的一个组件。
确切的说,在TinyOS 中执行的第一个命令是Main.StdControl.init(),接下来是Main.StdControl.start()。
Main组件完成以下功能:芯片初始化,外围电路初始化,操作系统调度数据结构初始化,子组件初始化,启动子组件件,进入调度死循环从而将控制权交给操作系统,一旦没有任务可以调度就进入休眠状态以降低系统功耗。
TinyOS的调度系统是TinyOS系统的核心部分。
它采用先进先出的排队策略,任务之间不可以抢占,但是中断可以抢占任务,中断是否可以抢占中断则是应用程序自己控制的。
即如果中断处理程序进入中断以后执行了关中断的操作,那么这个中断将是不可抢占的,否则在服务的过程中就有可能被抢占掉。
另外还要注意,在中断服务程序里面是可以创建任务的。
1.2在Cygwin下的安装在/etc/bash.bashrc文件中增加以下内容:export TOSROOT=/opt/tinyos-2.xexport TOSDIR=$TOSROOT/tosexport CLASSPATH=C:\cygwin\opt\tinyos-2.x\support\sdk\java\tinyos.jarexport CLASSPATH="$CLASSPATH;."export MAKERULES=$TOSROOT/support/make/Makerulesexport PATH=/opt/msp430/bin:/opt/jflashmm:$PATH安装以下软件包:rpm -ivh --ignoreos c:/downloads/avr-binutils-2.17tinyos-3.cygwin.i386.rpmrpm -ivh --ignoreos c:/downloads/avr-gcc-4.1.2-1.cygwin.i386.rpmrpm -ivh --ignoreos c:/downloads/avr-libc-1.4.7-1.cygwin.i386.rpmrpm -ivh --ignoreos c:/downloads/avarice-2.4-1.cygwin.i386.rpmrpm -ivh --ignoreos c:/downloads/avr-insight-6.3-1.cygwin.i386.rpmrpm -ivh --force --nodeps c:/downloads/avrdude-tinyos-5.6cvs-1.cygwin.i386.rpmrpm -ivh --ignoreos c:/downloads/nesc-1.3.1-1.cygwin.i386.rpmrpm -ivh --ignoreos c:/downloads/tinyos-deputy-1.1-1.cygwin.i386.rpmrpm -ivh --ignoreos c:/downloads/tinyos-tools-1.4.0-3.cygwin.i386.rpmrpm -ivh --ignoreos c:/downloads/tinyos-2.1.1-3.cygwin.noarch.rpmrpm -ivh --ignoreos c:/downloads/msp430tools-base-0.1-20050607.cygwin.i386.rpm rpm -ivh --ignoreos c:/downloads/msp430tools-python-tools-1.0-1.cygwin.noarch.rpm rpm -ivh --ignoreos c:/downloads/msp430tools-binutils-2.16-20050607.cygwin.i386.rpm rpm -ivh --ignoreos c:/downloads/msp430tools-gcc-3.2.3-20050607.cygwin.i386.rpm rpm -ivh --ignoreos c:/downloads/msp430tools-libc-20080808-1.cygwin.i386.rpmrpm -ivh --ignoreos c:/downloads/xscale-elf-binutils-2.15-1.cygwin.i386.rpmrpm -ivh --ignoreos c:/downloads/xscale-elf-gcc-3.4.3-1.cygwin.i386.rpmrpm -ivh --ignoreos c:/downloads/xscale-elf-newlib-1.11.0tinyos-1.cygwin.i386.rpm修改执行/usr/bin/tos-install-jni文件:change: "for lib in $tinyoslibdir/*-$bits.dll" to "for lib in $tinyoslibdir/*.dll"/usr/bin/tos-install-jni修改/usr/bin/python2.5-config文件:change: "/tmp/python.6884/usr/bin/python2.5.exe" to "/usr/bin/python2.5.exe"编译Blink测试是否安装成功:cd /opt/tinyos-2.x/apps/Blinkmake telosbmake mica2make micazmake micaz sim1.3Blink程序结构Blink.nc文件configuration Blink {}implementation {components Main, BlinkM, SingleTimer, LedsC;Main.StdControl -> SingleTimer.StdControl;Main.StdControl -> BlinkM.StdControl;BlinkM.Timer -> SingleTimer.Timer;BlinkM.Leds -> LedsC;}BlinkM.nc文件module BlinkM {provides {interface StdControl;}uses {interface Timer;interface Leds;}}因为它提供了StdControl 接口,所以它必须实现StdControl.init(),StdControl.start()及StdControl.stop()等命令,因为它使用了Timer接口,所以它必须实现Timer.fired()事件implementation {command result_t StdControl.init() {call Leds.init();return SUCCESS;}command result_t StdControl.start() {// Start a repeating timer that fires every 1000msreturn call Timer.start(TIMER_REPEAT, 1000);}command result_t StdControl.stop() {return call Timer.stop();}event result_t Timer.fired(){call Leds.redToggle();return SUCCESS;}}。
Win7上安装Tinyos2.x步骤 其实最后我还是用的虚拟机

Win7上安装Tinyos步骤:Step1. 按照文件GettingStarted_Imote2_v2.pdf上的step1安装cygwin,添加源的时候可以用(电信)ftp:///sites//pub/cygwin/;(教育网bras@a/b可以连接到的)/pub/(参考:/site/install/ 按照安装步骤,在url site中添加cygwin中国镜像地址/pub/,之后的安装就很快了。
)Step2. 按照网页/index.php/Installing_and_Configuring_T2_for_iMote2_on_Win dows_XP(为了防止在一些网络环境下上述网页访问不到,我把这个网页下载下来,放在根目录文件夹Installing and Configuring T2 for iMote2 on Windows XP - TinyOS Documentation Wiki)中的step1 安装java(1.5以上版本,配置环境变量);step2 已经安装过了;step3 tinyos2.xtree下载完以后,要安装rpm --ignoreos -ivh tinyos-tools-1.2.4-2.cygwin.i386.rpm,安装这个rpm时可能会被告知貌似权限不够,由于cygwin没有root用户,所以不用担心;Step4 Download the TinyOS 2.x Contrib Tree ;step5 Downloading and Installing NesC from CVS;step6 Downloading and Installing NesC from RPM;(step5和step6之选其中一个安装就好了,我安装的是step6)step7 Setting up the Intel Mote 2 debug board drivers;(step可选)step8 Downloading and Installing GraphViz;step9 Downloading and Installing the Xscale GCC Binaries没什么好说的,照着装就是咯~~;Step10 Configuring your Environment这个不用管它;中间需要下载几个rpm包;Step3. 上面都装好后,要配置两个文件:~/.bashrc和/etc/profile.d/tinyos.sh。
TinyOS 安装说明

1 CNTTORFMANDLEDS 应用程序 .......................................................................36 2 INTTORFM:发送信息 .....................................................................................39 3 INTTORFMM:实现网络通信..........................................................................41 4 GENERICCOMM 网络堆栈.................................................................................42 5 使用 RFMTOLEDS 接收消息 ............................................................................42 6 一些细节问题...................................................................................................42 7 练习...................................................................................................................43
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
一.TinyOS安装官方说明:/tinyos-2.x/doc/html/install-tinyos.html/index.php/Installing_TinyOS_2.1#Manual_installation_on_your_host_OS_ with_RPMs开发基础:熟悉Linux环境及常用Linux命令;熟悉嵌入式系统开发流程;精通模块设计的思想;能深刻理解交叉编译和MAKE等概念;熟悉C,nesC两种编程语言;对C++,JAVA有一定了解;对ZigBee协议熟悉且具有一定的通信基础,能深刻理解地址、通道等概念。
1.JAVE JDK 安装首先,我们安装JAVE 开发工具JAVE JDK :Java SE Development Kit (JDK) 5/6下载地址:/javase/downloads/index.jsp 下载的默认文件名为:jdk-6u10-windows-i586-p.exe / jdk-1_5_0-windows-i586.exe安装过程只需下一步……下一步便可……然后,我们需要设置电脑的环境变量,需要新建两个环境变量,以便使用JDK具体过程如下:右击我的电脑——〉属性——〉高级——〉环境变量——〉系统变量(S)栏——〉新建(W)——〉新建系统变量对话框如下图:变量名(N):JAVA_HOME变量值(V):JDK安装的路径,默认路径为:C:\Program Files\Java\jdk1.6.0_10C:\Program Files\Java\jdk1.5.0变量名(N):CLASSPATH变量值(V):.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;;%JAVA_HOME%\bin;%JAVA_HOME%\jr e\bin;在用户变量的PATH中添加:;%JAVA_HOME%\bin:$PATH;%JAVA_HOME%\jer\bin:$PATH;在系统变量(S)栏选中变量为Path的选项,点编辑在变量值(V)的末尾添加:;%JAVA_HOME%\bin; ;%JAVA_HOME%\jre\bin;系统变量里最好也同样再设置一个CLASSPATH。
这样,我们的环境变量已经设置完毕了。
我们可以编个JAVA小程序测试简单的测试一下:打开记事本,输入下面这个小程序,另存为HelloWorld.javapublic class HelloWorld {public static void main(String[] args) {System.out.println("Hello, World!");}}运行cmd,到HelloWorld.java所在目录,执行javac HelloWorld.javajava HelloWorld如果能正确输出Hello, World! 说明环境变量设置成功。
2.Cygwin 软件平台安装我们需要安装Cygwin这个软件模仿Linux平台,运行TinyOS-2.X。
下载地址:ftp://:19527/iso/cygwin2.510.2.2.iso或者下载:cygwin-files.zip包解压缩在c:/cygwin-files,安装过程说明:安装时,最好先将安装包下载到本地,然后选择Install from Local Directory安装紧接着需要设置安装目录,设置安装文件的本地储存路径(c:/cygwin-files或其他)等。
安装包策略选择:“Keep”、“Prev”、“Curr”、“Exp”等等选项Keep, 意思就是说保持目前已经安装的版本不动,不替换你目前的版本。
升级时比较方便。
Prev,意思是说安装上一个版本。
Curr,意思就是说把最新的版本下载下来安装"View"按钮是用来选择显示方式的在选择安装包时候,我们需要选择:Archive,Devel(gcc、make等编译工具),Libs,Net,Shells,Utils(rpm等命令) 等等其中安装方式共有这么几类:(1)Default:这是默认选择,可点击包左边的+号展开,看看缺省安装究竟是些什么内容。
(2)Install:表示要下载/安装该包的全部内容。
(3)Reinstall:表示重新下载/安装该包的内容(4)Uninstall:卸载。
剩下的,和一般软件一样,没什么好说的了。
最后我们可以通过桌面上添加Cygwin的快捷方式或者运行安装目录下的cwgwin.bat文件,来运行该软件平台:Cygwin启动界面如下图:下面我们可以先来尝试一些简单的Linux命令:help: 帮助命令。
例如ls --help 。
显示ls命令使用说明。
pwd:显示所在路径。
rpm –qa :查看已经安装的程序,刚安装的Cygwin是没有安装任何系统的。
rpm –ivh 文件名:rpm文件安装。
rpm –ignoreos –force或者rpm -ivh --force --ignoreos:忽略错误,安装rpm文件--ignoreos选项是用于忽略cygwin的版本号cd:切换目录比如:cd /tmp 进入tmp文件。
cp:cp -R Blink BlinkSinglels:显示文件。
whoami:显示登陆Windows帐号uname –a:显示版本信息echo $PATH:显示执行程式的搜索路径ps ax:显示process list ,显示目前有哪些process 执行ctrl-D或exit或logout:结束bash 视窗motelist 查询当前设备3.MSP430工具安装rpm包如下:base msp430tools-base-0.1-20050607.cygwin.i386.rpmpython tools msp430tools-python-tools-1.0-1.cygwin.noarch.rpmbinutils msp430tools-binutils-2.16-20050607.cygwin.i386.rpmgcc msp430tools-gcc-3.2.3-20050607.cygwin.i386.rpmlibc msp430tools-libc-20080808-1.cygwin.i386.rpmjtag Not yet availablegdb Not yet available下载地址:/tinyos-2.x/doc/html/install-tinyos.html将rpm下载到到“…/TinyOS21_tool/MSP430_Tools”文件夹下,运行:$ cd …/TinyOS21_tool\MSP430_Toolsrpm -ivh --ignoreos *.rpm安装成功。
(若提示安装不了,可以先安装TinyOS工具包再回头安装这里)4.TinyOS 工具安装同上,下载rpm包:NesC nesc-1.3.0a-1.cygwin.i386.rpmDeputy tinyos-deputy-1.1-1.cygwin.i386.rpmtinyos-tools tinyos-tools-1.3.0-1.cygwin.i386.rpm将rpm下载到到“…/TinyOS21_tool/ TinyOS_specific_tools”文件夹下,运行:$ cd …/TinyOS21_tool\ TinyOS_specific_toolsrpm -ivh --ignoreos *.rpm安装成功。
5.TinyOS2.X 安装同上,下载rpm包:tinyos-2.1.0-2.cygwin.noarch.rpm将rpm下载到到“…/TinyOS21_tool\TinyOS_2.X”文件夹下,运行:$ cd …/TinyOS21_tool\TinyOS_2.Xrpm -ivh --ignoreos *.rpm安装成功。
6.设置TinyOS2.X 环境变量用UltraEdit创建C:\cygwin\etc\profile.d\tinyos.sh,输入以下内容:(使用UNIX换行符-LF保存) (配置文件已经写好了)# script for profile.d for bash shells, adjusted for each users# installation by substituting /opt for the actual tinyos tree# installation point.export TOSROOT="/opt/tinyos-2.x"export TOSDIR="$TOSROOT/tos"export CLASSPATH="C:\cygwin\opt\tinyos-2.x\support\sdk\java\tinyos.jar"export CLASSPATH="$CLASSPATH;."export MAKERULES="$TOSROOT/support/make/Makerules"export PATH="/opt/msp430/bin:$PATH"export PATH="/cygdrive/c/Program Files/Java/jdk1.6.0_10/bin:$PATH"# Extend path for javatype java >/dev/null 2>/dev/null || PATH=`/usr/local/bin/locate-jre --java`:$PATHtype javac >/dev/null 2>/dev/null || PATH=`/usr/local/bin/locate-jre --javac`:$PATHecho $PATH | grep -q /usr/local/bin || PATH=/usr/local/bin:$PATH执行命令: tos-install-jni如果出现一下错误信息:Installing 32-bit Java JNI code in /cygdrive/c/Program Files/Java/jdk1.6.0_10/jre/bin ...install: cannot stat `/usr/lib/tinyos/*-32.dll': No such file or directory我们需要将以下目录中的toscomm.dll,重命名为:toscomm-32.dllC:\cygwin\lib\tinyosC:\Program Files\Java\jdk1.6.0_10\jre\bintoscomm.dll ——toscomm-32.dll重新tos-install-jni命令。