TinyOS Notes

The main reference for setting up TinyOS is the TinyOS GitHub page, specifically this folder containing various getting started documents. If you are using Ubuntu Linux 18.04LTS, you want to read 00c_Setting_Up_Debian_Development. For our purposes, install the MSP430 toolchain (the second part of Section 2b). In my experience the mspdebug package won't install (I think it may have an incorrect package reference in its dependency list). However, that is not critical. Don't worry about installing ARM support for now (skip Sections 2c and 2d). I also didn't bother with Section 2e.

You will want to clone the TinyOS repositories as indicated in Section 3. I recommend creating the branches they describe. That way if you want to modify the samples you can do so in your own branch.

Create a shell script with the exports mentioned in Section 4. Use that script to set up the environment in each terminal window where you want to use the TinyOS development tools. Note that our motes are telosb devices, so the setting of MOTECOM in the TinyOS documentation should be exactly correct for us.

Some of the TinyOS development tools are written in Python. They assume you are using pySerial version 2.x for accessing serial ports. Unfortunately, Ubuntu 18.04 install pySerial 3.4 by default, which is not compatible with version 2.x. To work around this, you will need to install pySerial 2.7 into your home directory. Proceed as follows:

  1. Install pip and pip3 using the command: sudo apt install python-pip python3-pip.
  2. Use pip to install pySerial 2.7 with the command: pip install --user pySerial==2.7. Note that there are no spaces around the == token. The --user option causes pip to install this library in your home directory rather than in the system directories (so the pySerial 3.4 install located there is not overwritten). It also means that scripts you run will "see" pySerial 2.7, as required by the TinyOS tools.

Plug a telosb mote into one of your USB ports. You may have to grant yourself permission to the device file as follows: sudo chmod 666 /dev/ttyUSB0. The device file appears and disappears depending on if you have a device plugged in. Thus you will need to set the permissions each time you plug in a mote. Alternatively you can add yourself to the dialout group.

You can now go into the apps/Blink folder in the TinyOS repository and do: make telosb install. The "install" option causes the program to be downloaded to the mote after it is built. You should not see any error messages. Once programmed, the mote is immediately rebooted and it should start blinking the three LEDs in a binary sequence from 000 to 111.

It is also necessary to build the TinyOS tools. These instructions replace the (out of date) instructions in section 6 of the earlier web page. Proceed as follows:

  1. Go into $TR/tools and execute ./Bootstrap to create the configure script.

  2. Execute ./configure --prefix=/home/student/local. Set the prefix to a suitable location on your machine. The tools will get installed in folders beneath the prefix folder. Then execute make followed by make install. Before doing the installation command, be sure the folder mentioned in --prefix exists.

  3. Add the local/bin folder beneath the prefix to your path

  4. Modify the shell script that sets TinyOS environment variables so the CLASSPATH variable includes the right path to tinyos.jar. That path should look like local/lib/java/tinyos.jar beneath the prefix.


Last Revised: 2019-11-21
© Copyright 2019 by Peter C. Chapin