|
|
The ARM toolchain for Linux is maintained by Phil Blundell.
Reference
The Wookey's 'GNU Toolchain for ARM targets HOWTO' is available in html and pdf forms.
Listing of GCC releases
Mail Archives
Bug in GCC2.96 [0740]
GCC patch for ARM PIC code [00559]
[00573]
[00447]
GCC patch for arm-uclinux [00651]
[00216]
[00368]
Build ARM Toolchain Step by Step
Thanks to David McCullough's elf2flt patch
for the ARM platforms, the userland applications for uClinux do not need the -mdisable-got flag any more.
GCC 2.95.3
GCC 3.0.1
Build ARM Toolchain Based on gcc-2.95.3
- Build binutils ...
Download the binutils-2.10.tar.gz
# tar zxvf binutils-2.10.tar.gz
# cd binutils-2.10
# mkdir build
# cd build
# ../configure --target=arm-elf --prefix=/usr/local/gnu
# make
# make install [Note: write access to /usr/local/gnu is required]
- Build gcc ...
Download the gcc-2.95.3.tar.gz
# tar zxvf gcc-2.95.3.tar.gz
Apply patch from Philip Blundell to change the Position Independent Code generation for ARM:
# gzip -cd gcc-2.95.3-arm-pic.patch.gz | patch -p0
# cd gcc-2.95.3
# mkdir build
# cd build
# ../configure --target=arm-elf --prefix=/usr/local/gnu --disable-threads
# make LANGUAGES="c" [Note: be sure /usr/local/gnu/bin is in the PATH list]
Since this is the first time you have built a cross-compiler on your host, the C runtime startup file does not exist, so you will get the error like this:
make[1]: Leaving directory `/home/tzeng/gcc-2.95.3/build/gcc'
Configuring in arm-elf/libio
...
checking whether the C compiler (/home/tzeng/gcc-2.95.3/build/gcc/xgcc
-B/home/tzeng/gcc-2.95.3/build/gcc/ -B/usr/local/gnu/arm-elf/bin/ -g -O2 )
works... no
configure: error: installation or configuration problem: C compiler cannot
create executables.
continue installing the C compiler only:
# cd gcc
# make install
- Build libc ...
Download the newlib.tar.gz
# tar zxvf newlib.tar.gz
# cd newlib-1.8.1
# mkdir build
# cd build
You may choose ARM_RDI_MONITOR in ../newlib/configure.in to select Angel monitor support now.
# ../configure --target=arm-elf --prefix=/usr/local/gnu
--enable-target-optspace
# make
# make install
- Build other languages supports in gcc ...
# cd gcc-2.95.3/build
# ../configure --target=arm-elf --prefix=/usr/local/gnu
# make LANGUAGES="c c++"
# make install
Build ARM Toolchain Based on gcc-3.0.1
- Build binutils ...
Download the binutils-2.10.tar.gz
# tar zxvf binutils-2.10.tar.gz
# cd binutils-2.10
# mkdir build
# cd build
# ../configure --target=arm-elf --prefix=/usr/local/gnu
# make
# make install [Note: write access to /usr/local/gnu is required]
- Build gcc ...
Download the gcc-3.0.1.tar.gz
# tar zxvf gcc-3.0.1.tar.gz
Apply patch to enable fpu, thumb interworking multilib. [Optional]
# gzip -cd gcc-3.0.1-thumb-interwork.patch.gz | patch -p0
# cd gcc-3.0.1
# mkdir build
# cd build
# ../configure --target=arm-elf --prefix=/usr/local/gnu --disable-threads
--with-newlib --disable-shared --enable-languages=c
# make [Note: be sure /usr/local/gnu/bin is in the PATH list]
# make install
- Build libc ...
Download the newlib.tar.gz
# tar zxvf newlib.tar.gz
Apply patch to fix type conversion for signal library.
# gzip -cd newlib-1.8.1-gcc3.patch.gz | patch -p0
# cd newlib-1.8.1
# mkdir build
# cd build
You may choose ARM_RDI_MONITOR in ../newlib/configure.in to select Angel monitor support now.
# ../configure --target=arm-elf --prefix=/usr/local/gnu
--enable-target-optspace
# make
# make install
- Build other languages supports in gcc ...
# cd gcc-3.0.1/build
# ../configure --target=arm-elf --prefix=/usr/local/gnu --disable-threads
--with-newlib --disable-shared --enable-languages=c,c++
# make
# make install
The following is quoted from Wookey's 'GNU Toolchain for ARM targets HOWTO'
Whatever target name you build gcc for, the main code engine still contains support for all the different ARM variations (i.e. it's the same whatever target name you build with). However, there is a library accompanying gcc,
containing some fundamental support routines, called libgcc.a. This is the thing that will differ between different target names, and this is what makes different toolchains binary incompatible.
My Notebook
- Why the need of 'no-got' or 'disable-got' gcc flag?
To generate relocatable FLAT userland programs for uClinux, the $(LD) has to emit reloc informations:
| LDFLAGS | ELF Type | Reloc Info. | Has GOT | Solve Undef. |
|---|
| EXEC(Executable file) | No(1) | Yes | Yes |
| -r | REL(Relocatable file) | Yes | No(2) | No |
| -shared | DYN(Shared Object File) | Yes | Yes(3) | No |
Note1: Reloc info. are absolutely required as below:
void (*foo)(char*);
char *str = "Hello"; /* will be in .data */
...
{ ...
(*foo)(str);
ldr r3,[pc,#18] /* offset into GOT */
ldr r3,[r9,r3] /* addr of 'str' */
ldr r0,[r3] /* addr of "Hello" has to be relocated */
Note2: Due to .got doesn't exist in REL files, the 'elf2flt' is unable to put GOT entries into the flat image.
Note3: Aplio use it! To be digged into further.
- What are the differences between those arm-gcc?
|