TinyOS for MIPS

TinyOS is a project created by the Computer Science Department at University of California, Berkeley. TinyOS is primarily designed for programming sensor nodes in sensor networks.

The concept of TinyOS is to provide the basic surroundings (a.k.a. a kernel) for an application and thus allowing the application to be executed on an embedded platform. The application must be written in the NEST programming platform , which is a large set of C macros. A set of macros have been designed to use the hardware on the boards, e.g. timers, temperature-sensitive resistors, light-sensitive resistors, LEDs, speakers and microphones. Sensor networks are an essential part of the targeted embedded platforms for TinyOS.

The files found here, are a MIPS ported version of TinyOS, which was originally developed for the AVR platform.

Download: tinyos_platform_mips.tar.gz

Other files were necessary to modify to execute on a MIPS architecture. They can be downloaded here.
Finally, to build a project for MIPS, replace the Makefile with this: Makefile

Step by step guide!

This guide shows how to setup the MIPS core and how to build TinyOS for it and executing it. The guide requires that SystemC is installed and working. The guide has been tested in bash on a Linux system. The $-sign in placed in front of each commando and the font is monospaced.

1. Extract files

First, extract files from archive:

$ tar zxf sc_mips_core.tar.gz

2. Configure the core

Edit config.h and set the defines that are interesting. If in doubt, just leave the file unchanged.

$ emacs config.h

3. Compile core

To compile, the entire processor core, simply type make and watch the output.

$ make

4. Execute the core

Finally, run the processor. To test, run the hamming encoder example in the distribution:

$ ./mips3 encoder.bin

The execution time for the hamming encoder is 15 minutes (the simulation doesn't stop automatically!) on a 1GHz Celeron processor. If the output is piped to /dev/null or a file then the execution time is approx. 8 minutes.

5. Look at the results

Look at the file avroutput.bin which should contain hamming encoded text. Compile decoder.c to get a utility that can decode the text.

Optionally, look at the waveforms to confirm the correct behavior of the MIPS core and the selected signals.

$ gtkwave main.trace.vcd

6. Install compilers for other platforms

On RedHat systems, the MIPS compiler is easy to install once the packages are downloaded:

$ su -
# rpm -Uvh *.rpm

On Debian systems, the MIPS compiler can be installed with dpkg (part of the apt-get system):

$ su -
# dpkg -i *.deb
binutils-mipsel-linux_2.13.90.0.18-1_i386.deb
gcc-mipsel-linux_3.2.3.cvs20030221-1_i386.deb
libc6-dev-mipsel-cross_2.3.1-14_all.deb
libc6-mipsel-cross_2.3.1-14_all.deb
libdb1-compat-mipsel-cross_2.1.3-7_all.deb

??:
libforms0.89_0.89-12_i386.deb
libxaw6_4.1.0-16_i386.deb
xlib6g_4.1.0-16_all.deb

6. Setup TinyOS

The compilation of TinyOS for MIPS requires GCC for MIPS (endian little).
The compilation of TinyOS for AVR requires GCC for AVR.

First, install AVR version of TinyOS and confirm that it works.
Extract and test the distribution:

$ tar zxf tos-1.0.0-nest-release.tgz
$ cd /tos/apps/blink
$ make
$ cd binmica
$ ls -l

The file BLINK.bin can be executed with the AVR core (setup procedure is similar to /tos/apps/blink/

7. Setup MIPS files in TinyOS distribution

Extract files for MIPS:

$ tar zxf tinyos_platform_mips.tar.gz

Create symlink(s): folder, Makefile
$ make