Configuring Eclipse with GCC toolchain for ARM Cortex-M based Microcontrollers

Keywords: Embedded systems, Eclipse, Toolchain, GNU, make, GCC, ARM Cortex-M

In this tutorial we will demonstrate how to configure Opensource tools i.e. eclipse, GCC, and OpenOCD to compile and download code to ARM Cortex-M family of processors. Before we can move forward, here is a million dollars question? Why would somebody go through all these multip step procedure to configure an Opensource IDE for writing and compiling code for ARM MCU when there are bunch of free (or at least free with certain limits) IDEs out there?

Well the answer is simple… Portability. Most of the vendors supplied toolchains/Compilers available in market are configured and tightly coupled with an IDE that only run on specific Operating System. Well to be really honest, most of them are available for Windows only and porting support to other Operating Systems may or may not be provided by the vendors especially in case of Free/Evaluation versions and may charge extra money from client.

In such scenarios where you are not comfortable with OS that the MCU toolchain/IDE supports, you can either need to get use to the target OS or you may need to purchase a paid version of the Toolchain for the OS you are comfortable with OR you may follow this tutorial approach to configure your own MCU coding environment with absolutely 0 cost.

Note: As tools used for this tutorial are free of charge they do come with a cost… You may not get full support if you are stuck somewhere. Though these tools community is quite mature still the expectations may be kept lower. Second, paid IDEs comes with hell lot of other features other than just compiling the code, downloading, debugging etc. The free tools do come with limited support and features.

TIP: If you are planning to proceed with a long term project where your team may need long term support, it is highly recommended to go for a paid version of professional toolchains. They usually go that extra mile of adding extra features and provide long term support. This can save your team time to focus on project only rather than maintain the toolchain as well.

I think that was enough introduction, let’s get back to the tutorial. Following are the Opensource tools used in this tutorial.

  1. Eclipse with plug-ins: For providing front end to facilitate coding and debugging.
  2. GNU ARM Toolchain: The GNU C/C++ compiler/debugger binaries compiled for ARM Cores.
  3. OpenOCD: The middle wear that provide link between the eclipse front end, debugger and the physical MCU onchip debugger for downloading and debugging the code.

Let’s get started. First of all let’s create a separate directory for development. For this tutorial we will use E:\Development (Windows OS) and will be simply refered Development as directory.

1. Installing GNU Toolchain for ARM

In the previous tutorial we cross-complied GNU GCC Toolchain for ARM Cortex-M based processor. Though it was tedious job yet it indeed was a fun. Don’t worry this tutorial is not dependent on that cross-compiling tutorial. We mentioned in the previous tutorial that the better option is to grab the pre-compiled GNU GCC binaries from one of the given vendors as they are doing great job of keeping the toolchain maintained and up to date. For this tutorial we will use the GNU GCC binaries for bare-metal programming provided by the ARM developers. The Link is given bellow.

The above link contains links to GNU binaries for various OS. Choose one for your target OS. For this tutorial we are using windows OS so we will download binaries for Windows OS. The toolchain are named similar to gcc-arm-none-eabi-7-2018-q2-update-win32-sha1.exe.

To install the toolchain simply double click the downloaded gcc-arm-none-eabi-7-2018-q2-update-win32-sha1.exe binaries and follow the instructions. The installation is straight forward. We will install toolchain in E:\Development\GNU Tools Arm Embedded – Figure-1.

Figure-1: GNU ARM Installation – Choosing Installation directory

Wait for the installation to complete – Figure-2.

Figure-2: GNU ARM Installation Progress

Click Finish to complete installation – Figure-3. Congratulation you have successfully installed GCC ARM toolchain.

Figure-3: GNU ARM Installation Complete

To verify installation, run the following command in the installation directory and the screen should look similar to – Figure-4.

gcc-none-eabi-gcc -v

Figure-4: GNU ARM toolchain Installation Verification

2. OpenOCD Installation

In the previous step we installed and verified the GNU ARM toolchain which will be used to compile our C code for ARM Cortex-M Processors. The Toolchain can build the binaries for the target SoC but we also need some mechanism to download/program/burn flash these binaries to the target SoC. OpenOCD is an open-source middle-ware that provide interface between the target SoC (via JTAG, SWD, ICDI, etc. etc.) and the Host PC. OpenOCD is used to burn the target SoC flash and debug it on run-time. We have a dedicated tutorial for OpenOCD which explains OpenOCD in more detail. For now its enough to remember that it is used for programming and debugging purpose. Let’s install OpenOCD.

The OpenOCD Installation is straight forward. Being open-source, the source can be grabbed from Github and compiled as required but we will not go into that complicated process. There are pre-compiled distribution provided for various OS that can be downloaded and used straight from the box. The link to pre-compiled binaries are given bellow.

Download the binaries as per your OS. For Windows-64bit (the OS i am on) we will download To install it, simply unzip the binaries in the Development directory in our case its E:\Development.

The target bin directory will look similar to the Figure-5.

Figure-5: OpenOCD binaries

Configuration, you have successfully installed OpenOCD. We will refer to it back after installing eclipse and other plug-ins.

3. Windows build tools Installation (Only for Windows OS Users)

This step is only for window users. The reason behind this tool is that the eclipse plug-ins we will install later uses few UNIX commands e.g. rm, mkdir, sh, etc. during build process. These commands are not a part of Windows OS. The Windows build tools provides emulated versions of these UNIX commands on Windows.

To install Windows build tools, download the latest verion from the following link. In our case (Windows-64bit), we will download

