Installing an ARM cross compiler on Ubuntu
October 11, 2012 4 Comments
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.
Awesome. Thanks. Worked fine for me.
For the line:-
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.
Could you please tell me how to do that? I mean how to create a setup.sh file and then moving those instructions into it in command line?
Thanks
I use a text editor, like Emacs, to create a file called setup.sh. I enter the two lines into this file, and then I run the file from a Terminal window, by doing source setup.sh.
Got it .Thanks.