You can find all the sources at (GNU Downloads)
Download the following:
binutils-2.23.2
gcc-4.7.3
gdb-7.4.1
These must be compiled in the proper order:
binutils
gcc
gdb
Rename your existing gnutools directory if you intend to install the toolchain in the same location.
The binutils includes the assembler and other support tools required by the gcc tool chain.
We will work in the directory /var/local. I happen to be using RHEL6 64 bit, but this should work on any linux OS. You may run into a problem if some library or tool is missing, so when something fails, try to first assume you need to install something. I install missing libraries and tools with “yum.”
Now, uncompress binutils to /var/local/src. You will put all the other sources in this same directory. Then create the directory /var/local/build/binutils. Each tool will have its own build directory. I choose to do all this as superuser, but most people will tell you not to do that, and to give yourself permissions on these dirs. I would rather not erase things doing routine work, so I use root.
Before we can actually build anything, we need a couple of environment variables. I am working in a bash shell, so I type:
TARGET=arm-eabi
PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/ecos/gnutools/arm-eabi/bin
The target is arm-eabi, meaning ARM Embedded Application Binary Interface. This includes the whole ARM family, however in a later step we are going to control which ARM platforms are supported.
The last directory is the target directory where we are going to install the results:
/opt/ecos/gnutools/arm-eabi/bin
If you change this to another location, make sure you make the change for all the instructions below.
Now, change directory in your shell to /var/local/build/binutils, and type:
/var/local/src/binutils-2.23.2/configure --target=$TARGET --prefix=/opt/ecos/gnutools/$TARGET
This will configure the binutils build system. Then type:
make
After compilation, type:
make install
At this point you can inspect /opt/ecos/gnutools/arm-eabi/bin directory and see that a bunch of tools were installed including the assembler.
Note: You can use "make clean" to free up disk space here and after all other "make install" steps. You can also do a "make distclean" to clean up even more.
Put the source in place at /var/local/src, make the dir /var/local/build/gcc, change to the source directory at /var/local/src/gcc-4.7.3.
Type:
./contrib/download_prerequisites
You can also manually download and compile them, but I found it very difficult to find compatible versions. This one simple command makes everything 10X easier. It will put several additional subtrees in the gcc source tree that will be compiled with gcc. Just do a "before" and "after" tree diff to see what it added.
The gcc tree must be patched. The patches include previous patches of the eCos toolchain, and updating multi lib to handle Cortex A. You can find the path in the Toolchain folder on this site.
patch -p0 < ecos-a9-gcc-4.7.3.patch
patching file gcc-4.7.3/gcc/config/arm/arm.h
patching file gcc-4.7.3/gcc/config/arm/elf.h
patching file gcc-4.7.3/gcc/config/arm/t-arm-elf
patching file gcc-4.7.3/gcc/config/elfos.h
patching file gcc-4.7.3/libgcc/config/arm/t-divmod-ef
patching file gcc-4.7.3/libgcc/config.host
patching file gcc-4.7.3/libgcc/Makefile.in
patching file gcc-4.7.3/libgcc/shared-object.mk
patching file gcc-4.7.3/libgcc/static-object.mk
patching file gcc-4.7.3/libstdc++-v3/configure
patching file gcc-4.7.3/libstdc++-v3/configure.ac
Note: Some of these files do not need to be patched and are the result of generating the patch against a configured gcc tree. However, using this patch captures all the changes that where in place when I compiled my tool chain.
Uncompress sys-include.tar.gz and put the contents in /opt/ecos/gnutools/arm-eabi/arm-eabi/sys-include. This equivalent to the instructions for making header files per the Code Confidence technical note 0003.
Now, change to the build directory at /var/local/build/gcc, and type:
/var/local/src/gcc-4.7.3/configure --target=$TARGET --prefix=/opt/ecos/gnutools/$TARGET --with-newlib --with-gnu-as --with-gnu-ld --enable-languages=c,c++ --enable-threads --disable-hosted-libstdcxx --disable-__cxa_atexit
This will configure the gcc build system. Then type:
make
After compilation, type:
make install
The above process is very similar to the Code Confidence technical note. It just involves different patches and a tarball of sys-include. However, there are two final steps.
In the sys-include directory are three directories:
Delete cyg and pkgconf to avoid problems, especially during development. I found that if they were generated from the iMX6/A9 template, and you make changes to the HAL, it can compile using older headers from those directories under certain circumstances. Deleting them can save you debug time.
Put the file reent.h in the sys directory.
Copy the sources and make a build directory as was done for gcc.
Change to the build directory and type:
/var/local/src/gdb-7.4.1/configure --with-expat --target=$TARGET --prefix=/opt/ecos/gnutools/$TARGET
This will configure the gdb build system. Then type:
make
make install
Now you have a tool chain!
This toolchain should support all ARM platforms, but obviously has not been tested on them. It produces some warnings that the released toolchain does not. Perhaps over time if this toolchain is proven out it can be used on all targets. Before then, use the released toolchain if you have problems on other targets.