Developing in C/C++ with Eclipse on Windows

This article illustrates how to use Eclipse to cross compiling your C/C++ code on a Windows PC.

Written by Andrea Leganza & Sergio Tanzilli

Eclipse IDE

Eclipse is a multi-language software development environment comprising an IDE and a plug-in system to extend it. It is written primarily in Java and can be used to develop applications in Java and, by means of the various plug-ins, in other languages as well, including C, C++, Python, Perl, PHP, and others (read more...).

Installing Eclipse

Download Eclipse IDE for C/C++ Developers for Windows from the Eclipse website:

Uncompress the file directly in the working directory (i.e. c:\eclipse) then to execute it just launch eclipse.exe. No installation procedure is required.

Eclipse IDE

Install the ARM plugins

To made easy the cross compilation procedure install the plugin called GNU ARM Eclipse Plug-in.

To do that open the menu Help –> Install New Software… then copy this URL http://gnuarmeclipse.sourceforge.net/updates in the Work with field then type enter.

Uncheck the “Group items by category” to display the ARM plugins available.

GNU ARM C/C++ Development Support plugin

Check the GNU ARM C/C++ Development Support item and press the Next button.

Install CodeSoucery G++ ARM lite toolchain

Sourcery G++ ARM lite is a complete C/C++ development environment based on the GNU Toolchain which is freely available and has a quick installer that manages also the path variables to simplify the calls to the executable everywhere inside your computer

Got o this link http://www.codesourcery.com/sgpp/lite/arm/portal/release1039 and download the IA32 Windows Installer (direct link).

Run the executable file to install the toolchain.

When appears the message box Chose Install Folder provide a simple path like c:\codesourcery. Avoid to use the default one (on my Windows 7 PC the default value is C:\Program Files (x86)\CodeSourcery\Sourcery G++ Lite) because probably Eclipse can't manage it.

CodeSourcery toolchain installation

The last step to do is to rename the binary files located in c:\codesourcery\bin from arm-none-linux-gnueabi… to arm-none-eabi…) used by default by the Eclipse ARM plugin.

Change:

  • arm-none-linux-gnueabi-gcc.exe → arm-none-eabi-gcc.exe
  • arm-none-linux-gnueabi-gdb.exe → arm-none-eabi-gdb.exe
  • arm-none-linux-gnueabi-ld.exe → arm-none-eabi-ld.exe
  • arm-none-linux-gnueabi-objcopy.exe → arm-none-eabi-objcopy.exe
  • arm-none-linux-gnueabi-objdump.exe → arm-none-eabi-objdump.exe
  • arm-none-linux-gnueabi-size.exe → arm-none-eabi-size.exe

Eclipse should be able now to call the xcross executables needed to deploy to the FOXG20 ARM processor.

Create your first project

Create a new C Project from the menu File→New→C Project.

Insert a project name, select the toolchains ARM Windows GCC (Sourcery G++ Lite) and press the Finish button.

Open new project using ARM toolchain

If the welcome screen is still open close it clicking on the X near the Welcome tab.

Create a new file, i.e. hello.c and fill with the classic Hello World ! example.

#include <stdio.h>
 
int main(void) {
  printf("Hello world !\n");
  return 0;
}

Now configure the builder and set where to find the correct libc libraries:

Open the menu Project > Properties

Click on C/C++ Build item and set:

  • Builder Type: External builder
  • Check Use default build command
  • Check Generate Makefiles Automatically

Now click on the small triangle near the C/C++ Build item to view the subitems then select Settings and set:

  • Target Processor → Processor : ARM926ej-s
  • Additional tools : Uncheck Create Flash Image
  • ARM Sourgery Windows GCC C Linker > General uncheck all the checkboxes

Go back on C/C++ General, select Paths and Symbols then the tab Includes. Under the Languages column select GNU C and add the following paths:

  • C:\codesourcery\lib\gcc\arm-none-linux-gnueabi\4.4.1\include
  • C:\codesourcery\arm-none-linux-gnueabi\libc\usr\include

Change codesourcery with the path you chose during the ARM toolchain installation.

DON'T mess around with “Current toolchain and Current Builder” (Default values are ARM winows GCC (Sourcery G++ Lite ) and ARM Sourcery Windows GNU Make builder) in C/C++ Build-|Toolchain Editor menu because there is a bug that corrupts the compilation scripts and i've not found any way to restore it without recreating a new project.

The executablename.elf file is the executable that you have to run to start your app: do a chmod +x on it and run ./executablename.elf

This article is still under constructor because missing the Remote System Management to copy and execute the binary file on FOXG20. Please be patience…. In the meanwhile you can copy the binary file using WinSCP and run in using Putty (read more...).

Install the remote support

Install now the plugins to develop remotely on FOX Board G20. These softwares allow to control remotely your FOX Board G20 and trasferring/deleting/moving files as a normal file manager does, they provide also the support for tftp, ssh and dstore; a console is also provided.

Using actions you can create simple/complex bash scripts to be run on one file or in a folder (see later in this paragraph).

Open the menu Help –> Install New Software…. In the Work with drop down list select the item –All Available Sites–.

In the type filter type field type remote, after a while, depending on your internet connection, you will receive a list of software available to install.

Under the category General Purpose Tools check these three items:

  • General Purpose Tools
    • Dynamic Languages Toolkit - Remote Development Support
    • Remote System Explorer End-User Runtime
    • Remote System Explorer User Actions

Click on Next to confirm, accept the licence terms then Finish and accept to restart Eclipse.

 
tutorial/eclipse.txt · Last modified: 2010/02/21 11:14 by tanzox
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki