Crosscompiling and the EOCP

Notes on building the crosscompilers with Cygwin

Cygwin may fail in the entire build for the buildroot project, yet succeed in building the crosscompiler. This may make you feel dirty inside, which is the correct response you should have. Instead, make sure you use a linux machine to build the crosscompiler.

Overview

For our project, we heavily leverage the buildroot project. Buildroot is a set of installation and configuration scripts which builds a usable root image of a linux filesystem according to builder configuration preferences. Those preferences include,

  • Processor architecture (i.e., ARCH) type (e.g., x86, PowerPC, ARM, sparc)
  • Processor subarchitecture (i.e., SUBARCH) type (e.g., PentiumPro, Xeon, X-Scale)
  • Kernel version
  • uClibc version
  • Binutils version
  • GCC contents (e.g., ada, java, c, c++) and version
  • A GCC crosscompiler (i.e., development toolchain, or just toolchain)

Crosscompiling

In order to build this image, it necessarily builds a boostrap GCC version. Using this version, which is made to run on the host machine and compiles code to execute on the host machine, a new compiler which is made to run on the host machine and compile code to execute on the target machine is built. This second compiler is the crosscompiler.

Building a crosscompiler is usually tedious work, but buildroot has (mostly) solved these problems, and places them in a nice package. Note that we actually build the entire root file system--not just the crosscompiler. However, in some sense it's easier to build the whole thing, than take out what we don't need; plus, we have the exact kernel built with our crosscompiler as well, and we can ensure that it runs correctly then.

Using buildroot crosscompilers with the EOCP

Selecting the crosscompiler once it is built

Testing the crosscompiler

Testing the crosscompiled code

There is a testing machine hooked up to the ransom.eecs box. You can scp your executable to it by something like this:

[sprinkle@ransom /usr/local/escher/crosscompile/test/HelloWorld/build]
$ scp HelloWorld root@gumstix2:/tmp/sprinkle
 

This will only work if the destination directory exists. Next, ssh to the gumstix2 machine (you can get the root password from sprinkle@EECS).

[sprinkle@ransom /usr/local/escher/crosscompile/test/HelloWorld/build]
$ ssh root@gumstix2
 

Now that you are on the gumstix board, you can run that executable

# cd /tmp/sprinkle

# ./HelloWorld
HelloWorld!
#

You might get errors here. It either means that your crosscompiler is built wrong, it was configured wrong, the test code was configured wrong, the kernel was chosen wrong...anyway, that's what we're here for!