We’ve tried building our own ARM cross compiler on a Linux box and it’s no picnic. Luckily there is a free cross compiling toolchain available through Mentor Graphics (formerly called Code Sourcery G++). But those looking to develop on a Mac aren’t so lucky. There is help via a script, and [Michael] wrote a guide detailing how to use crosstool-ng to build an ARM toolchain on Mountain Lion.
Crosstool-ng is a script which automates much of what is needed when compiling all the different components. But there is a some groundwork that needs to be in place before you can run it. For instance, some of the tools that ship with OSX aren’t entirely compatible with the GNU tools the script is looking for. One example is ‘grep’. Mountain Lion has the BSD version of grep but it is missing a few of the GNU version’s commands used by crosstool-ng. [Michael] will guide you through this and a handful of other issues until you have a functioning toolchain up and running.
MacPorts to the rescue… pick your poison…
$ sudo port install arm-elf-gcc
$ sudo port install arm-aout-gcc
$ sudo port install arm-elf-gcc3
$ sudo port install arm-none-eabi-gcc
$ sudo port install arm-none-linux-gnueabi-gcc
$ sudo port install arm-rtems-gcc
well, I tried arm-none-eabi-gcc 4.6.2 from ports for launchpad, and it has a bug (or something) with floating point math… I ended with building arm-eabi-toolchain toolchain from jsnyder from source…
so, sometimes, easiest way is not the correct way… but that’s maybe only me… :-D
That script pulls the sources from Mentor/CodeSourcery, so there may be changes from vanilla FSF tools. Just something to be aware of.
The script also installs/builds GCC’s dependent libraries separately, while instead you should run the script $(gcc-sources)/contrib/download_prerequisites to download the appropriate sources into the GCC source tree where they will be built as part of GCC’s normal build process.
It’s worth figuring out how to build the toolchain from scratch, by hand, so you’re not dependent on whatever scripts or pre-built versions you can find.
This just looks so sad :)
I just run this script. It’s very easy, the hardest part is that it’s not well explained which precise archive you want, but that’s very quickly solved with a bit of poking around (hint, it’s gcc-arm-none-eabi-4_6-2012q4-20121016-src.tar.bz2).
https://github.com/ekawahyu/gcc-arm-embedded-macosx
Oh, boy, did I ever flub that one. Here’s the right archive: gcc-arm-none-eabi-4_6-2012q2-20120614.tar.bz2
That script is for building the bare metal toolchain, not the gnu-linux toolchain, so it’s accomplishes something different than the main post.
These guys seems to release a build for OSX based on the Code Sorcery one. I haven’t tested it much though.
http://www.carlson-minot.com/mac-os-x-cross-toolchains/mac-os-x-cross-toolchain-faqs
Toolchain built using crosstool-ng with raspberry pi preset:
https://github.com/Kentzo/armv6-rpi-linux-gnueabihf
Thanks for posting this. How do I use your crosstool-ng version? Sorry, I’ve been out of the Linux game for a while.
been here, just a pain… easier to go buy a used thinkpad and stick ubuntu on it.. then at least you don’t blow up your mac if you make a mistake with wires on your dev board !