Windows下TinyOS安装和测试步骤

第一步:安装 Java SE 6 Update 10 RC
   1.下载JAVA JDK SE 6
       http://www.java.net/download/jdk6/6u10/promoted/b32/binaries/jdk-6u10-rc2-bin-b32-windows-i586-p-12_sep_2008.exe
   2.安装(路径)
      [c:\Program Files\Java\jdk1.6.0_10\]
      [c:\Program Files\Java\jre6\]
   3.设置环境变量
     (1) CLASSPATH
     [我的电脑]-[属性]-[高级]-[环境变量]-[系统变量]-[新建]
   变量名:CLASSPATH
   变量值:.;c:\Program Files\Java\jdk1.6.0_10\bin;c:\Program Files\Java\jdk1.6.0_10\lib\tools.jar
   (2) Path
   [我的电脑]-[属性]-[高级]-[环境变量]-[系统变量]-[编辑]  
     变量名:Path
   变量值:%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\ATI Technologies\ATI Control Panel;c:\Program Files\Java\jdk1.6.0_10\bin;c:\Program Files\Java\jdk1.6.0_10\jre\bin
   (3) JAVA_HOME
   [我的电脑]-[属性]-[高级]-[环境变量]-[系统变量]-[新建]
   变量名:JAVA_HOME
   变量值:c:\Program Files\Java\jdk1.6.0_10
    
设置完毕,可以编个JAVA小程序测试简单的测试一下:打开记事本,输入下面这个小程序,另存为HelloWorld.java,为了方便,我直接保存到           C:\下面的。程序为:
public class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello, World!");
    }
}
运行cmd,执行
javac HelloWorld.java
java HelloWorld
如果能正确输出Hello, World! 说明环境变量设置成功。

第二步:安装Cygwin  
   1.从tinyos上下载Cygwin的兼容包
       http://cone.informatik.uni-freiburg.de/people/aslam/cygwin-files.zip
   2.使用winrar解压到[c:\cygwin-installationfiles] 
   3.运行c:\cygwin-installationfiles\setup.exe
    [下一步]-[Install from Local Directory]-[下一步]-[Root Directory输入c:\cygwin]-[下一步]-[Local Package Directory输入c:\cygwin-installationfiles]-[下一步]-[下一步]-[安装]-[完成] 
   4.运行[C:\cygwin\cygwin.bat]
步骤三:安装编译器
   1.安装 Atmel AVR Tools  
    (1) 下载
      * avr-binutils avr-binutils-2.17tinyos-3.cygwin.i386.rpm
         http://www.tinyos.net/dist-2.1.0/tools/windows/avr-binutils-2.17tinyos-3.cygwin.i386.rpm
      * avr-gcc avr-gcc-4.1.2-1.cygwin.i386.rpm
         http://www.tinyos.net/dist-2.1.0/tools/windows/avr-gcc-4.1.2-1.cygwin.i386.rpm
      * avr-libc avr-libc-1.4.7-1.cygwin.i386.rpm
         http://www.tinyos.net/dist-2.1.0/tools/windows/avr-libc-1.4.7-1.cygwin.i386.rpm
      * avarice avarice-2.4-1.cygwin.i386.rpm
         http://www.tinyos.net/dist-2.1.0/tools/windows/avarice-2.4-1.cygwin.i386.rpm
      * insight (avr-gdb) avr-insight-6.3-1.cygwin.i386.rpm
         http://www.tinyos.net/dist-2.1.0/tools/windows/avr-insight-6.3-1.cygwin.i386.rpm
      * avrdude avrdude-tinyos-5.6cvs-1.cygwin.i386.rpm (问题:/bash/bin)
         http://www.tinyos.net/dist-2.1.0/tools/windows/avrdude-tinyos-5.6cvs-1.cygwin.i386.rpm
    (2) 将这些.rpm文件下载到D:\TinyOS21_tools\AVR_Tools下
  (3) 运行[C:\cygwin\cygwin.bat]
  (4) $ cd D:\TinyOS21_tools\
  (5) $ cd avr_tools
  (6) rpm -ivh --ignoreos *.rpm
  (7) 安装成功
    补充:在安装avrdude-tinyos-5.6cvs-1.cygwin.i386.rpm 出现“/bash/bin”不存在的问题
    解决:运行Cygwin的[setup]-[install from internet]-...-[choose a download site]...-安装[Shells]下的所有组件即可  
   2.安装 TI Msp430 ,Tools (注意 cygwin 更新问题)
    (1) 下载
     * base msp430tools-base-0.1-20050607.cygwin.i386.rpm
        http://www.tinyos.net/dist-2.0.0/tools/windows/msp430tools-base-0.1-20050607.cygwin.i386.rpm
     * python tools msp430tools-python-tools-1.0-1.cygwin.noarch.rpm
        http://www.tinyos.net/dist-2.0.0/tools/windows/msp430tools-python-tools-1.0-1.cygwin.noarch.rpm
     * binutils msp430tools-binutils-2.16-20050607.cygwin.i386.rpm
        http://www.tinyos.net/dist-2.0.0/tools/windows/msp430tools-binutils-2.16-20050607.cygwin.i386.rpm
     * gcc msp430tools-gcc-3.2.3-20050607.cygwin.i386.rpm
        http://www.tinyos.net/dist-2.0.0/tools/windows/msp430tools-gcc-3.2.3-20050607.cygwin.i386.rpm
     * libc msp430tools-libc-20080808-1.cygwin.i386.rpm
        http://www.tinyos.net/dist-2.1.0/tools/windows/msp430tools-libc-20080808-1.cygwin.i386.rpm
  (2) 将这些.rpm文件下载到D:\TinyOS21_tools\MSP430_Tools下
  (3) 运行[C:\cygwin\cygwin.bat]
  (4) $ cd D:\TinyOS21_tools
  (5) $ cd MSP430_Tools
  (6) rpm -ivh --ignoreos *.rpm
  (7) 安装成功
