At work, I had to create a big-endian ARM toolchain for a project I was
working on. This documents the steps that I took to create the toolchain.
First of all, grab a copy of crosstool.
This wonderful set of scripts automates most of the drudgery of creating
a cross compiler.
You may also want to grab a copy of Karim Yaghmour's book
Building Embedded Linux Systems
which documents the process quite well in Chapter 4.
I wanted my toolchain to build big endian by default (i.e. without passing
-mbig-endian on the command line), so I started digging a bit.
I used a target of armv4b-unknown-linux-gnu and discovered that the assembler
still required -EB on the command line. I found a mention about a problem
in the configure script here.
This fixed gas, but ld still needed to be fixed. After digging around a bit,
I discovered that ld supports both big and little endian and that the OUTPUT_FORMAT
directive in the linker script file controls this. I wrapped all of the changes
up into binutils-2.12.1-arm-bigendian.patch
After building ld, you can use:
to see what the default linker script is.
The next problem was to get gcc to consider -mbig-endian as the default.
I created gcc-2.95.3-arm-bigendian.patch
to deal with that.
After you've expanded crosstool,
create a directory named 'binutils-2.12.1-patches', if required.
(inside the crosstool directory) and copy the
in. Copy the
into the 'gcc-2.95.3-patches' directory (which should already exist).
I created my own armb.dat file to use with crosstool's
all.sh script as follows:
eval `cat armb.dat` sh all.sh --notest
Go and get a coffee, and a couple of hours later you should have a toolchain.
Because I'm lazy and don't like typing long names (i.e. armv4b-unknown-linux-gnu-gcc)
I created MakeLinks.sh which creates shorter aliases
(i.e. arm-gcc instead of the previous monstrosity).
Disclaimer: The patches mentioned above are not terribly generic, and will only work for
the target I chose.