GCC for ARM EABI
THIS GUIDE HAS MOVED TO A GITHUB PROJECT AT THE FOLLOWING LOCATION: http://github.com/jsnyder/arm-eabi-toolchain The guide below may still work, but future updates will only be made to the project on GitHub. This short guide explains how to build a GCC toolchain used to cross-compile for ARM EABI targets. May 19, 2009: Seems to still work with the new 2009Q1 release as well. To build this toolchain, you’ll need to first acquire sources for GCC, binutils, Newlib & GDB. In this example we’ll be using CodeSourcery’s G++ Lite sources which include all of these, and have been validated by CS’s QA process. In addition, you will need to have GCC, make, binutils and latex installed on your machine to compile all of this. You can all of these on Mac OS X, except LaTeX, by just installing the Apple Developer Tools which are free here. LaTeX can be acquired from here: http://tug.org/mactex/ (It should be possible to do this build without using LaTeX, which is just used for documentation, if I find a solution, I’ll update the Makefile) Download the 2009Q3 sources for CodeSourcery G++ for ARM EABI from here: http://www.codesourcery.com/sgpp/lite/arm/portal/release1033 This process should also generally work with the general GCC sources and main Newlib sources, but CodeSourcery does much of the maintenance on ARM GCC. Sometimes a significant amount of time can pass before their patches are actually merged into mainline GCC. Once you’ve acquired these sources, decompress the outer archive: NOTE: The name used here for the archive, and the other compressed archives will differ if you’ve downloaded a version released after the 2009 q1 161 release. Switch into the directory extracted: Next, grab this compressed archive and place the contents in the directory you’ve been working in (example: arm-2009q3-66-arm-none-eabi). You will want the Makefile and gcc-44.patch directly in the directory you switched to above. If you haven’t installed gmp or mpfr, install them first: (sudo is needed because gmp and mpfr will go into /usr/local, these aren’t specific to the toolchain, but are needed to build gcc) Next extract the newlib, gcc, binutils & gdb archives: Add the path where the compiler will go to your current path, and make: If you’re running Snow Leopard (10.6), you will need to patch the GCC that comes with G++ Lite 2009Q3: Next (for all users) build the toolchain: This should build the compiler, newlib, gdb, etc.. and install them all into a directory called arm-cs-tools in your home directory. If you want to install to another location, feel free to change the export lines and to adjust the definitions at the top of the Makefile. Keep in mind that the Makefile does install at the end of each build. Once you’re done, you’ll likely want to add the path where the compiler was installed to to your .bash_profile, .zshrc, etc..: Any adjustments or improvements are welcomed. This build works for me on a Mac OS X (10.5, 10.6) machine where the Apple developer tools were already installed (necessary to compile everything). If you’re working with STM32 platform and are looking for a method to load your freshly generated image onto your embedded device using ST’s STM32 boot loader, thankfully there exists Python code that will help you do just that. It only requires PySerial to be installed in order to communicate with the device bootloader.
Oct 22, 2009: Update: Snow Leopard build is now working for 2009Q1. A new 2009Q3 release is out, however I’ve had difficulty with output generated by both pre-compiled tools from CodeSourcery and those I’ve tried building using the method in this guide. An update will be posted if I can get a build that seems to still compile eLua properly.
Feb 19, 2010: Update for 2009Q3.
Feb 24, 2010: Fix errors in uploaded tarball.Requirements
Building Instructions
tar -jxvf arm-2009q3-68-arm-none-eabi.src.tar.bz2cd arm-2009q3-68-arm-none-eabitar -jxf gmp-*.tar.bz2
tar -jxf mpfr-*.tar.bz2
sudo make install-depstar -jxf newlib-*.tar.bz2
tar -jxf gcc-*.tar.bz2
tar -jxf binutils-*.tar.bz2
tar -jxf gdb-*.tar.bz2mkdir -p $HOME/arm-cs-tools/bin
export PATH=$HOME/arm-cs-tools/bin:$PATHmake gcc44patchmake install-crossexport PATH=$HOME/arm-cs-tools/bin:$PATHAdditional Notes