Installing an ARM cross-compiler on Mac Mountain Lion

Here I will describe my installation of an ARM cross compiler, on a MacBook Air with Mac OS Mountain Lion.

After some searching on the net I decided to try the YAGARTO toolchain.

Navigating to the download place for Mac, I downloaded the file

yagarto-bu-2.22_gcc-4.7.1-c-c++_nl-1.20.0_gdb-7.4.1_eabi_intelmac_20120616.dmg

Using this file however led to an error, saying

selected processor does not support requested special purpose register -- `mrs r0,cpsr'

I reverted to an older version, found at YAGARTO’s Sourceforge page. This led to download of the file

yagarto-bu-2.21_gcc-4.6.2-c-c++_nl-1.19.0_gdb-7.3.1_eabi_intelmac_20111119.dmg

Double-clicking on this downloaded file, I was able to install the toolchain.

I then added the following changes

export ARM_GCC_LOCATION=/Users/oladahl/yagarto/yagarto-4.6.2/bin
export PATH=$ARM_GCC_LOCATION:$PATH

to my setup script, where I also set up other environment variables.

Now I can start programming for ARM!

As an example, I can compile, link, and run the example described in Chapter The Bare Metal in the book Into Embedded.

Advertisements

Installing an ARM cross compiler on Ubuntu

Here I will describe my installation of an ARM cross compiler, on an x86 machine with Ubuntu Linux.

Updates to this post

  • July 12, 2013 – changed to a later version of the Sourcery ARM compiler – now using version 2013.05-23
  • March 1, 2013 – changed to a later version of the Sourcery ARM compiler – now using version 2012.09-63

I had decided to use the Sourcery ARM compiler, formerly from CodeSourcery and now from Mentor.

I go to the page

http://www.mentor.com/embedded-software/sourcery-tools/sourcery-codebench/editions/lite-edition/

at which I decide to use the EABI release for ARM processors.

Then, I continue to the installation page for the ARM EABI version.

After having created an account (this was my first time here) and then logging in, I get an e-mail with a download link from which I can proceed to a page where I can download the IA32 GNU/Linux Installer. Doing this results in download of a file named arm-2013.05-23-arm-none-eabi.bin.

I make the file executable by doing

chmod +x arm-2013.05-23-arm-none-eabi.bin

and then I run the file, using the command

./arm-2013.05-23-arm-none-eabi.bin

This command results in an error message, and I am instructed to issue the command

sudo dpkg-reconfigure -plow dash

and then answer the question that comes up as instructed by the error message.

Now, again running the command

./arm-2013.05-23-arm-none-eabi.bin

results in the installation being started. After having gone through steps involving reading and accepting license agreements, followed by a decision to not create any symbolic links, and to not send anonymous information about usage of the ARM compiler, the installation is complete.

As a last step, I modify the PATH environment variable using the commands (where /home/ola is my home directory)

export ARM_GCC_LOCATION=/home/ola/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_EABI/bin
export PATH=$ARM_GCC_LOCATION:$PATH

I put the above two lines in a setup file, called setup.sh, that I run every time I want to use the ARM toolchain.

Now I can start programming for ARM!

As an example, I can compile, link, and run the example described in Chapter The Bare Metal in the book Into Embedded.