GCC Toolchain Eclipse Setup Guide Part 1 — Eclipse and GCC

A PDF version of this guide, including project setup and debugging is available in the Documentation section.

This guide is targeted at Windows users, similar instructions for Linux can be found here.

Nowadays there is a multitude of free and commercial IDEs and Toolchain for embedded development. In addition, most MCU manufacturers offer a complimentary development environment for their products. From time to time and for various reasons, it can be desirable to integrate a GCC toolchain into a vanilla installation of Eclipse. This new series of guides will look into just that. Starting with the toolchain and Eclipse installation and configuration Windows to get a fully working C/C++ embedded software development environment. Future articles will deal with project creation and debugging.

This guide will attempt to make abstraction of the specific target as long as a GCC is used the instructions should be similar.

Setup Guide

This step-by-step section will go through the installation and configuration of the following components in order:

  • MSYS2 – 20180531 – msys2-x86_64-20180531.exe
  • Eclipse – 2019.03 – eclipse-inst-win64.exe
  • GCC – 8-2018q4 – gcc-arm-none-eabi-8-2018-q4-major-win32.zip

The versions cited above are those that were used when writing this guide. Installation instructions for newer versions, if available, should be similar.

MSYS2 Installation

On Windows a basic UNIX environment is required to run the toolchain and more importantly supply the GNU Make utility. There are multiple options include the well-known Cygwin. This guide will use MSYS2 since it offers superior build performance and good compatibility with native Windows paths. If compatible with the host system, the 64-bit version of MSYS2 is recommended, which is labelled x86_64.

The installation can be started by executing the executable installation file, in this example msys2-x86_64-20180531.exe, the following screen should appear:

MSYS 2 installer welcome screen.
MSYS2 installation welcome prompt

Click Next.

MSYS2 installation folder configuration screen with textbox and a browse button to select a directory.
MSYS2 installation directory prompt

Enter the desired installation directory, the installation directory should be short with no spaces in the path. This guide will assume that the default installation directory of C:/msys64 is used. Click Next.

MSYS2 windows start menu shortcut selection dialog.
MSYS2 installation start menu shortcut prompt

The installer will now prompt for the name of the start menu shortcut. It is recommended to use the default name. Click Next.

Installation progress screen with progress bar with button to show additional details about the files being installed.
MSYS2 installation progress screen

Installation should begin.

Installation completed screen with an optional checkbox to start MSYS2 after exiting the installation wizard.
MSYS2 installation finished screen

The installation should finish successfully. Make sure that “Run MSYS2 64bit now.” is checked.

MSYS terminal with command prompt.
MSYS2 console

The MSYS2 console should open. It is now necessary to perform an update of the MSYS package manager by typing:

pacman -Syu

And press enter.

Output of the pacman command with text prompt asking the user to proceed with the installation.
MSYS2 package manager update prompt

After downloading the update information, a prompt will appear to ask for permission to proceed with the installation. Type Y and press enter to continue.

Download and installation will proceed, this can take several minutes depending on network connection and computer performance.

Output of the package update procedure with a warning message that the MSYS2 terminal window should be closed and the update process restarted.
MSYS2 package update restart request

It is likely that a warning message is displayed at this point asking to return to the shell and restart the update process. When this occurs exit the MSYS2 console by pressing the X button on the top right corner of the window. It is important to quit the console that way otherwise the warning may reappear
in the next invocation.

A warning message will be displayed, press OK to proceed with the close.

Pop-up modal dialog to inform the user that a session is running asking for confirmation before closing the terminal.
MSYS2 window close confirmation

Open the MSYS2 console again by navigating to the start menu item for MSYS2 and clicking MSYS2 MSYS.

Windows start menu with the MSYS2 shortcut highlighted.
MSYS2 start menu entry

Once opened type:

pacman -Su

And press enter to continue the update process.

Package update terminal output asking the user before proceeding with the installation.
MSYS2 package manager update prompt

A prompt asking for permission to continue will appear again. Type Y and press enter to continue.

Download and installation will proceed, like the previous step this can take several minutes depending on network and computer performance.

Terminal output of the finished update process.
MSYS2 package manager update done

Installation should complete without any error or warning messages.

With the package manager updated and synced it is time to install the basic development utilities. This can be achieved by typing:

pacman -S base-devel

A list of packages to be installed will appear.

pacman package selection prompt asking the user to select the package to install with a default value of "all".
MSYS2 base-devel installation confirmation prompt

Press Enter to continue.

Package installation prompt asking the user to proceed with the installation.
MSYS2 base-devel installation confirmation prompt

Type Y and then Enter to continue.

Download and installation will proceed, this can take several minutes depending on network and computer performance.

The installation should complete without any error or warning messages.

Terminal output of the completed package installation process.
MSYS2 base-devel installation completed

To test that the installation is functional, let’s run a simple test by invoking the make utility as such:

make -v

The make utility should output its version information in the console.

Terminal output showing the version information of the make command.
MSYS2 make test output

MSYS2 and the required utilities are now installed, the console window can be closed.

Eclipse Installation

The next package to install is the Eclipse IDE. Start by executing the installer file. Note that if possible the 64-bit version of Eclipse is strongly recommended. In this example eclipse-inst-win64.exe, the following screen should appear.

