Toolchain

From Sharpfin
Revision as of 16:04, 24 September 2012 by Philipp (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Cheat

If you want to cheat, and want to do your development under Cygwin, you can download a pre-compiled cross-compiler toolchain for the Cygwin environment on the Releases page.

Download Crosstool

Crosstool is a collection of scripts which can help you building a cross compiler toolchain without pain. Get the latest version from [1]

Build the toolchain

Reciva uses two different toolchains to build the radio software. gcc 3.3.4 is used for the kernel, and 4.1.0 is used for the userspace applications.

The following creates the 4.1.0 toolchain in /opt.

  • First check that you have flex and bison as they are required but the toolchain builder doesn't check for them.
  • unpack crosstool into /opt and rename it. (You will probably need to be root to do this):
 cd /opt 
 tar -zxvf crosstool-<version>.tgz
 mv crosstool-<version> crosstool
  • The crosstool builder won't run if you are root but normal users can't write to /opt so set the permissions on the crosstool directory.
 chown -R <normal-user> crosstool
  • Log in as a normal user and go to /opt
  • choose the right flavour and build
 export RESULT_TOP=/opt/crosstool
 eval `cat arm9tdmi.dat gcc-4.1.0-glibc-2.3.2.dat` sh all.sh --notest

This might take some time. If all goes well, you'll end up with a fresh cross compiler in /opt/crosstool


Finally check if the development package of libc is installed (otherwise Crosscompiling will most probably fail afterwards):

 sudo apt-get install libc6-dev

Configure Your Shell

The sharpfin build scripts look for 'arm-9tdmi-linux-gnu-gcc' and other cross-compiling programs in the path. If you add the following lines to your .bashrc file, any cross-tools programs you build will automatically be added to your path:

export RESULT_TOP=/opt/crosstool
COMPILERS=`find $RESULT_TOP -type d -name bin|tr '\n' ':'`
export PATH=$PATH:$COMPILERS
alias cc=arm-9tdmi-linux-gnu-gcc