Configuring Eclipse for ARM Cortex development

Posted by Petr Hapal on 3 December 2016 | 0 Comments

Tags: , , ,

The purpose of this blog entry is to show how to configure Eclipse IDE for C and C++ development for ARM Cortex microcontrollers using GCC. I will focus on configuration for STM32F0 platform since microcontrollers from ST are widely used. I also expect that you are using Windows. Configuration for linux is similar. So lets do it from scratch step by step.

Download Eclipse Mars IDE for C/C++ Development (Java is required). It's important to use Eclipse Mars since GNU ARM plugins work with it correctly (we will install them later). You can find it on in download section under packages. Eclipse IDE is distributed as zip archive. Simply unzip downloaded archive to any directory. I'm using c:\EclipseARM. You can try to run it by executing c:\EclipseARM\eclipse\eclipse.exe. Dashboard should appear, click workbench icon. You should see something like this:

Installing toolchain

Toolchain is a set of cross compilation tools and libraries that are needed for C / C++ development. It is possible to build toolchain from sources but it is much easier for us to use GNU ARM Embedded toolchain for Windows that can be downloaded from I'm using version 5-2016-q3-update. Download zip archive (here). Unzip the content of zip to some subfolder in c:\EclipseARM (I'm using c:\EclipseARM\tools\gcc-arm).

Note: It's always easier for further configuration to have all tools withing one directory.

ARM Build tools

We also need make for generating binaries. Make is a part of GNU ARM Eclipse Build Tools package that can be downloaded from sourceforge ( Tools/). Donwload win32 or win64 (depending on your architecture) and then run the installation wizard. Again change the destination directory to our Eclipse installation directory (I'm using c:\EclipseArm\tools\Build Tools\2.6-201507152002).


OpenOCD is free On-chip debugger. It supports plenty of debugging hardware and target devices. It can be downloaded from sourceforge ( Download zip archive and upack to c:\EclipseARM\tools directory.

Now we have all build tools that we need.

Eclipse configuration

Now we have to install GNU ARM C/C++ plugins. In main menu click Help -> Install new software. Installation dialog will appear. We have to add installation source by clicking Add button and filling to Location. Click OK. Then we are able to select it in "Work with" dropbox menu. After a while a list of plugins will appear. Select all and install them. Eclipse should restart after successful installation.

Now continue with toolchain configuration. Open preferences by cliking Window -> Preferences. Select C/C++ -> Build -> Global Tools Paths and fill paths to build tools and toolchain. Please note that I'm using paths relative to Eclipse home directory. It should look like this:

Now change directory for packs (will be installed later). Here relative path does not work and must be absolute:


Click Apply and OK. Now you should be able to compile "Hello world" project.

Target device support

Next step is installing target device support by installing packs. Packs cotains configurstion support for particular devices. They also support viewing peripheral registers in debug perspective. We have to switch to packs perspective. This perspective button is not visible by default - we will add it by clicking icon at upper right corner, select Packs perspective and click OK:

Now open Packs perspective. No packs are installed at the moment. We have to refresh the list of available packs by clicking refresh button. This will take some time (time for cofee break):

Now select packs (target device support) you want to install, right click and Install.

Your development IDE is now ready for use.

Note: Because we've installed all components into one directory your Eclipse IDE with toolchain is perfectly portable. But remember - the packs directory is not relative to Eclipse installation directory - when you move your IDE to another destination you also have to change packs directory in settings (when you would not do it then your packs would disappear).

Demo project for STM32F0

Lets show how to create and configure test project for debugging with OpenOCD. I have here Nucleo-F030R8 board with STM32F030R8 microcontroller. We start by creating demo project in Eclipse. In main menu click File -> New -> C project. In opened dialog fill the project name, path and select STM32F0xx C/C++ project. In toolchains select Cross ARM GCC, then click Next. In next dialog set Content to be Blinky (demo project). Finish project configuration wizard by selecting appropriate microcontroller.

Note: Installed packs for STM32F0 contains demo project including linker script. The linker script is one of the most important component of the project. It simply tells to linker how the microcontroller memory is organized and where to put all compiled project sections. When you create empty or simple hello world project the linker script is not present and you probably will not be able to flash / debug your application. Writing linker script is one of the most complicated (and the most boring) start point for newbies.

After finishing wizzard the project should open and you should be able to build it by clicking in main menu Project -> Build all.

Configuring OpenOCD for debug

Now we have to create a new debug configuration for our project. In main menu click Run -> Debug configurations... In opened dialog click GDB OpenOCD Debugging and then click New launch configuration button in left upper corner. New configuration will be created. Open Debugger tab and set Config options. In config options you have to specify target device or system. I use nucleo board (-f board/st_nucleo_f0.cfg). You can find supported configurations in OpenOCD directory (c:\EclipseARM\tools\openocd-0.9.0\tcl)

Everything is ready to debug now. Click Apply and Debug (I expect that nucleo board is connected to PC and drivers are installed). Firmware should be flashed and debug perspective should open.


Post your comment


No one has commented on this page yet.

RSS feed for comments on this page | RSS feed for all comments