步骤四: 安装TinyOS工具
   1.NesC nesc-1.3.0a-1.cygwin.i386.rpm
       http://www.tinyos.net/dist-2.1.0/tinyos/windows/nesc-1.3.0-1.cygwin.i386.rpm 
   2.Deputy tinyos-deputy-1.1-1.cygwin.i386.rpm
       http://www.tinyos.net/dist-2.1.0/tinyos/windows/tinyos-deputy-1.1-1.cygwin.i386.rpm
   3.tinyos-tools tinyos-tools-1.3.0-1.cygwin.i386.rpm  
       http://www.tinyos.net/dist-2.1.0/tinyos/windows/tinyos-tools-1.3.0-1.cygwin.i386.rpm
   4.将这些.rpm文件下载到D:\TinyOS21_tools\TinyOS_specific_Tools下
 5.运行[C:\cygwin\cygwin.bat]
 6.$ cd D:\TinyOS21_tools
 7.$ cd TinyOS_specific_Tools
 8.rpm -ivh --ignoreos *.rpm
 9.安装成功
步骤五: 安装TinyOS 2.X
   1. TinyOS tinyos-2.1.0-1.cygwin.noarch.rpm
     http://www.tinyos.net/dist-2.1.0/tinyos/windows/tinyos-2.1.0-1.cygwin.noarch.rpm
 2. 将这些.rpm文件下载到D:\TinyOS21_tools\TinyOS下
 3. 运行[C:\cygwin\cygwin.bat]
 4. $ cd D:\TinyOS21_tools  
 5. $ cd TinyOS
 6. rpm -ivh --ignoreos *.rpm
 7. 安装成功
步骤六: 设置环境变量
 1.用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"
  # Extend path for java
type java >/dev/null 2>/dev/null || PATH=`/usr/local/bin/locate-jre --java`:$PATH
type javac >/dev/null 2>/dev/null || PATH=`/usr/local/bin/locate-jre --javac`:$PATH
echo $PATH | grep -q /usr/local/bin || PATH=/usr/local/bin:$PATH
这是从我的文件直接复制过来的,如果输入保存还是不行,可以跟我要这个文件
步骤七: 安装 Graphviz (版本1.1)
   1.注意不能到 http://www.graphviz.org/Download..php下载graphviz-2.12.exe
 2.应该下载 http://webs.cs.berkeley.edu/tos/dist-1.1.0/tools/windows/graphviz-1.10.exe
 3.在windows环境下,安装到D:\Program Files\ATT目录下
步骤八: 环境测试
   1.运行[C:\cygwin\cygwin.bat]
 2.$ tos-check-env
 3.最后出现一个WARNING:java 1.4 or java 1.5 的需求
 
步骤九:运行Blink测试程序  
    1.进入目录:\cygwin\opt\tinyos-2.x\apps\Blink
    2.编写文件:C:\cygwin\opt\tinyos-2.x\apps\Blink\Blink.py
      #! /usr/bin/python
from TOSSIM import *
import sys
t=Tossim([]);
t.addChannel("BlinkC",sys.stdout)
t.getNode(1).bootAtTime(10000);
for i in range (0,100):
 t.runNextEvent()
    3. $ make micaz sim
    4. $ python Blink.py
    5.显示模拟结果

插上节点,使用motelist命令,不能识别结点,于是就去下载结点的USB驱动http://www.ftdichip.com/Drivers/VCP.htm

发现还是不行,于是进入http://www.tinyos.net/dist-1.1.0/tinyos/windows/

选择tinyos-1.1.11-3is.exe 下载,安装它,选择前面没有安装的几个,不选择cygwinjava因为前面已经安装过了,这样的话,tinyos1.xtinyos2.x并存,环境检测tos-check-env,没问题。现在再插上节点,motelist,可以识别了

 

你可能感兴趣的:(Tinyos)