Installing XScale-ELF cross compiler for intelmote2 on Mac OS X

From TinyOS Wiki
Jump to: navigation, search

Summary:

This tutorial provides instructions for installing the GCC tool chain for XScale-ELF on Mac OS X (Tiger and Leopard). This procedure has been tested on an intel dual core Macbook Pro, but should work for other platforms as well. If you run into problems, or want to provide feedback of any kind, feel free to email me (Kerri Stone) at kstone(at)mines.edu and I'll try to address issues as soon as possible.


Motivation:

The Imote2 sensor node has an Intel PXA271 XScale ® processor, so the installation requires creating a gcc tool chain for XScale ELF.


Packages Required:

To get the gcc xscale cross compiler tool chain to run properly on OS X the following packages are required:

binutils (tested with binutils version – 2.19): [1]

gcc (tested with gcc version – 3.4.4): [2]

newlib (tested with newlib version – 1.17.0): [3]


Installing the GCC tool chain for XScale-ELF:

Set the following environment variables:

  export TARGET=xscale-elf
  export PREFIX=/usr/local
  export PATH=/usr/local/bin:${PATH}


Build GNU Binutils:

  $ tar xzvf binutils-2.19.tar.gz
  $ mkdir buildBinutils
  $ cd buildBinutils
  $ ../binutils-2.19/configure --target=$TARGET --prefix=$PREFIX
  $ sudo make all install
  $ cd ..

Note:

  • As of writing, binutils-2.20.1 works
  • Have to invoke the configure script with the option "--disable-werror", if using Apple's gcc-4.x compiler

Building the GCC Compiler:

This is a chicken and an egg problem...this step creates a bootstrap cross compiler using gcc-3.4.4 so that we could build a compiler for our target (xscale-elf).

  $ bzip2 -d gcc-3.4.4.tar.bz2
  $ tar xvf gcc-3.4.4.tar
  $ mkdir buildGcc
  $ cd buildGcc
  $ ../gcc-3.4.4/configure --target=$TARGET --prefix=$PREFIX --with-newlib --without-headers --with-gnu-as --with-gnu-ld --disable-shared 
     --enable-languages=c
  $ sudo make all-gcc install-gcc
  $ cd ..

Note:

  • As of writing, gcc-3.4.6 works, but gcc-4.x does not

Building the newlib C Runtime:

Build the xscale-elf version of newlib C runtime.

  $ tar xzvf newlib-1.17.0.tar.gz
  $ mkdir buildNewlib
  $ cd buildNewlib
  $ ../newlib-1.17.0/configure --target=$TARGET --prefix=$PREFIX
  $ sudo make all install
  $ cd ..


Build the complete XScale-ELF Cross Compiler:

This is the final step, and completes the building of GCC XScale-ELF Cross Compiler for Intelmote2 (Imote2).

  $ cd buildGcc 
  $ sudo rm -rf *
  $ ../gcc-3.4.4/configure --target=$TARGET --prefix=$PREFIX --with-gnu-ld --with-gnu-as --enable-languages=c
  $ sudo make all install

Building TinyOS Demo App Blink:

  $ cd $TOSROOT/apps/Blink
  $ make intelmote2

Complete TInyOS 2.x install for OS X

Reliable tutorial for installing TinyOS 2.x on OS X: Installing tinyos-2.x on Mac OS X (Tiger & Leopard)