Difference between revisions of "IMote2 Compiler"

From TinyOS Wiki
Jump to: navigation, search
(Installing xscale-elf toolchain from source)
(Installing xscale-elf toolchain from source)
Line 30: Line 30:
 
If you can install debian packages and do no need the source, this section is not for you. Scroll up and install the packages.
 
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: [http://www.eecs.harvard.edu/~konrad/projects/imote2Camera/IMote2-Installation-Instructions.html]
+
The xscale-elf rpms on the Tinyos-2.x install page contain a version of newlib that does not work on debian linux. Instead, we opted for a newer version of newlib (1:13). In this section, we mostly followed the instructions from the Harvard imote2 install page for compiling from source: [http://www.eecs.harvard.edu/~konrad/projects/imote2Camera/IMote2-Installation-Instructions.html]
  
 
=== Download source ===
 
=== Download source ===
Line 41: Line 41:
  
 
[ftp://sources.redhat.com/pub/newlib/newlib-1.13.0.tar.gz newlib 1.13]
 
[ftp://sources.redhat.com/pub/newlib/newlib-1.13.0.tar.gz newlib 1.13]
 +
 +
'''Note: The links to the source files are different from the ones on the Harvard imote2 install page.'''
  
 
=== Define environment variables ===
 
=== Define environment variables ===

Revision as of 12:10, 21 May 2008

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. Instead, we opted for a newer version of newlib (1:13). In this section, we mostly followed the instructions from the Harvard imote2 install page for compiling from source: [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

Note: The links to the source files are different from the ones on the Harvard imote2 install page.

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