IMote2 Compiler
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).
Contents
Installing xscale-elf toolchain with Debian packages
Download packages
Download the following package files:
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.
Newer Toolchains
You may wish to install available deb packages with updated compiler versions, namely 4.1.1 or even 4.3.3. They have been successfully tested for some months at a lab and now are publicly available. You do not need to install any other package (such as newlib or binutils) as they are already included. Should you experience any trouble, make sure you are actually using the proper version rather than any other previously installed on your system.
arm-compiler-none-eabi-4.3.3-3.deb
For further information on compilation optimization with such packages or their usage, check section 7 of Compiling for an ARM architecture: iMote2-TinyOS.
--ndopico 21 October 2010
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:
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.
Note: These instructions were tested and found to be working on Ubuntu 8.04 and XubunTOS-2.0 (Ubuntu 7.04). Some times during the testing, instead of the
/usr
, we tried with
/opt
directory and it still works.
Using Newer Toolchain
Given that several members of our group had had difficulty compiling certain applications using the GNU toolchain described above, I have tested these instructions using GCC 4.2.4 and Binutils 2.17 (later versions of Binutils (2.18) may work; I did test with GCC 4.3.1 and was unable to compile for the "arm-eabi" target.) (Bor-rong Chen update: I was able to compile the toolchain using GCC 4.3.2, binutils 2.18, newlib 1.16)
A few small diffs are needed against the generally excellent instructions above, including:
- Apparently xscale-elf support is being phased out, so you need to export TARGET=arm-eabi.
- Once you have compiled and installed the toolchain, you need to fix a few things in various places in the T2 tree to get the compilation process to work correctly. In our T2 tree I've created a new compilation target called intelmote2-gcc42, which should be apparently how to do from the diffs below, but in general you need to make the following changes in the following places:
- support/make/pxa27x/pxa27x.rules, to fix various pieces of the toolchain:
- s/xscale-elf-as/arm-eabi-as/, s/xscale-elf-objdump/arm-eabi-objdump/, s/xscale-elf-objcopy/arm-eabi-objcopy/. You can probably do a global search and replace changing "xscale-elf" to "arm-eabi".
- Add "PFLAGS += -mcpu=xscale". If you do not set this correctly the compiler will emit incorrect instructions causing some things to work and others to fail miserably.
- tos/platforms/intelmote2/.platform, to fix the compiler target: (not sure why this is hidden here)
- s/xscale-elf-gcc/arm-eabi-gcc/.
- support/make/pxa27x/pxa27x.rules, to fix various pieces of the toolchain:
Testing Newer Toolchain
So far the following things seem to work:
- apps/Blink
- apps/RadioCountToLeds
- Our volcano application, which is quite complex and exercises the radio and Flash as well as a number of other things.
I've run a few of the things in the test directory for fun:
- Radio
- apps/tests/LplBroadcastCountToLeds (needs to add TARGET_INTELMOTE2 to the list of supported targets to compile)
- apps/tests/LplBroadcastPeriodicDelivery (needs to add TARGET_INTELMOTE2 to the list of supported targets to compile)
- apps/tests/LplUnicastPeriodicDelivery (needs to add TARGET_INTELMOTE2 to the list of supported targets to compile)
- apps/tests/TestAcks/
- apps/tests/TestPacketLink/
- Flash
- apps/tests/storage/Block
- apps/tests/storage/CircularLog
- apps/tests/storage/Config
Feel free to add to either of these lists if you successfully use the GCC 4.2.4 tools.
--Gwa 14:07, 11 July 2008 (EDT)