Free Eclipse ARM GCC OpenOCD Toolchain for Windows – Part 3: Eclipse IDE

For this part of the tutorial, we will be adding the Eclipse IDE to our toolchain. For this project, I will be using GNU Make to build my source code. When using Makefiles, there isn’t much set up to do in the IDE since most of that effort is spent on the Makefile. The Eclipse IDE is a very powerful IDE. You won’t have to use it long to find that it isn’t perfect, but even with its imperfections, I feel that it is far better than any paid IDE that I’ve used. This is a credit to the developers who are always making great improvements to this very useful IDE.

Contents

  1. Part 1: Introduction
  2. Part 2: ARM GCC
  3. Part 3: Eclipse IDE
  4. Part 4: GDB / OpenOCD Debugger

Download Eclipse CDT

Follow the link below and download the latest version of Eclipse CDT for your version of Windows. I am using Eclipse CDT Kepler v8.2.1 for 32-bit windows.

http://www.eclipse.org/cdt/

Once the download completes, extract the zip file. The result should be a folder simply named eclipse. Move the eclipse folder to your ARMTC folder. The image below shows the current status of the folder tree that makes up my toolchain.

ToolChainDirectoryGCCandEclipse

Create a Project Folder

Now we need to set up a project folder. I like to keep my code in a separate folder on the C: drive named projects. In the C: drive, create a folder named Projects. Inside the Projects folder, create another folder named E407Blinker. This folder will be the workspace folder. Navigate to the OlimexODS examples folder used in the previous tutorial, and copy the entire STM32-E407_blink_FLASH folder in to the newly created E407Blinker workspace folder.

Run Eclipse

Navigate to the eclipse folder within your arm toolchain folder, and start eclipse by running the eclipse.exe file. You will then be prompted to designate a workspace. Select the E407Blinker folder as your workspace folder and click the Ok button.

Eclipse_IDE_Workspace_Selection

Import the Project

Now we will need to import our project files and set up our project within eclipse. Start by clicking File and Import as shown below.

Eclipse_IDE_File_Import

In the Import dialog, under the General tab, highlight Existing Projects into Workspace, and click Next.

Eclipse_IDE_Import_Existing_Projects

In the Import Projects dialog, click the Browse button and navigate to the STM32-E407_blink_FLASH folder. Eclipse should then detect the project information within the folder. The project can then be selected for import. Make sure that the project is selected, and push the Finish button.

Eclipse_IDE_Import_Projects

Now you should be able to see the project in the project explorer.

Eclipse_IDE_Project_in_Project_Explorer

Initially, I had an error saying that there was no gcc in the PATH. This is because eclipse is looking for a toolchain. To get rid of this, right click on the project name, and select properties. Expand the C/C++  Build section and click on the Tool Chain Editor. Click the Current toolchain dropdown menu, and select No ToolChain.

Eclipse_IDE_No_Tool_Chain

Add Include Paths for Indexer

Open the main.c file from the project explorer by double clicking it. Also, open the problems window. If it is not already open, open it by clicking the window tab, then show view, and Problems. The indexer should automatically populate the problems window with all of the references that it couldn’t find. This is because it doesn’t know where all of the include files are.

Eclipse_IDE_Err_1_Open_Main

To add the include paths, right click on the project in the project explorer, and click on properties. Expand the C/C++ General category. Click on Paths and Symbols. You should see something similar to what is shown below. To add the include paths, start by clicking the Add button.

Eclipse_IDE_Err_2_Pths_Sym

Add checks next to Add to all configurations and Add to all languages. Click the Variables button.

Eclipse_IDE_Err_3_Add

Click the ProjDirPath variable. This will prepend the include path with a path to your project directory. Click the OK button.

Eclipse_IDE_Err_4_Variables

You can then see the path variable automatically added to the Directory text box. Add the lib and inc folders to the path as shown below. Click ok when you are done.

Eclipse_IDE_Err_5_Lib_Inc

Follow the same procedure two more times leaving off the inc and then the lib folders. You should see something similar to the image below. When you are done, click OK.

Eclipse_IDE_Err_6_Add_More

Eclipse will then prompt you to rebuild the index. This gives the indexer the opportunity to parse your source code with the include paths that you have just added.

Eclipse_IDE_Err_7_Rebuild_Index

As you continue coding on your project, you will notice that you have to manually tell the indexer to parse your code. To do this, right click on the project in the project explorer, click Index and then Freshen All Files.

Eclipse_IDE_Freshen_Index

Clean and Build

To clean the project, right click on the project name, and select Clean Project.

Eclipse_IDE_RightClick_Clean

You can see in the output it is trying to delete a file that ends in .dmp and .lss that are not there. This is creating an error.

Eclipse_IDE_Clean_Output

To get rid of this error, we need to delete these from the Makefile. Expand the project in the Project Explorer and double click the Makefile to open it in the editor. It would be a good idea to read over this file, and become familiar with this Makefile so that you have a better idea of the build process for this project. Scroll to the very last line in the Makefile. The previous line should be the clean label. When the make clean command is entered, this line ex executed. You can see the .lss and .bss parts that need to be deleted. Delete the $(BIN)/*.dmp and $(BIN)/*.lss entries from the line. To see the results of this, you will need to compile to generate the files again, then execute the clean command again.

Finally to build the project, right click on the project in the Project Explorer, and click Build Project.

Eclipse_IDE_RightClick_Build

If you click the file below, the image should open, and you should be able see the output from the build process.

Eclipse_IDE_Build_Output

More Errors to Clean Up

At this point, if I look at my problems window, I now have almost 6 thousand errors. When I look at the first one, I can see that it doesn’t even recognize the standard integer definition. Also, if you look at the source code file that is open in the image below, you can see that Eclipse’s indexer cant find the stdint.h file. This is because we haven’t told the indexer where to find the c library.

Eclipse_IDE_Prob_1_UnresSym

Once again, go to the project properties window, by right clicking on the project and selecting properties. While we are in here, start by going to the C/C++ General tab, then under the Code Analysis tab, click on the Launching category. Here, ensure that check boxes are added before both Run with build and Run as you type. This will ensure that you will be warned of errors as soon as possible.

Eclipse_IDE_Prob_2_Launching

No go back and click on the Code Analysis category. Here you can select what types of errors, warnings, and info that the indexer will warn you of. At one point, I was all excited, because I thought I had eliminated all of my errors when really I had just removed the check next to Syntax and Semantic Errors. As I got to looking at these, I decided that it would be nice to be warned of these, so now I leave it checked.

Eclipse_IDE_Prob_3_CodeAnalysis

Finally to allow the indexer to see our C library, we have to tell it where to find it. Click on the Paths and Symbols category. Under the Includes tab, add a path to the C library in your ARMGCC folder. This is done the same way as we did above for the project include paths. Start by clicking the Add button, then make sure that the Add to all configurations and the Add to all languages boxes are checked. For the path, we will once again be using relative paths. Relative paths can save so much headache later when trying to share or modify your project later. Start by adding the eclipse_home variable. Next, add a backslash and two periods. This will move you to your toolchain directory. From there, start with another backslash, and enter the path to your ARM GCC include directory. The path that i ended up with is shown below.

${eclipse_home}\..\ARMGCC\arm-none-eabi\include

When you are done, click Ok on both windows.

Eclipse_IDE_Prob_4_Paths

Now that the indexer should know of the C library, do another clean and build. Here I was still left with a few errors. These errors were from unresolved types in the arm_common_tables.h file. I did a search for these, and found that nothing was using these, so I decided to just delete the file at this point.

Eclipse_IDE_Prob_5_round2fight

Once the file was deleted, I compiled again, and this time had no problems listed.

Eclipse_IDE_Prob_6_AllGone

Now you should have  a functioning IDE. Once you get it all set up, Eclipse can be a very powerful IDE.

Contents

  1. Part 1: Introduction
  2. Part 2: ARM GCC
  3. Part 3: Eclipse IDE
  4. Part 4: GDB / OpenOCD Debugger

2 thoughts on “Free Eclipse ARM GCC OpenOCD Toolchain for Windows – Part 3: Eclipse IDE

  1. Hi,

    First, thanks for your step by step tutorial.

    By following it I have a problem when I want to the project and i have this in the eclipse console:

    make all
    “.compiling”
    arm-none-eabi-gcc -Wall -fno-common -c -g -mcpu=cortex-m3 -mthumb -g -O0 -I./ -I./lib/ -I./lib/inc/ -I./lib/inc/../../ -DTRACE_LEVEL=4 -o obj/main.o main.c
    arm-none-eabi-gcc: error: CreateProcess: No such file or directory
    make: *** [obj/main.o] Error 1

    If I execute make all in the directory file in a command shell it works fine.
    So I don’t understand why with eclipse it doesn’t.

    Do you have an advice for me ?

    Thanks !

    1. This is a stab in the dark, but it sounds like Eclipse may be trying to build from the wrong directory. What is defined in the Build directory text box in the Build location group in the C/C++ Build tab of the project properties dialog?

Leave a Reply

Your email address will not be published. Required fields are marked *