TinyOS 1.x Installation on Windows XP
This is a tutorial on how to install TinyOS 1.x and 2.x on your Windows XP or Vista PC. It assumes you are starting with a clean installation of the OS.
Contents
Configuring the Environment
TinyOS requires Cygwin and a Java development environment. Follow these steps to set this up.
- Download and install Cygwin. Be sure to select cvs, gcc, gdb, openssh, perl, rpm, and vim for installation.
- Download and install Sun's latest JDK.
- Download and install Sun's javax.comm package.
- Unzip javacomm20-win32.zip
- Copy win32comm.dll to C:\Program Files\Java\jdkxxxx\jre\bin
- Copy comm.jar to C:\Program Files\Java\jdkxxxx\jre\lib\ext
- Copy javax.comm.properties to C:\Program Files\Java\jdkxxxx\jre\lib
- Download and install graphviz.
- Download and install Eclipse, a Java IDE.
- Download and install a text editor. I recommend Textpad.
Installing TinyOS
The following instructions will download the CVS version of TinyOS. While this may contain some non-stable code, it will give you the most recent version. By checking it out from CVS, you can always switch versions of TinyOS or stay synchronized with the most recent code.
- Download the following RPMs into a temporary folder. They were obtained from here and here:
- If you are using Windows Vista, always start Cygwin in administrator mode.
- In Cygwin, go to the temporary folder with the RPMs and install them using:
- rpm --ignoreos -ivh *.rpm
- In Cygwin, use CVS to download the TinyOS source files.
- Non-Developer access (Note: the second command will prompt for a password, just hit enter):
- cd /opt
- cvs -d:pserver:anonymous@tinyos.cvs.sourceforge.net:/cvsroot/tinyos login
- cvs -z3 -d:pserver:anonymous@tinyos.cvs.sourceforge.net:/cvsroot/tinyos co -P tinyos-1.x tinyos-2.x
- Developer access:
- cd /opt
- export CVS_RSH=ssh
- cvs -z3 -d:ext:developername@tinyos.cvs.sourceforge.net:/cvsroot/tinyos co -P tinyos-1.x tinyos-2.x
- Non-Developer access (Note: the second command will prompt for a password, just hit enter):
- Create file /opt/tinyos-1.x/tools/make/MakeLocal. Here is an example of what it should contain.
- Save washu.sh and tinyos.sh in /etc/profile.d.
- You may have to create /usr/local/bin/locate-jre with the following contents.
- Compile the Java code.
- cd /opt/tinyos-1.x/tools/java
- make
- Setup java's JNI library:
- cd /opt/tinyos-1.x/tools/java/jni
- make install
Installing Platform Support
TinyOS works on several hardware architectures. Here are instructions on how to add support for Mica2 and TelosB motes.
AVR Tools for Mica/Mica2/MicaZ Motes
- Download the following rpms into a temporary folder:
- avarice-2.4-1.cygwin.i386.rpm
- avr-binutils-2.15tinyos-3.cygwin.i386.rpm
- avr-gcc-3.4.3-1.cygwin.i386.rpm
- avr-insight-6.3-1.cygwin.i386.rpm
- avr-libc-1.2.3-1.cygwin.i386.rpm
- Open cygwin and go to the temporary folder that you saved the rpms into and install them using:
- rpm --ignoreos -ivh *.rpm
- If you borrow a USB-to-Serial cable from the Mobilab, Windows will ask you for the drivers the first time you plug it in. Here are the drivers:
- IOGear USB-to-Serial cable for Windows XP
MSP430 Tools for Telos Support
- If you are using TelosB motes, download and install the FTDI VirtualCom driver for TelosB motes. When you plug in the TelosB motes, Windows will prompt you for the driver. Point it to the FTDI VirtualCom driver.
- Download the following rpms into a temporary folder:
- msp430tools-binutils-2.16-20050607.cygwin.i386.rpm
- msp430tools-base-0.1-20050607.cygwin.i386.rpm
- msp430tools-gcc-3.2.3-20050607.cygwin.i386.rpm
- msp430tools-libc-20050308cvs-20050608.cygwin.i386.rpm
- Open cygwin and go to the temporary folder that you saved the rpms into and install them using:
- rpm --ignoreos --nodeps -ivh *.rpm
Installing a TinyOS 1.x Application
We will now verify your TinyOS installation by compiling, installing, and running the Oscilloscope application. The Oscilloscope application consists of two NesC programs (OscilloscopeRF and TOSBase) and two Java programs (SerialForwarder and oscilloscope). OscilloscopeRF periodically takes a sensor reading and broadcasts it wirelessly. TOSBase listens for the broadcasts and forwards the data to the base station. SerialForwarder receives the data from a serial port and forwards it to a local TCP port. oscilloscope takes the data and displays in a GUI.
Before installing the application, you need to go into the source code of OscilloscopeRF to customize which sensor it uses and how frequently it takes a sensor reading.
1. In Cygwin: * cd /opt/tinyos-1.x/apps/OscilloscopeRF * Edit Oscilloscope.nc * Change "DemoSensorC" to "Photo" on line 46. This will make it sense light readings. * Save & Exit
* Edit OscilloscopeM.nc * Change "125" to "8" on line 99. This is the period at which sensor readings will be taken. The period is in binary milliseconds (1024 = 1s). By changing it to 8, we will be taking 128 sensor readings per second. * Save & exit
Now that you have customized OscilloscopeRF, it's time to compile and install it. The following instructions are divided into Mica2 users and TelosB users. Follow the instructions for your platform. After installing the NesC programs, follow the instructions on how to launch the Java applications.
Mica2 users:
1. Connect the MIB510 programming board to your computer. This is done through a serial cable if your computer has a serial port, or a USB-to-Serial cable if it only has USB ports. The Mobilab has two types of USB-to-Serial cables that are distinguished by color: silver and black. The drivers for silver cables are here, while the drivers for black cables are here.
Note which serial port it is attached to. To find out, go into Device Manager and see which COM port it shows up as. If it is COM1, the corresponding UNIX name is /dev/ttyS0. The UNIX number is always the Windows number - 1. For now, we assume it is attached to /dev/ttyS0. 2. Attach a Mica2 mote to the programming board 3. In Cygwin: * cd /opt/tinyos-1.x/apps/OscilloscopeRF * make mica2 install.1 mib510,/dev/ttyS0 4. Remove the mote from the programming board and attach another mote. 5. In Cygwin: * cd /opt/tinyos-1.x/apps/TOSBase * make mica2 install.0 mib510,/dev/ttyS0 6. Leave the mote programmed with TOSBase on the programming board. 7. Turn on the mote with OscilloscopeRF by plugging in two AA batteries and turning on the switch. 8. You should now see the LEDs on both motes blinking.
TelosB users:
1. Connect a TelosB mote to your USB port. Note which USB port it shows up as. To find out, go into Device Manager and see which COM port it shows up as. If it is COM1, the corresponding UNIX name is /dev/ttyS0. The UNIX number is always the Windows number - 1. For now, we assume it is attached to /dev/ttyS0. 2. In Cygwin: * cd /opt/tinyos-1.x/apps/OscilloscopeRF * make telosb install.1 bsl,/dev/ttyS0 3. Remove the TelosB mote from your computer and attach another mote. 4. In Cygwin: * cd /opt/tinyos-1.x/apps/TOSBase * make telosb install.0 bsl,/dev/ttyS0 5. Leave the mote programmed with TOSBase on the programming board. 6. Turn on the mote with OscilloscopeRF by plugging in two AA batteries. 7. You should now see the LEDs on both motes blinking.
Launching the Java Applications:
1. In Cygwin: * cd /opt/tinyos-1.x/tools/java * java net.tinyos.sf.SerialForwarder & * java net.tinyos.oscope.oscilloscope 2. If everything works, you should see the following: