3. Hello world 3: Sourcery with Eclipse at Win7
17 May 2012
(Part 2) Pre< Return to: Embedded Code Generation Home Next> (Part 4)
I found a good tutorial Developing in C/C++ with Eclipse on Windows by Andrea Leganza at http://foxg20old.acmesystems.it/doku.php?id=tutorial:eclipse. It is for FoxG20, but the principles apply to Beaglebaord.
1. Installing Eclipse with CDT (C/C++ Development Tooling)
Download Eclipse IDE for C/C++ Devcelopers for Windows from the Eclipse website:
Eclipse IDE for C/C++ Developers
Simply uncompress the file directly in the working directory (i.e. c:\eclipse) then to launch Eclipse by executing eclipse.exe. It is installation-free. I am using the Indigo Service Release 2 version.
2. Install the GNU ARM Eclipse Plug-in
The GNU ARM Eclipse Plug-in is an Eclipse CDT Manged Build Extension for GNU ARM Toolchains like CodeSourcery G++ Lite, GNUARM, WinARM, agarto, and supports the development of managed C/C++ applications for the ARM series of processors. The GNU ARM plug-in can be found at http://gnuarmeclipse.livius.net/blog/
Select Help > Install New Software, then copy this URL http://gnuarmeclipse.sourceforge.net/updates in the Work with field then type enter. If this link does not work, try the new URL
http://sourceforge.net/projects/gnuarmeclipse/files/Eclipse/updates/
This possibly is due to the update site has been migrated to the File Release System.
Expand the CDT GNU Cross Development Tools and select the GNU ARM C/C++ Development Support item and press the Next button.
3. Check the location of CodeSourdery Toolchain
It would be good to write down the path of the following files:
Note: we are using linux-gnueabi version, not the EABI version.
File > New > C Project to create a new C project. Type in a project name (e.g. helloworld). At the left panel, select 'Project Type' to 'Empty Project' under the 'ARM Cross Target Application'. At the right panel, select the toolchains to ARM Windows GCC (Sourcery G++ Lite) and click 'Finish'.
Create a new file, i.e., main.c and write a Hellow World! Example.
Select the project, right click and select
'Properties'. Set the parameters of C/C++ build as follows:
(1) In the "C/C++ Build" -> "Setting"->Tab "Tool Settings"-> Target processor : cortex-a8
and select 'Thumb (-mthumb)'
(2) Debugging: Debug fromat -> Toolchain Default
(3) Additional Tools:
(4) ARM Sourcery Windows GCC Assembler: arm-none-linux-gnueabi-gcc
(5) ARM Sourcery Windows GCC C Compiler: arm-none-linux-gnueabi-gcc
In some cases, you may need additional two paths:
Invalid project path: Duplicate path entries found
(/BeagleCOM [Include path] isSystemInclude:true includePath:
C:/CodeSourcery/arm-none-linux-gnueabi/libc/usr/include), path: [/BeagleCOM].
C:\CodeSourcery\lib\gcc\arm-none-linux-gnueabi\4.6.1\include-fixed
C:\CodeSourcery\arm-none-linux-gnueabi\include
Alternatively, the include path can be set at Project->Properties->C/C++ General -> Paths and Symbols.
The bold paths are user-defined paths. Below the bold paths are 'Built-in' paths.
Ticking the box 'Show built-in values' to show the built-in paths.
It can be seen that the paths we added have be in the 'Built-in' values,
but the path separator slash (/) is in Linux style, while MS Windows uses \.
After adding these DOS/Windows paths, you may get Warnings of duplicated paths when you build the project. Something like:
That is OK.
(6) ARM Sourcery Windows GCC C Linker: arm-none-linux-gnueabi-gcc
(7) ARM Sourcery Windows GNU Create Listing: arm-none-linux-gnueabi-objdump
(8) ARM Sourcery Windows GNU Print Size: arm-none-linux-gnueabi-size
arm-none-linux-gnueabi-size reports the size of the executable file.
6. Build the project to get the Beagleboard-executable file
Right click the project name, select 'Build Project'. Or use hot key Ctrl+B to build the project. The output file *.elf is located at ./debug with the name <projectname>.elf. See the configuration at 'C/C++ Build' > 'Settings' > 'Build Artifact' tab
When the build procedure completes successfully, you will see the output information at Eclipse's Console window
Created
with Microsoft OneNote 2010
One place for all your notes and
information