Eclipse installation welcome screen. The screen displays the various Eclipse edition available for installation. The "Eclipse IDE for C/C++ Developers" selection is highlighted.
Eclipse install screen

Select “Eclipse IDE for C/C++ Developers” by clicking it. The install configuration screen should appear.

Eclipse path and JVM selection dialog with buttons to select the installation directory and to select which JRE or JDK should be used by the Eclipse Installation. Additional buttons are available to create a start menu or a desktop shortcut.
Eclipse installation configuration dialog

The Product Version should be set to latest unless a specific version of Eclipse is desired. Right next to the version is the selection for 32 or 64-bit. 64 Bit is strongly recommended if it is supported by the host computer. Next is the Java virtual machine selection. If a suitable JVM is found, it will usually be selected. Note that the JVM must match with the 32 or 64-bit selection. For the installation directory, it is recommended to use a unique directory that is short with no spaces in the name as the eclipse install directory. In this example we will use “C:/eclipse_gcc” as the install directory. The eclipse installer will automatically create an eclipse subdirectory inside the specified installation path. Finally, it is possible to create a start menu entry and/or a desktop shortcut if desired.

Click install to continue.

Eclipse IDE licence agreement dialog showing on the left pane the various software licences and on the right the selected licence's text. On the bottom a set of buttons are available to accept or decline the licences.
Eclipse installation licence dialog

The licence confirmation prompt should appear. Click “Accept” to continue.

Installation progressing with progress bar and button to cancel the installation process.
Eclipse installation progress dialog

The installation should progress. This may take some time depending on network performance.

Security certificates dialog asking the user to accept the certificates used to authenticate the downloaded files.
Eclipse certificate trust prompt

The installer will likely prompt to trust of the remote server certificate where the Eclipse files will be downloaded. Check the checkbox next to the certificate name and click accept selected.

Installation should proceed.

Installation completed screen with buttons to launch the installation, show the readme file or open the installation directory.
Eclipse installation complete and launch prompt

Launch the installation to check if it’s working properly and create the first workspace. Do so by clicking Launch.

The workspace selection prompt should appear.

Eclipse workspace selection dialog with text box and browse button to select the workspace path. A checkbox at the bottom is available to set the selected workspace as the default.
Eclipse workspace selection prompt

It is strongly recommended to create a unique workspace that will be used exclusively for the projects related to the GCC toolchain that will be installed in this guide. The workspace selected should not have a path name that is excessively long and it is recommended not to use spaces in the path name either. To keep everything well contained and ordered this example will use “C:/eclipse_gcc/eclipse_workspace” as the workspace.

Click Launch.

The Eclipse welcome screen should appear.

Eclipse welcome screen that shows a selection of documentation and tutorials available.
Eclipse welcome screen

Eclipse can be closed at this point as there are more packages to install before setting up the Eclipse IDE.

Toolchain Installation

This guide will use as an example the GNU Embedded Toolchain for Cortex-R and M distributed by ARM. However the procedure should be very similar to other embedded GCC toolchains. On Windows, if given a choice a simple ZIP or tarball archive is easier than an executable installer, this guide will use the former as an example.

To install the toolchain it should simply be extracted to a suitable directory. As usual the full directory path should be short with no spaces. This example will use “C:/eclipse_gcc/gcc”.

The installation can be tested by opening a windows command prompt, changing the directory to the bin subdirectory of GCC installation directory and running the gcc executable. The full name of the GCC executable will be prefixed by the target triplet. For example “arm-none-eabi-gcc.exe”

After finding the name of the GCC executable, it can be executed as follows:

arm-none-eabi-gcc.exe -v

GCC should output various version and build information to the command prompt.

Terminal output within PowerShell of the GCC version information used for testing the GCC installation.
GCC version information

Environment Variable Setup

For the toolchain to be easily accessible by Eclipse, Make and other utilities it is preferable to have the toolchain binary location in the PATH environment variable.

Start by opening the Windows Control Panel.

Windows 10 control panel using small icons with the System icon highlighted.
Windows Control Panel

Click “System”.

Windows 10 System configuration panel with "Advanced system setting" menu item on the left pane highlighted.
Windows Advanced System Settings

Click “Advanced System Settings”.

Windows advanced system properties.
Windows Advanced System Settings

Click “Environment Variables”.

Windows environment variables configuration panel with "New" button highlighted.
Windows environment variable configuration panel

In this screen, if an existing PATH environment variable exists, click it and then click “Edit…” otherwise click “New…”

New user environment variable dialog. With text boxes to set the name and value of the new variable.
Windows new environment variable dialog

Two paths should be added either to the existing PATH variable or the new one. The “usr/bin” subdirectory of the MSYS2 installation and the bin subdirectory of the GCC installation. For the install directories chosen for this example, this results in the following two paths:


Then click OK.

Environment variable control panel with new PATH variable set and highlighted.
Configured environment variables

Then OK again to exit the Environment Variables window.

That is it for part 1. At this point, all the tools needed for embedded software development should be installed and configured. Check the next articles in this series for project and debugging setup. If you can’t wait consult the PDF version of this guide.

Click here for part 2 of this series.

Visit the Documentation section for a PDF version of this guide including project and debugging setup.

See all articles