Manual installation using RPM packages

From TinyOS Wiki
Revision as of 13:34, 12 May 2013 by Bradjc (talk | contribs) (cygwin install)
Jump to: navigation, search

Manual installation on your host OS with RPMs

Currently, the TinyOS Core Working Group supports TinyOS on two platforms: Cygwin (Windows) and Linux. There have been some successful efforts to getting TinyOS environments working on Mac OSX, but OSX is not supported by the Core WG.

Installing a TinyOS enviromnent has five basic steps; Windows requires an extra step, installing Cygwin, which is a UNIX-like environment. The steps are:

  1. Installing a Java JDK. Java is the most common way of interacting with mote base stations or gateways that are plugged into a PC or laptop.
  2. Windows only. Install Cygwin. This gives you a shell and many UNIX tools which the TinyOS environment uses, such as perl and shell scripts.
  3. Installing native compilers. As you're compiling code for low-power microcontrollers, you need compilers that can generate the proper assembly code. If you using mica-family motes, you need the AVR toolchain; if you're using telos-family motes, you need the MSP430 toolchain.
  4. Installing the nesC compiler. TinyOS is written in nesC, a dialect of C with support for the TinyOS concurrency model and component-based programming. The nesC compiler is platform-independent: it passes its output to the native compilers, so that it can take advantage of all of the effort put into their optimizations.
  5. Installing the TinyOS source tree. If you want to compile and install TinyOS programs, you need the code. Note that with the described method you will only obtain pretty old code. Try to skip that step to get the code and set up the enviroment with the method described in the automatic installation.
  6. Installing the Graphviz visualization tool. The TinyOS environment includes nesdoc, a tool that automatically generates HTML documentation from source code. Part of this process involves drawing diagrams that show the relationships between different TinyOS components. Graphviz is an open source tool that nesdoc uses to draw the diagrams.

Step 1: Install Java JDK

Download and install Sun's JDK from http://java.sun.com.

Step 2: Install Cygwin

This step is required for Windows installations only. If you are installing on Linux, skip to step 3.

  1. Download setup.exe and run it to install Cygwin.
  2. When the window pops up to allow you to select what packages to install, be sure to select:
    • rpm
    • make
    • perl
    • python

Step 3: Install native compilers

Install the appropriate version of the following (Windows or Linux, avr or msp430 or both) with the rpm command 'rpm -ivh rpm>'. On windows, if you get an error claiming that the rpm was intended for a cygwin_nt-5.1 operating system and you're indeed on a windows computer, bypass the erroneous error by using 'rpm -ivh --ignoreos rpmname'.

Atmel AVR Tools

Tool Windows/Cygwin Linux
avr-binutils avr-binutils-2.17tinyos-3.cygwin.i386.rpm avr-binutils-2.17tinyos-3.i386.rpm
avr-gcc avr-gcc-4.1.2-1.cygwin.i386.rpm avr-gcc-4.1.2-1.i386.rpm
avr-libc avr-libc-1.4.7-1.cygwin.i386.rpm avr-libc-1.4.7-1.i386.rpm
avarice avarice-2.4-1.cygwin.i386.rpm avarice-2.4-1.i386.rpm
insight (avr-gdb) avr-insight-6.3-1.cygwin.i386.rpm avr-insight-6.3-1.i386.rpm
avrdude†† avrdude-tinyos-5.6cvs-1.cygwin.i386.rpm avrdude-tinyos-5.6cvs-1.i386.rpm

If you receive an rpm error that indicates that you have a newer version already installed, try rpm -Uvh --force
††If you receive an rpm error that indicates that you are missing /bin/sh, try rpm -Uvh --force --nodeps


PXA27x Tools (iMote2)

Tool Windows/Cygwin Linux
xscale-elf-binutils xscale-elf-binutils-2.15tinyos-1.cygwin.i386.rpm xscale-elf-binutils-2.15-2.i386.deb
xscale-elf-gcc xscale-elf-gcc-3.4.3-1.cygwin.i386.rpm xscale-elf-gcc-3.4.3-2.i386.deb
xscale-elf-newlibc xscale-elf-newlib-1.11.0tinyos-1.cygwin.i386.rpm xscale-elf-newlib-1.13.0-1.i386.deb
jtag jflashmm.tgz†† OpenOCD toolchain

Newer versions of GCC can be installed in certain cases. For further info see section iMote2 Compiler from this wiki.

††Copy jflashmm.tgz to /opt directory, untar it (tar xzf jflashmm.tgz), and make sure it's on your path (see Step 5). If the download link above doesn't work, try the cvs.


TI MSP430 Tools

Tool Windows/Cygwin Linux
base msp430tools-base-0.1-20050607.cygwin.i386.rpm msp430tools-base-0.1-20050607.i386.rpm
python tools msp430tools-python-tools-1.0-1.cygwin.noarch.rpm msp430tools-python-tools-1.0-1.noarch.rpm
binutils msp430tools-binutils-2.16-20050607.cygwin.i386.rpm msp430tools-binutils-2.16-20050607.i386.rpm
gcc msp430tools-gcc-3.2.3-20050607.cygwin.i386.rpm msp430tools-gcc-3.2.3-20050607.i386.rpm
libc msp430tools-libc-20080808-1.cygwin.i386.rpm msp430tools-libc-20080808-1.i386.rpm
jtag [1]Not yet available msp430tools-jtag-lib-20031101cvs-20050610.i386.rpm
gdb [2]Not yet available msp430tools-gdb-6.0-20050609.i386.rpm

