IMote2 Compiler

From TinyOS Wiki
Revision as of 12:07, 21 May 2008 by Ankur (talk | contribs) (Installing xscale-elf toolchain from source)
Jump to: navigation, search

This article assumes that you already have tinyos-2.x installed on your system. Go to http://www.tinyos.net/tinyos-2.x/doc/html/install-tinyos.html for install instructions. Do not install the xscale tools from that page (step 3 can be skipped).

Installing xscale-elf toolchain with Debian packages

Download packages

Download the following package files (hosting not available as of yet):

xscale-elf-binutils-2.15-2.i386.deb

xscale-elf-gcc-3.4.3-2.i386.deb

xscale-elf-newlib-1.13.0-1.i386.deb

Install the packages

$ dpkg --install xscale-elf-binutils-2.15-2.i386.deb
$ dpkg --install xscale-elf-gcc-3.4.3-2.i386.deb
$ dpkg --install xscale-elf-newlib-1.13.0-1.i386.deb

That's it. Run make on Blink (or other code) to see if it works:

$ cd $TOSROOT/apps/Blink
$ make intelmote2

You should see an executable output.

Installing xscale-elf toolchain from source

If you can install debian packages and do no need the source, this section is not for you. Scroll up and install the packages.

The xscale-elf rpms on the Tinyos-2.x install page contain a version of newlib that does not work on debian linux. This section relies on instructions from the Harvard imote2 install page: [1]

Download source

To compile a working xscale-elf toolchain on debian from source, you will need to download the following source distributions:

xscale-elf-binutils 2.15

xscale-elf-gcc 3.4.3

newlib 1.13

Define environment variables

These can be removed after the installation.

export TARGET=xscale-elf
export PREFIX=/usr

If you don't already have the bin subdir of the directory specified by PREFIX added to your PATH, add it now:

export PATH=${PREFIX}/bin:${PATH}

Build binutils

$ tar xzf xscale-elf-binutils-2.15.tgz
$ cd xscale-elf-binutils-2.15
$ mkdir build; cd build
$ ../configure --target=$TARGET --prefix=$PREFIX
$ make all install

Build bootstrap compiler

tar xzf xscale-elf-gcc-3.4.3.tgz
$ cd xscale-elf-gcc-3.4.3
$ mkdir build; cd build
$ ../configure --target=$TARGET --prefix=$PREFIX \
   --with-newlib --without-headers --with-gnu-as \
   --with-gnu-ld --disable-shared --enable-languages=c
$ make all-gcc install-gcc

Build newlib

$ tar xzf newlib-1.13.0.tar.gz
$ cd newlib-1.13.0
$ mkdir build; cd build
$ ../configure --target=$TARGET --prefix=$PREFIX
$ make all install

Rebuild gcc

$ cd xscale-elf-gcc-3.4.3
$ cd build
$ rm -rf *
$ ../configure --target=$TARGET --prefix=$PREFIX \
   --with-gnu-as --with-gnu-ld --enable-languages=c
$ make all install

Verification

You should now be able to compile Blink:

$ cd $TOSROOT/apps/Blink
$ make intelmote2

You should see an executable output.


--Ian Freeman