Once the download, extract it in the Development directory in our case its E:\Development – Figure-6.

Figure-6: Windows build tools

4. Eclipse and plug-ins Installation

Eclipse is an open-source cross platform very flexible IDE available/easily configurable for various languages including Java, C/C++, Python, PHP etc. etc. and is widely used for development. In this tutorial we will configure it for cross-compiling code for ARM Cortex-M Processors.

Eclipse itself is just an Integrated Development Environment (IDE). In order to configure it for specific language and extend its features, plug-ins are used. These plug-ins are mostly developed by Eclipse community members and can be accessed from Eclipse Marketplace in Help menu.

Eclipse comes in different flavors/versions named very beautifully by Eclipse developers e.g. Kepler, Luna, Mars, Neon, Oxygen, Photon. For this tutorial we will use Oxygen but Neon can be used instead.

Why Oxygen or Neon only?

These Eclipse versions are chosen because the plug-ins we are going to install for Cortex-M development are well tested with Oxygen and Neon ONLY. With other versions, the plug-ins may not work correctly as per plug-ins documentation.

Following are the steps to download, install, and configure eclipse.

4.1. The first step is to download Eclipse IDE. As mentioned earlier, eclipse comes in various flavors pre-configured for various languages. For this tutorial we will chose “Oxygen – Eclipse IDE for C/C++ Developers” for Windows 64-bits version – Figure-7.

The Download links are given bellow. The first one is from Eclipse official website while the second one is Github link provided by GNU ARM plug-ins (that we will install later) developer. The second link is more preferable as other Eclipse compatible versions with plug-ins apart from Oxygen are also given.

Figure-7: Eclipse Oxygen Download Link

4.2. A compressed zip file will be downloaded, the simple way to install it is just to extract it in the Development directory. In our case its E:\Development.

Note: Eclipse requires Oracle Java Runtime Environment. If it is not installed on your computer; you may download it from the Oracle link given bellow. Make sure you choose the right version for your OS and System (32bits, 64bits).

4.3. Create a new directory named Workspace in Development directory in our case its E:\Development.

4.4. Go to the eclipse installation direction (E:\Development\eclipse) and open double click eclipse.exe to start eclipse. After a very nice splash-screen a prompt window will open asking for Workspace. In the Workspace field enter the path of Workspace folder created in step-4.3 and check the checkbox – Figure-8.

Figure-8: Eclipse Workspace Configuration

Once Workspace is configured, Eclipse IDE main Welcome window will open.

5. Eclipse Plug-ins Installation

Now that you have successfully installed eclipse, its time to configure it for ARM Cortex-M firmware development via special plug-ins. Plug-ins are required as eclipse itself is an open-source general purpose IDE whose functionalities can be extended for specific development via plug-ins provided by eclipse developers or some third party developers. Let’s get started.

5.1. From menu bar click on Help --> Install New Software Figure-9.

Figure-9: Eclipse Marketplace

5.2. Click Add. In the Name field enter GNU MCU Eclipse Plug-ins, in the Location field enter Click Ok – Figure-10.

Figure-10: GNU MCU Eclipse Plug-ins Install

5.3. Wait a while for the eclipse to grab the plug-in contents. Once the contents are grabbed, check the check-boxes for the following plug-ins in the list. Click Next.

  • GNU MCU C/C++ ARM Cross Compiler
  • GNU MCU C/C++ Freescale Project Templates
  • GNU MCU C/C++ Generic Cortex-M Project Template
  • GNU MCU C/C++ J-Link Debugging
  • GNU MCU C/C++ OpenOCD Debugging
  • GNU MCU C/C++ Packs (Experimental)
  • GNU MCU C/C++ STM32Fx Project Templates
Figure-11: GNU MCU Eclipse Plug-ins

Click Next, accept License agreement and click Finish.

Figure-12: GNU MCU Eclipse Plug-ins License agreement

Wait for the installation to complete and on completion restart Eclipse.

Note: If you get a warning during installation like the one shown in Figure-13, just ignore it and click Install Anyway! Eclipse usually shows this warning when the plug-ins are provided by third party.

Figure-13: Eclipse Plug-ins installation warning

6. The Final Touch

So far we have successfully installed everything we need. The final step is to configure them. This is relatively the simplest step.

Clink on Windows → Preferences → MCU → Global ARM Toolchains Paths – Figure-14. Enter the path of bin folder inside GNU ARM Toolchain installation directory that we installed in Step-1. In our case the path is E:\Development\GNU Tools Arm Embedded\bin.

Figure-14: Eclipse – Toolchain Path

Now click on Global Build Tools Path and enter the path of bin directory inside the Windows build tools we installed in step-3 – Figure-15. This step is for Windows Users only.

Figure-15: Eclipse – Windows Build Tools Path

An Finally last but not the least Click on GNU OpenOCD Path and enter the path of bin directory inside the openOCD installation directory that we installed in Step-2 – Figure-16.

Figure-16: Eclipse – OpenOCD Path

Configuration we have successfully configured Eclipse, GCC, and OpenOCD for programming ARM Cortex-M Microcontrollers. In the next step we will demonstrate how to create project for ARM Cortex-M based Microcontrollers.

Note: There are few Debug configuration steps which are both Project and SoC dependent. These are covered in the next tutorial.


[1] – Mastering Embedded Linux Programming by Chris Simmonds

[2] – LLVM Project

[2] – GCC ARM Options

23 thoughts on “Configuring Eclipse with GCC toolchain for ARM Cortex-M based Microcontrollers”

Leave a Reply

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