Step 4: Install TinyOS toolchain

The TinyOS-specific tools are the NesC compiler and a set of tools developed in the tinyos-2.x/tools source code repository. They are also installed using rpms. If you using the Cygwin version recommended in these install instructions, you should install the "Recommended" Windows/Cygwin nesC RPM. If you get strange errors when you try to compile TinyOS programs, such as the error message "the procedure entry point basename could not be located in the dynamic link library cygwin1.dll", this is likely due to a Cygwin version incompatibility: try the "Other" Windows/Cygwin RPM (1.2.7a). If you are using Cygwin and installing the nesC RPM causes an error that the RPM was built for Cygwin, add the --ignoreos option.

Finally, there are two Linux versions of tinyos-tools, depending on whether you have a 32-bit or 64-bit machine. The first is the i386 RPM and the second is the i686 RPM. If you have a 64-bit Java VM, it is important that you install the i686 RPM or otherwise the Java support may not work properly.

TinyOS-specific Tools

Tool Windows/Cygwin Linux Command
NesC nesc-1.3.1-1.cygwin.i386.rpm (not available yet) nesc-1.3.1-1.fc9.i386.rpm rpm -Uvh
rpm -Uvh --ignoreos (if Cygwin complains)
Tool Windows/Cygwin Linux Command
Deputy tinyos-deputy-1.1-1.cygwin.i386.rpm tinyos-deputy-1.1-1.fc9.i386.rpm rpm -i
rpm -i --ignoreos (if Cygwin complains)
Tool Windows/Cygwin Linux Command
tinyos-tools tinyos-tools-1.4.0-3.cygwin.i386.rpm tinyos-tools-1.4.0-3.ubuntu.i386.rpm rpm -ivh --force (1.x tree)
rpm -Uvh (no 1.x tree)

Step 5: Install the TinyOS 2.x source tree

Now that the tools are installed, you need only install the tinyos 2.x source tree and then set your environment variables. Install the appropriate version of the following (Window or Linux) with the rpm command 'rpm -ivh rpm'. As with the previous rpms, if you get an error claiming that the rpm was build for an NT computer and you're on a windows NT computer, bypass the erroneous error by using 'rpm -ivh --ignoreos rpmname'.

  • Install tinyos-2.x

    TinyOS 2.x

    Windows/Cygwin Linux
    TinyOS tinyos-2.1.1-3.cygwin.noarch.rpm tinyos-2.1.1-3.ubuntu.noarch.rpm
  • Configure your environment

    Ideally, you'll put these environment variables in a shell script that will run when your shell starts, but you needn't put such a script under /etc/profile.d. You can use ~/.bash_profile. (in Cygwin, too)

    The example settings below assume that the tinyos-2.x installation is in /opt/tinyos-2.x. Change the settings to be correct for where you've put your tinyos-2.x tree. Note that the windows CLASSPATH must be a windows-style path, not a cygwin path. You can generate a windows style path from a cygwin-style path using 'cygpath -w'. For example:

    export CLASSPATH=`cygpath -w $TOSROOT/support/sdk/java/tinyos.jar`
    export CLASSPATH="$CLASSPATH;."
    

    TinyOS 2.x

    Environment Variable Windows Linux
    TOSROOT /opt/tinyos-2.x same as in Cygwin
    TOSDIR $TOSROOT/tos same as in Cygwin
    CLASSPATH C:\cygwin\opt\tinyos-2.x\support\sdk\java\tinyos.jar;. $TOSROOT/support/sdk/java/tinyos.jar:.
    MAKERULES $TOSROOT/support/make/Makerules same as in Cygwin
    PATH /opt/msp430/bin:/opt/jflashmm:$PATH same as in Cygwin

    Only necessary if you're using MSP430 or iMote2 platform/tools.

    In addition to the above environment variables, do the following on Linux machines:

    1. Change the ownership on your /opt/tinyos-2.x files: chown -R <your uid> /opt/tinyos-2.x
    2. Change the permissions on any serial (/dev/ttyS<N>), usb (/dev/tts/usb<N>, /dev/ttyUSB<N>), or parallel (/dev/parport) devices you are going to use: chmod 666 /dev/<devicename>

Step 5b (optional): Post-install fixes in Windows/Cygwin environment

If you later experience problems when building some tutorials, running Java tools, ... see Geoffrey Lo's excellent blog post, especially step 2.

Step 6: Installing Graphviz

Go to download page of the Graphviz project and download the appropriate RPM. You only need the basic graphviz RPM (graphviz-); you don't need all of the add-ons, such as -devel, -doc, -perl, etc. If you're not sure what version of Linux you're running,

uname -a

might give you some useful information. Install the rpm with rpm -i rpm-name. In the case of Windows, there is a simple install program, so you don't need to deal with RPMs.

you may need to download graphviz 1.1.0 here