• : Function ereg() is deprecated in /home/project-web/tinyos8051wg/htdocs/includes/ on line 647.
  • : Function ereg() is deprecated in /home/project-web/tinyos8051wg/htdocs/includes/ on line 647.
  • : Function ereg() is deprecated in /home/project-web/tinyos8051wg/htdocs/includes/ on line 647.
  • : Function ereg() is deprecated in /home/project-web/tinyos8051wg/htdocs/includes/ on line 647.
  • : Function ereg() is deprecated in /home/project-web/tinyos8051wg/htdocs/includes/ on line 647.
  • : Function ereg() is deprecated in /home/project-web/tinyos8051wg/htdocs/includes/ on line 647.

In order to use this port you need the following prerequisites. The tool chain assumes that the compiler and tools are installed in particular locations and that you setup your environment variables as described below.

  1. A TinyOS 2 installation, in Windows using Cygwin or natively in Linux or similar. Inline is only supported for x86 platforms.
  2. A 8051 compiler
    1. Keil PK51 (any version)
    2. IAR Workbench version 7 or later
    3. SDCC version 2.9.0 or later
  3. A copy of the port from TinyOS-contrib
  4. Hardware programming tools for you particular chip (eg. cc2430)

1. TinyOS 2 install

TinyOS 2 must be installed separate from this port, either in Windows through Cygwin or natively in Linux (or similar). TinyOS version 2.1. and NescC version 1.3.0 are supported presently.

1.1 Windows trough Cygwin

For Cygwin or Linux users follow the instructions from For Cygwin users remember to install the packages rpm and gcc-mingw. As a bare minimum you need to install the nescc, tinyos-tools, tinyos-deputy and tinyos packages.

  $ rpm -i nesc-1.3.0-1.cygwin.i386.rmp
  $ rpm -i tinyos-tools-1.3.0-1.cygwin.i386.rpm
  $ rpm -i tinyos-deputy-1.1-1.cygwin.i386.rpm
  $ rpm -i tinyos-2.1.0-1.cygwin.noarch.rpm

1.2 Windows trough virtual machine

Alternatively Windows users may want to run the Linux through a virtual machine such as Virtual PC or VMWare Server. XubunTOS provides an install image with TinyOS pre-installed. XubunTOS can also be downloaded ad a ready-to-run virtual machine here.

1.3 Linux native install

Linux (and similar) are supported natively, follow the appropriate instructions on your distribution. For example, the installation of TinyOS 2.1 on Ubuntu, is described here.

2. 8051 compiler

To compile programs using this port an 8051 C-compiler is required. We recommend Keil PK51 - this port is written and tested using the Keil compiler. In addition IAR or SDCC may be used, but these are not tested. There are numerous other companies providing compilers that might or might not work, but additional compilers are not supported through the tool chain. Which compiler to used is selected using the environment variable MCS51_COMPILER (see Section 3).

Keil and IAR are Windows only compilers, to use them in Linux they are run through Wine. Each compiler is installed in a separate Wine directory (eg. .wine.keil for Keil) to avoid interference. First install wine and create the appropriate wine directory (using Ubunto or Xubuntos):

  apt-get install wine
  env WINEPREFIX=~/.wine.keil wineprefixcreate

2.1 Installing Keil PK51

Keil PK51 is a commercial 8051 compiler that can be purchased from A trial version is available with a 2 KiB code size limit on the compiled binaries. For either Cygwin or Wine install Keil in the default location (C:Keil).

2.1.1 Linux

The tool chain assumes Keil is install using the Wine environment in the directory named ~/.wine.keil. Run the Keil installer using Wine (either from the provided CD-rom or downloaded binary):

  WINEPREFIX=$(HOME)/.wine.keil wine C51V809A.EXE

To enter your license code start the uVision development environment and enter it the same way you would in Linux:

  WINEPREFIX=~/.wine.keil wine "C:\Keil\UV3\Uv3.exe"

