Although there are some notes below about setting up TinyOS on Ubuntu Linux 20.04, the process doesn't actually work very well. The TinyOS environment depends on a now unsupported package and an obsolete version of Python that causes dependency problems when trying to configure the environment. A solution may be possible, but it might also be better to use an older platform or wait until (if!) this matter is addressed upstream.
The main reference for setting up TinyOS is the TinyOS GitHub page, specifically this folder containing various getting-started documents. The installation is only officially supported on Ubuntu Linux 16.04 and 18.04. If you are using Ubuntu Linux 18.04, you want to read 00c_Setting_Up_Debian_Development. If you are using Ubuntu Linux 20.04LTS you will need to take some special steps. The 'nesc' package installs fine, but you will need to explictly install the 'default-jdk' and 'default-jre' packages before proceeding to the installation of 'tinyos-tools-devel.' Next do the following:
# apt install python-is-python2 # apt download tinyos-tools-devel # dpkg -i --force-depends <name of *.deb file previously downloaded>
Be aware! The first command above will change the system's default Python to Python2. This may cause unforeseen issues (Ubuntu 20.04 uses Python3 by default). An alternative might be to modify the Python scripts that come with the TinyOS development tools to use Python3. This will probably create its own collection of issues. It is possible to switch back to Python3 as the default by installing 'python-is-python3'. You don't need to uninstall 'python-is-python2'.
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:
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:
Go into $TR/tools and execute ./Bootstrap to create the configure script.
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.
Add the local/bin folder beneath the prefix to your path
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: 2024-11-25
© Copyright 2024 by Peter Chapin <peter.chapin@vermontstate.edu>