Building a win32 cygwin gcc cross compiler for ARM -------------------------------------------------- info from David Welch (NOTE: He hasn't given me permission to give out his email so don't ask for it.) The following info is for compiling ARM GCC on linux. To compile Thumb GCC replace all occurances of --target=arm-elf with: --target=thumb-elf To compile ARM & Thumb support in the same version of GCC use this instead with gcc 3.0 or later: --target=arm-thumb-elf get binutils-2.10.1.tar.gz gcc-core-2.95.2.1.tar.gz newlib-1.9.0.tar.gz mkdir /gcc cd /gcc tar xzvf binutils-2.10.1.tar.gz tar xzvf gcc-core-2.95.2.1.tar.gz tar xzvf newlib-1.9.0.tar.gz (Check here for newlib: ftp://ftp.freesoftware.com/pub/sourceware/newlib/) PATH=/gcc/bin:$PATH mkdir build cd build mkdir binutils cd binutils /gcc/binxxx/configure --target=arm-elf --prefix=/gcc/bin make all install cd /gcc/gcc-2.95.2.1/gcc/config/arm/ Add #define HAS_INIT_SECTION to beginning of elf.h file This will supress the gccmain and ctors and dtors stuff... cd /gcc/build mkdir gcc cd gcc /gcc/gcc-2.95.2.1/configure --target=arm-elf --prefix=/gcc --without-headers --without-libs in /gcc/build/gcc/gcc/Makefile change FROM: # Additional target-dependent options for compiling libgcc2.a. TARGET_LIBGCC2_CFLAGS = TO: # Additional target-dependent options for compiling libgcc2.a. TARGET_LIBGCC2_CFLAGS = -Dinhibit_libc You may need to do this to get a clean compile: edit /usr/include/w32api/winnt.h FROM: typedef struct _IMAGE_IMPORT_BY_NAME { WORD Hint; BYTE Name[1]; } IMAGE_IMPORT_BY_NAME,*PIMAGE_IMPORT_BY_NAME; TO: typedef struct _IMAGE_IMPORT_BY_NAME { unsigned short Hint; unsigned char Name[1]; } IMAGE_IMPORT_BY_NAME,*PIMAGE_IMPORT_BY_NAME; make LANGUAGES="c" all install cd /gcc/newlib-1.9.0/newlib/libc/sys/arm/ edit libcfunc.c and syscalls.c blow away all the swi stuff and basically make everything an empty shell: { return(0); } at some point you need to tailor this crt0.S to your needs (setup the stack pointer, clear the bss mem, and jump to main) then save the resulting crt0.o in /gcc/arm-elf/lib/ cd /gcc/build mkdir newlib cd newlib /gcc/newlib-1.9.0/configure --target=arm-elf --prefix=/gcc make all install