TinyOS with IRIS support

advertisement
TinyOS with IRIS support
Installing a TinyOS enviromnent has five basic steps; Windows requires an extra step,
installing Cygwin, which is a UNIX-like environment. The steps are:
1. Installing a Java 1.5 (Java 5) JDK. Java is the most common way of interacting
with mote base stations or gateways that are plugged into a PC or laptop.
2. Install Cygwin. This gives you a shell and many UNIX tools which the TinyOS
environment uses, such as perl and shell scripts.
3. Installing native compilers. As you're compiling code for low-power
microcontrollers, you need compilers that can generate the proper assembly code.
If you using mica-family motes, you need the AVR toolchain; if you're using
telos-family motes, you need the MSP430 toolchain.
4. Installing the nesC compiler. TinyOS is written in nesC, a dialect of C with
support for the TinyOS concurrency model and component-based programming.
The nesC compiler is platform-independent: it passes its output to the native
compilers, so that it can take advantage of all of the effort put into their
optimizations.
5. Installing the TinyOS source tree. If you want to compile and install TinyOS
programs, you need the code.
6. Installing the Graphviz visualization tool. The TinyOS environment includes
nesdoc, a tool that automatically generates HTML documentation from source
code. Part of this process involves drawing diagrams that show the relationships
between different TinyOS components. Graphviz is an open source tool that
nesdoc uses to draw the diagrams.
Step 1: Install Java 1.5 JDK
Windows Download and install Sun's 1.5 JDK from http://java.sun.com.
Linux Download and install IBM's 1.5 JDK from http://www128.ibm.com/developerworks/java/jdk/.
Step 2: Install Cygwin
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.
4.
5.
$ cd /cygdrive/c/newcygpkgs
$ tar zxvf cygwin-1.2a.tgz
This unzips the packages.
6. 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.
7. Follow these steps when the Cygwin Setup windows appears:
8. Opt to disable the virus scanner (it will be enabled when you're finished).
9. Opt to Install from Local Directory.
10. 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.
11. Select to Install for All Users
12. Select the Unix file type (very important!)
13. 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.)
14. 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.
15. 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.
Step 3: Install native compilers
Install the appropriate version of the following (Windows or Linux, avr or msp430 or
both) with the rpm command 'rpm -ivh rpm>'. 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.17-1.cygwin.i386.rpm Src+: avr-binutils-2.17-1.src.rpm
avr-gcc*
avr-gcc-3.4.6-1.cygwin.i386.rpm
Src+: avr-gcc-3.4.6-1.src.rpm
avr-libc*
avr-libc-1.4.6-1.cygwin.i386.rpm
Src+: avr-libc-1.4.6-1.src.rpm
avrdude*
avrdude-5.4-1.cygwin.i386.rpm
Src+: avrdude-5.4-1.src.rpm
*These files are located in the SVN repository
+No prebuilt binaries are available.
†If you receive an rpm error that indicates that you have a newer version already
installed, try rpm -Uvh --force
TI MSP430 Tools
Tool
Windows/Cygwin
Linux
msp430tools-base-0.1msp430tools-base-0.1Base
20050607.cygwin.i386.rpm
20050607.i386.rpm
python msp430tools-python-tools-1.0msp430tools-python-tools-1.0tools
1.cygwin.noarch.rpm
1.noarch.rpm
msp430tools-binutils-2.16msp430tools-binutils-2.16binutils
20050607.cygwin.i386.rpm
20050607.i386.rpm
msp430tools-gcc-3.2.3msp430tools-gcc-3.2.3gcc
20050607.cygwin.i386.rpm
20050607.i386.rpm
msp430tools-libc-20050308cvsmsp430tools-libc-20050308cvslibc
20050608.cygwin.i386.rpm
20050608.i386.rpm
msp430tools-jtag-lib-20031101cvsjtag
Not yet available
20050610.i386.rpm
msp430tools-gdb-6.0gdb
Not yet available
20050609.i386.rpm
Step 4: 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. Finally, there are two Linux versions of
tinyos-tools, depending on whether you have a 32-bit or 64-bit machine. The first is the
i386 RPM and the second is the i686 RPM. If you have a 64-bit Java VM, it is important
that you install the i686 RPM or otherwise the Java support may not work properly.
TinyOS-specific Tools
Recommended
Other
Tool
Linux
Command
Windows/Cygwin
Windows/Cygwin
NesC
Tool
nesc-1.2.8a1.cygwin.i386.rpm
nesc-1.2.8b1.cygwin.i386.rpm
nesc-1.2.8a1.i386.rpm
Windows/Cygwin
32-bit Linux
64-bit Linux
tinyos-tools-1.2.43.i386.rpm
tinyos-tools1.2.43.i686.rpm
tinyos- tinyos-tools-1.2.4tools
2.cygwin.i386.rpm
rpm -Uvh
rpm -Uvh -ignoreos (if
Cygwin
complains)
Command
rpm -ivh -force (1.x tree)
rpm -Uvh (no 1.x
tree)
Step 5: 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 rpm'. 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.2-2.cygwin.noarch.rpm tinyos-2.0.2-2.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 cygwinstyle path using 'cygpath -w'. For example:
export CLASSPATH=`cygpath -w
$TOSROOT/support/sdk/java/tinyos.jar`
export CLASSPATH="$CLASSPATH;."
TinyOS 2.x
Environment
Windows
Variable
Linux
TOSROOT
TOSDIR
/opt/tinyos-2.x
same as in Cygwin
$TOSROOT/tos
same as in Cygwin
C:\tinyos\cygwin\opt\tinyosCLASSPATH
$TOSROOT/support/sdk/java/tinyos.jar:.
2.x\support\sdk\java\tinyos.jar;.
MAKERULES $TOSROOT/support/make/Makerules same as in Cygwin
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.
Step 6: 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.
Step 7: IRIS related manual patches
Programming the IRIS mote is done with avrdude (as uisp is not being supported any
more by its developers). A new set of makefiles are needed to allow for install using
avrdude
(keeping backwards compatibility with the uisp-based tools). These files can be
found under /support/make in the SVN repository. Check the files out and copy them to
tinyos-2.x/tools/support/make, overwriting the old files in that directory. A sample
Makelocal is included that sets avrdude as the default programmer. This can be
achieved by setting the environment variable DEFAULT_PROGRAM to “avrdude”.
Please note, that in contrast with uisp, avrdude under Cygwin uses the Windows-specific
port naming, i.e. COM1 instead of /dev/ttyS0.
In some cases (e.g. with NullApp or Blink), make install might fail because tos-setsymbols cannot find the .data segment in an srec file. Should this program occur, place
updated tos-set-symbols (located under /support/tools in the SVN repository) in /bin
(replacing the existing version of the file).
Download