Submitted by Evan on
Setting up a working tool chain for ARM could be one of the single most annoying things that has graced the world of embedded development.
Although preconfigured tools exist for ARM, they tend to be quite pricey or beyond the scope of a hobby developer. This tutorial will show you how to
configure a working ARM toolchain using the Eclipse IDE and CodeSourcery's G++ Lite. Eclipse may not be a favorite of some people, but it does offer a lot of
flexibility. My friend has a saying, "Elipse is the second worse IDE ever made, but everything else is tied for first." Lets get started.
Gathering the Packages
First your going to need to download a few things. Your going to need...

You should have downloaded the recommended package from CodeSourcery, which is the IA32 Windows Installer. Make sure you get the EABI version.
Installing CodeSourcery G++ Lite EABI

Go ahead and launch the installer.

The next few sections are pretty self explanatory. But I will go through it just in case. Click next.

Go ahead and and choose Custom for the installation set section. Click next.

Make sure that both the Sourcery Toolchain and the documentation are checked. Click next.

The default path is usually something like C:\Program Files(x86)\CodeSourcery\Sourcery G++ Lite. Unfortunately, that path doesn't play friendly in most cases.

Go ahead and change it to something simple, like C:\CodeSourcery. Then click next.

We are going to add G++ to the path for all users, just incase you want all your accounts to be able to use G++. Click next.

This part is up to you. I don't like having shortcuts everywhere. Click next.

Make sure everything looks right and when your ready click install.

Be paitent and wait for the installer to finish.

If you get this screen, everything installed correctly. If you don't want to the see the "Getting Started" guide go ahead and uncheck the box. Click next.

Click done. The G++ Lite toolchain is now installed. Next step is to setup up Eclipse.
Installing Eclipse IDE for C/C++

Unzip the Eclipse file.

Eclipse doesn't really have an installer, it should extract as just an folder called eclipse.

I went ahead and copied the folder to the root of my c drive. When ready double click the eclipse executable.

Choose where you would like to save your workspace for Eclipse. Click OK when done selecting the directory.

After Eclipse launches, you will want to click on the Workbench button on the right.

In the top right corner, make sure it has C/C++ Perspective selected. If you don't have that as an option, you have another version of Eclipse. In that case go the the Eclipse website and download Eclipse CDT. Now we have Eclipse up and running, but its not configured to build for ARM.
Installing GNU ARM Eclipse Plugin

Now its time to install the GNU ARM Eclipse Plugin. You don't need to download anything to do this. We are going to use Eclipse internal installion process. Click Help > Install New Software.

A window should pop up asking you want you want to work with.

Type in "http://gnuarmeclipse.sourceforge.net/updates" without the qoutes. Hit enter. Then check the two items that pop up. Then click next.

This just lets you know that Eclipse will install GNU ARM Development Support. Click next.

Accept the license agreement if you choose, then click next.

Eclipse will now download the package and install the plugin.

When the warning pops up, click OK.

When the installation is done, click restart. Now we have the ability to create Eclipse projects that use the ARM toolchain. After Eclipse restarts, we will create a project.
Creating a Project

To create a new project, click File > New > C Project.

For the project type we are going to want to select a ARM Cross Target Application > Empty Project. Then select the ARM Windows GCC (Sourcery G++ Lite) Toolchain. Then click finish.

So now we have a empty project.

Right-click the project folder. Then go to New > Source File.

I'm going to name my source hello.c.

This is very simple code, but because the ARM platform involves hardware, it will compile differently based on architecture and what libraries your working with.
#include <stdio.h>
int main(void) {
printf("Hello World !\n");
return 0;
}

To configure the toolchain for a specific architecture, go to Project > Properties.

Expand C/C++ Build. Click on Settings.

In the drop down you will find a bunch of different ARM architectures.

To build the project you can go to Project > Build or hit control-B. Most likely yours will not build correctly. Often a linker script is needed to tell the toolchain the specific memory addresses where flash and ram are. The script themselves are different for every family of chips.

Since I'm primarily working with chips from Luminary Micro (now owned by TI), I have place a sample linker script in my project which allows it to build fine. This should get you on the correct path for development, but do your research, read the documenation, and watch those semicolons. Good Luck!