This is my tool for building a cross-compiler toolchain for Motorola A780/E680i EZX phones. It is an adaptation of Dan Kegel's crosstool system, with only the relevant portions extracted, and some custom patches added. It should produce a toolchain built from gcc-3.3.6/glibc-2.3.2/binutils-2.15. It can be compared to Leprechaun's E680 toolchain system, but offers improved floating point compatibility.
Current version: 0.6
Instructions:
- Download ezx-crosstool, current version 0.6
- Extract
- Possibly edit the "build.sh" script's RESULT_TOP variable to reflect where you would like the toolchain to be placed when complete.
- Invoke the "build.sh" script.
I will report success building a toolchain on Fedora Core 4 x86 and Gentoo 2005.1 x86. There is an inconsequential hiccup at the end, attempting to build hello.c, where it fails because PATH_MAX is undefined. This can be safely ignored.
Evidence suggests that Motorola used a thoroughly hacked Montavista compiler to build the EZX firmware. This compiler was supposedly based on GCC 3.3, but with a number of advanced features added pertaining to the Intel PXA270 processor. These include support for the newer VFP floating point coprocessor, a software VFP implementation -- PXA270 lacks an FPU -- and support for the "Intel Wireless MMX Technology" iWMMXt coprocessor that is present on the PXA270. All of these were eventually adopted by core GCC, but in much later versions.
ezx-crosstool contains three major GCC patches, to try to most closely replicate the Montavista compiler:
- VFP-softfloat support
- iWMMXt coprocessor support + bug fixes
- Little endian bug fix
The iWMMXt patch contained within ezx-crosstool is a backport of the initial public submission of the iWMMXt support patch by Nick Clifton, plus a handful of bug fixes.
Why is this seemlingly frivolous iWMMXt feature so important? Can't GCC function without something with such a marketing-oriented name? Apparently, building for -mcpu=iwmmxt alters the calling conventions in ways that render code incompatible with that built with -mcpu=armv5te.
Rather than performing a messy backport of the iWMMXt support, or searching for simpler options to get binary compatibility, why not just go to GCC 3.4? This is difficult because the EZX libraries are linked against libstdc++.so.5. GCC 3.4 includes a different C++ ABI, libstdc++.so.6. The older C++ library would need to be ported forward to GCC 3.4 in order to use it, and that seemed like a much more complicated task than backporting the iWMMXt CPU support.
Disclaimer: I am not a GCC maintainer, and am not competent to maintain any particular backend or frontend. In this task, I am acting as a patch monkey. The set of patches contained within ezx-crosstool are what seemed to work for my purposes, which included building many complicated C++ Qt applications that link against Motorola's libqte.
| Attachment | Size |
|---|---|
| ezx-crosstool-0.6.tar.bz2 | 139.56 KB |
Filed Under:
- Login to post comments
Mon, 2005-11-21 23:36
Hi,
Thanks for the research into this. Seems that iwmmxt support will alter alignment for all 64-bit values, not just doubles:
http://www.codesourcery.com/gnu_toolchains/arm/faq.html#q_gnu_linux_long_long
I am not too sure of the legality, but the exact set of patches and build procedures for MV's toolchain can be obtained if you know who to get it from...
- Login to post comments
»Sat, 2006-05-20 07:45
On OSX, do yourself a favor and download fink first. Install it, and then use fink to install sed and gawk. Make sure that /sw/bin is before /usr/bin in your path and THEN run build.sh. Otherwise the version of sed and awk that comes with OSX will pitch fits. Trust me on this.
Also, in testhello.sh, add the -unrecog flag to the test compile lines, otherwise you'll error out with complaints of an undeclared descriptor.
- Login to post comments
»Sat, 2006-05-20 09:47
You don't need the -unrecog flag at all. The problem is that we're including limits.h, and PATH_MAX is not defined in the OSX limits.h. The fix is to include the limits.h that comes in this package. So in testhello.sh, replace this:
#include
with this:
#include "../arm-linux/sys-include/linux/limits.h"
I see no harm in doing this in the main package, as it would work just fine on any platform.
- Login to post comments
»Sat, 2006-05-20 09:48
Okay, stupid html filter. You want to replace this:
#include <limits.h>
with this:
#include "../arm-linux/sys-include/linux/limits.h"
- Login to post comments
»Sat, 2006-05-20 10:39
d'oh.
#include "../arm-linux/include/limits.h"
I'll get it right one of these times.
- Login to post comments
»Sat, 2006-05-27 06:30
Building Busybox-1.1.3 with ezx-crosstool-0.5 using -O2 dies on shell/ash.c:
../shell/ash.c: In function `arith_apply':
../shell/ash.c:13257: error: unable to find a register to spill in class `LO_REGS'
../shell/ash.c:13257: error: this is the insn:
(insn:HI 371 1098 372 59 0x1b1123d0 (set (reg/v:DI 5 r5 [59])
(ashiftrt:DI (reg/v:DI 5 r5 [59])
(subreg:SI (reg/v:DI 41 wr10 [58]) 0))) 444 {ashrdi3} (nil)
(expr_list:REG_DEAD (reg/v:DI 41 wr10 [58])
(nil)))
../shell/ash.c:13257: confused by earlier errors, bailing out
It only happens on -O2 or -O3, works with -O, -Os or -O0. Did I mention this is on cygwin? not sure if that makes a diff or not.
/opt/ezx-crosstool/bin/arm-linux-gcc \
-O2 -g \
-I/opt/ezx-crosstool/include \
-I/opt/ezx-crosstool/arm-linux/include \
-I/opt/ezx-crosstool/lib/gcc-lib/arm-linux/3.3.6/include \
-I../include \
-I../shell \
-D_LARGEFILE_SOURCE \
-D_LARGEFILE64_SOURCE \
-D_FILE_OFFSET_BITS=64 \
-Wall \
-Wstrict-prototypes \
-Wshadow \
-D_GNU_SOURCE \
-c -o ../shell/ash.o ../shell/ash.c
If you need more info or want my .i, please email me.
Daniel
- Login to post comments
»Sun, 2006-09-17 08:18
I write a patch for testhello.sh. It works on my Mandriva 2006. Below is the patch.
diff -uNr ezx-crosstool-0.5-org/testhello.sh ezx-crosstool-0.5/testhello.sh
--- ezx-crosstool-0.5-org/testhello.sh 2005-11-21 10:48:43.000000000 +0800
+++ ezx-crosstool-0.5/testhello.sh 2006-09-17 23:05:43.000000000 +0800
@@ -17,10 +17,12 @@
fi
# Test the C compiler
+# Added path of , from feedback of http://lsb.blogdns.net, s3e, 2006.09.17
cat > hello.c <<_eof_
#include
#include
+#include
static long x = LONG_MIN;
int main() { printf("Hello, world! LONG_MIN is %ld, PATH_MAX is %d\n", x, PATH_MAX); return 0; }
_eof_
- Login to post comments
»Sun, 2006-09-17 08:31
sorry! I've no idea with the filter... :(
This is the right file.
testhello.patch
- Login to post comments
»Fri, 2006-10-20 01:30
somebody help me please,i got this error as follow:
applying patch /cygdrive/d/Cygwin/home/e680/ezx-crosstool-0.5/patches/glibc-2.3.
2/arm-asm-clobber.patch
getandpatch.sh: line 168: patch: command not found
patch /cygdrive/d/Cygwin/home/e680/ezx-crosstool-0.5/patches/glibc-2.3.2/arm-asm
-clobber.patch failed
somebody help?
- Login to post comments
»Sat, 2006-11-11 10:31
I also met this.
It seems cygwin is not supported.
- Login to post comments
»