tinyos安装
Document Sample


第一步: Install Java 1.5 JDK
Windows
Download and install Sun's 1.5 JDK from http://java.sun.com.
安装 jkd 环境变量设置如下:
变量名 变量值
path C:\Program Files\Java\jdk1.5.0_11\bin
java_home C:\Program Files\Java\jdk1.5.0_11
classpath C:\Program Files\Java\jdk1.5.0_11\lib\tools.jar;C:\Program
Files\Java\jdk1.5.0_11\jre\lib\rt.jar
WARNING: CLASSPATH may not include '.' (that is, the symbol for the current working
directory). Please add '.' to your CLASSPATH or you may experience configuration problem.
问题解决方法:1.CLASSPATH=`.:$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 Cygwin
This 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. You can also upgrade your cygwin environment according
to the instructions at www.cygwin.com 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 www.cygwin.com.
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.tgz
This 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 Users
8.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. You 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:
You 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 javax.comm package
在 cygwin 下
unzip javacomm20-win32.zip
cd commapi
cp 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 javax.comm.properties "C:\Program Files\Java\jdk1.5.0_11\jre\lib"
第四步 Install native compilers
Install 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
http://www.tinyos.net/dist-1.2.0/tools/ but they have not yet been extensively tested by a large
community.)
Atmel AVR Tools
Tool Windows/Cygwin Linux
avr-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.rpm
avr-libc avr-libc-1.2.3-1.cygwin.i386.rpm avr-libc-1.2.3-1.i386.rpm
avarice avarice-2.4-1.cygwin.i386.rpm avarice-2.4-1.i386.rpm
insight
avr-insight-6.3-1.cygwin.i386.rpm avr-insight-6.3-1.i386.rpm
(avr-gdb)
†If you receive an rpm error that indicates that you have a newer version already installed, try
rpm -Uvh --force
第五步 Install TinyOS toolchain
The 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 Tools
Recommended
Tool Other Windows/Cygwin Linux Command
Windows/Cygwin
rpm
-Uvh
rpm
nesc-1.2.8a-1.cygwin.i38 nesc-1.2.8b-1.cygwin.i38 nesc-1.2.8a-1.i386.r -Uvh
NesC
6.rpm 6.rpm pm --igno
reos (if
Cygwin
complains)
rpm
-ivh
--forc
tinyos-t tinyos-tools-1.2.3-1.cygw tinyos-tools-1.2.3-1.cygw tinyos-tools-1.2.3-1.
e (1.x tree)
ools in.i386.rpm in.i386.rpm i386.rpm
rpm
-Uvh (no
1.x tree)
第六步 Install the TinyOS 2.x source tree
Now 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.x
TinyOS 2.x
Windows/Cygwin Linux
TinyOS tinyos-2.0.1-5.cygwin.noarch.rpm tinyos-2.0.1-5.noarch.rpm
Configure your environment
Ideally, you'll put these environment variables in a shell script that will run when your
shell 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 the
windows CLASSPATH must be a windows-style path, not a cygwin path. You can
generate 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.x
Environme
Windows Linux
nt Variable
TOSROOT /opt/tinyos-2.x same as in Cygwin
TOSDIR $TOSROOT/tos same as in Cygwin
CLASSPAT C:\tinyos\cygwin\opt\tinyos-2.x\support\sdk\java $TOSROOT/support/sdk/java/tin
H \tinyos.jar;. yos.jar:.
MAKERUL
$TOSROOT/support/make/Makerules same as in Cygwin
ES
PATH† /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 <your
uid> /opt/tinyos-2.x
2. 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 Graphviz
Go to download page of the Graphviz project and download the appropriate RPM. You 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 -a
might give you some useful information. Install the rpm with rpm -i rpm-name. In the case of
Windows, there is a simple install program, so you don't need to deal with RPMs.
下载 1.10 版
http://webs.cs.berkeley.edu/tos/dist-1.1.0/tools/windows/graphviz-1.10.exe
and install it by executing it.
第八步
在/etc/profile.d 下建立 tinyos.sh 文件
内容如下:
export TOSROOT=/opt/tinyos-2.x
export TOSDIR=$TOSROOT/tos
export CLASSPATH=`cygpath -w $TOSROOT/support/sdk/java/tinyos.jar`
export CLASSPATH="$CLASSPATH;."
export MAKERULES=$TOSROOT/support/make/Makerules
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
第九步
Tos-check-env
Get documents about "