Installing TinyOS 2

A significant part of the course is to learn how to program motes. You will be asked to write TinyOS 2 programs for homework assignments and your project. Therefore, please make sure that you have access to TinyOS 2. There are several ways to get TinyOS 2 up and running on your machine, and two options are outlined below. We recommend option 1. If you have questions or encounter problems, you should contact the TA as soon as possible.

Option 1: Pre-configured VMWare image

You can try this option if you are running Windows or linux. The image is based on Ubuntu JeOS linux distribution with TinyOS 2. There are two accounts already set up; ID/password combinations are root/root and tinyos/tinyos. However, as a best practice, you should not login as root unless you have to.

Before running the image, you will need to install the VMWare Player, which is available for free here. Then, follow the instructions below to run the image.

  1. Download and uncompress for the pre-configured VMWare image: Jetos.zip (381 MB) (Includes extensions for TOSSIM simulation)
  2. Run VMWare Player.
  3. Click Open.
  4. Find and point to jetos.vmx that you just extracted.

One nice thing about the image is that SSH service starts automatically. Therefore, you can remotely login into the image if you want. To find the IP of the image, you first login into the image's console from the VMWare Player window. Then, type ifconfig.

The TinyOS 2 directory is at ~/local/src/tinyos-2.x.

Option 2: Install TinyOS 2 yourself

We don't normally recommend this option to students in the class because it is more involved. If you are having problems with the first option, you should contact the TA first. If you are running a linux distribution that supports Debian packages, such as Ubuntu, you may want to use the TinyOS repository.

  1. Add the following to the apt repository list: deb http://tinyos.stanford.edu/tinyos/dists/ubuntu hardy main
  2. Update your repository cache: sudo apt-get update
  3. Install the support for MSP430: apt-get install msp430-tinyos-base msp430-tinyos
  4. Install the support for AVR: apt-get install avr-tinyos-base avr-tinyos
  5. Install the nesc compiler: apt-get install nesc
  6. Checkout the latest version of TinyOS 2: You can grab it from SourceForge with CVS, or from our own Git repository.
      ~/local/src$ cvs -z3 -d:pserver: anonymous@tinyos.cvs.sourceforge.net :/cvsroot/tinyos co tinyos-2.x or
    
      ~/local/src$ git clone git://hinrg.cs.jhu.edu/git/tinyos-2.x.git
    
    
  7. Compile TinyOS 2:
      ~/local/src$ cd tinyos-2.x/tools
      ~/local/src/tinyos-2.x/tools$ ./Bootstrap
      ~/local/src/tinyos-2.x/tools$ ./configure --prefix=$HOME/local
      ~/local/src/tinyos-2.x/tools$ make all  (a bunch of ENTERs will be required)
      ~/local/src/tinyos-2.x/tools$ make install  (some more ENTERs will be required)
    
    
  8. Set the environment variables (add this to ~/.bashrc or ~/.bash_profile):
      export TOSROOT=$HOME/local/src/tinyos-2.x
      export TOSDIR=$TOSROOT/tos
      export MAKERULES=$TOSROOT/support/make/Makerules
      export CLASSPATH=$TOSROOT/support/sdk/java/tinyos.jar:.
      export PYTHONPATH=$TOSROOT/support/sdk/python:$HOME/local/lib/tinyos:$PYTHONPATH
      export PATH=$HOME/local/src/tinyos-2.x/support/sdk/c:$PATH
    

The TinyOS 2 directory is at ~/local/src/tinyos-2.x.

OS X...

You can follow the instructions here.

Test your installation

Under the TinyOS 2 directory, there is a directory apps/Blink. If your TinyOS 2 installation was successful, you should be able to compile Blink application. For example, type make telosb, and you should see something like the following:

  mike@sprite:~/local/src/tinyos-2.x/apps/Blink$ make telosb
  mkdir -p build/telosb
    compiling BlinkAppC to a telosb binary
  ncc -o build/telosb/main.exe -Os -O -mdisable-hwmul -Wall -Wshadow -DDEF_TOS_AM_GROUP=0x7d -Wnesc-all -target=telosb -fnesc-cfile=build/telosb/app.c -board= -DIDENT_PROGRAM_NAME=\"BlinkAppC\" -DIDENT_USER_ID=\"mike\" -DIDENT_HOSTNAME=\"sprite\" -DIDENT_USER_HASH=0xc50d8da4L -DIDENT_UNIX_TIME=0x46eb031fL -DIDENT_UID_HASH=0x6da1ea55L BlinkAppC.nc -lm
  compiled BlinkAppC to build/telosb/main.exe
    2608 bytes in ROM
    55 bytes in RAM
  msp430-objcopy --output-target=ihex build/telosb/main.exe build/telosb/main.ihex
  writing TOS image