2.1.2 Windows

Simply install the compiler using the appropriate installer.

2.2 Installing SDCC

SDCC is a free, open souce C compiler with native Linux and Windows support. SDCC versions 2.6 and greater provide native inline support. We have not been able to successfully compile a TinyOS application using this inliner. We recommend using the stand alone inline tool provided with this TinyOS port.

2.2.1 Linux

To install sdcc using Debian, Ubuntu or XUbunTOS run the following command:

 apt-get install sdcc sdcc-libraries

2.2.2 Windows

Download and install the compiler from Answer yes to the question "Add to path".

2.3 Installing IAR

Iar is a commercial compiler for Windows. It has a 30 day evaluation is available here. In either Windows or Linux set the path of the compiler in the environment variable MCS51_IAR_PATH, for example the default is:

export MCS51_IAR_PATH=Program\ Files/IAR\ Systems/Embedded\ Workbench\ 4.0\ Evaluation\ version/common/bin/

2.3.1 Linux

Install the compiler using Wine:

  env WINEPREFIX=~/.wine.iar wine EW8051-EV-730B.exe

2.3.1 Windows

Simply install the compiler using the native installer.

3. 8051 port from TinyOS-contrib

The code is located in the TinyOS-2.x-contrib section and is downloaded separately from TinyOS. See download for more.

3.1 8051 port directory

The the archive above contains the code in a directoryh namednamed tinyos-2.x-contrib/diku. This directory must be places in par particular location (or speficfied in the variable below).

By placing the directory in the following locations the build system will automatically be able to locate the port

  • For cygwin c:\cygwin\opt
  • Linux /opt

3.2 Environment variables

The ports need a few environment variables in addition to the default TinyOS variables. These variables enable the TinyOS make system to locate the Make rules and the source files.

  • TOSDIR (location of T2 tree)
  • MAKERULES (location of T2 Makerules)
  • TOSMAKE_PATH list of directories to search for .target files (separated by spac"
  • CONTRIBROOT (root of the contrib directory)

In addition a few optional variables control and select which compiler to use:

  • MCS51_COMPILER select compiler one of (keil, sdcc or iar)
  • MCS51_WINE_IAR_PATH wine directory for Keil (default ~/.wine.keil)
  • MCS51_WINE_KEIL_PATH wine directory for IAR (default ~/.wine.iar)
  • MCS51_IAR_PATH Path to IAR compiler

An example script is provided as diku/env which sets up these variables, to include them run the following command (for bash and zsh):

  cd tinyos-2.x-contrib
  source diku/env

4. Hardware programming tools.

In order to transfer the compiled binary to the chip you need the chip or platform maintainer's tool for this purpose.

Texas Instrumenst (ChipCon) Development Kit
ChipCon Flash Programmer. The programmer is only available for Windows. Other users will have to dual boot or run in an emulator.
SiLabs 8051
SiLabs provides a Windows GUI programmer. For Linux (and similar) the ec2drv project provides a command line programmer
Nordic VSLI provides a programmer for Windows
Sensinode Nano

5. Test the setup

With the above prerequisites your setup should be ready to go. To test the setup compile one of the example applications:

   cd mcs51/apps/BlinkNoTimer
   make cc2430em

If all goes well you should see the following message:

     compiled BlinkNoTimerTaskAppC to a cc2430em binary
 Code size of app.o
    CODE SIZE        =    635    ----
    CONSTANT SIZE    =   ----    ----
    XDATA SIZE       =      4       9
    PDATA SIZE       =   ----    ----
    DATA SIZE        =   ----    ----
    IDATA SIZE       =   ----    ----
    BIT SIZE         =   ----    ----
 Total sizes
 Program Size: data=9.0 xdata=10 const=0 code=694

6. Trouble shooting

In case of problems start your setup using the script

  ./diku/mcs51/support/make/mcs51/ -v