CodeSourcery GNU Toolchain for the ARM on a Mac

By | May 8, 2009

CodeSourcery are the maintainers of the GNU Toolchain for ARM processors. They have a range of commercial offerings but, if you are prepared to use command-line tools, they also provide just those as Sourcery G++ Lite. The Lite edition includes the GNU C and C++ compilers, GNU Assembler and Linker, GNU debugger and Instruction Set Simulator. For Windows and Linux hosts, these are available as binary distributions that simply install and are ready to use. For the Mac, you need to build them from sources available on the CodeSourcery site.

First, lets have a look at the prerequisites. I have a fairly new Intel based iMac and a moderately new MacBook Pro – also Intel based. these both run OX X Leopard and both have the latest version of XCode installed. XCode is supplied on your OS X installation disk(s) and you will need to make sure that is on before you do anything else. I am no kind of Mac expert so I have no idea what might be wrong from that end of things if you can’t make this work on your machine. I am well aware that the web is full of recipes just like this one where it all works fine on my setup but may not work on yours. If it does not work for you, I am afraid I probably won’t be of much help. I have repeated the process a couple of times so I am fairly confident that it is reproducible. That said, what else do you need?

Before you can build the compiler, you will need a couple more things to be present on your computer. the first of these is TeX, the typesetting system. this is a bit annoying because it is only needed to generate part of the documentation but I have not worked out how to do without it. The reason it is annoying is that it is a 1.2GB download. Yes, 1.2GB so start it going now and go and watch a movie or two. It may be possible to download one of the reduced versions but then, if you have to start again, even more time will be wasted so I would suggest doing the whole lot now. Who knows, you may take a fancy for the publishing business. You can get TeX here:

http://tug.org/mactex/

I went for the whole package and installed it as per the instructions.

Now you can go and download the source distribution from the CodeSourcery website:

http://www.codesourcery.com/sgpp/lite/arm/portal/release642

At the time of writing (May 2009), the current release is 2008Q3-66 for ARM EABI. You need the Source TAR file. Download it and extract it to a folder on your computer. The folder will end up with a name like

arm-2008q3-66-arm-none-eabi

Now I need you to have a look at the excellent instructions by James Snyder at this location:

http://fanplastic.org/gcc-for-arm-eabi/

Follow his instructions carefully with the exception that, before you add the target folder to your path, you must create that folder or you will end up with your PATH variable trashed. Guess how I know that. Unless that folder is in your path, later steps in the build process will fail.

When it has all finished, which will take a little while, you can test your installation from the command line with a command like this:

arm-eabi-gcc -v

which should result in output something like this:

Using built-in specs.
Target: arm-eabi
Configured with: ../../gcc-4.3/configure -prefix=/Users/peterharrison/arm-cs-tools/
--target=arm-eabi --enable-languages=c++ --with-gnu-ld --with-gnu-as --with-newlib
--disable-nls --disable-libssp --with-newlib --without-headers --disable-shared
--disable-threads --disable-libmudflap --disable-libgomp --disable-libstdcxx-pch
--disable-libunwind-exceptions
Thread model: single
gcc version 4.3.2 (GCC) 

At that stage, you will need to take a break because you are ahead of the game and don’t want to get over-tired.




One thought on “CodeSourcery GNU Toolchain for the ARM on a Mac

  1. James Snyder

    Hi. Thanks for linking over to me. I thought I had added a note about LaTeX being needed, but apparently I forgot. Also I’ve adjusted the instructions to include creating the directory before going ahead since while this hasn’t happened to me with zsh, I’ve heard one or two other people say that their path got trashed.

    If anyone else has any recommendations or comments, please let me know 🙂

    One of these days I’ll figure out how to remove the LaTeX requirement, since I don’t think it’s actually necessary on plain GCC sources (which, incidentally, don’t work as well for me as the CodeSourcery ones).

Leave a Reply