Mistake on this page?
Report an issue in GitHub or email us

Eclipse

This document explains how to build and debug Arm Mbed OS applications using Eclipse. Before starting, please choose a compiler with which to build your project.

Installing Eclipse

You need to install Eclipse CDT with the GNU Arm Eclipse plugins to begin:

  1. Install Eclipse IDE for C/C++ Developers.
  2. Open Eclipse.
  3. Create a workspace directory. This will be separate from your code.
  4. Install the GNU Arm Eclipse plugin:
    1. Click the Help menu item and select Install New Software.

    2. In the Work with box, paste the install address, and press Enter: http://gnuarmeclipse.sourceforge.net/updates.

      If this does not work, please see the GNU ARM Eclipse solutions and workarounds page.

    3. The package GNU Arm C/C++ Cross Development Tools appears. Select it.

      Selecting the cross development tools

    4. Click Next repeatedly, and accept the license agreements.

    5. Click Finish. If prompted to restart Eclipse, click Yes.

Exporting a project

To export your project to Eclipse, you can use either the Arm Mbed Online Compiler or Arm Mbed CLI.

Online compiler

  1. Right click on your project.

  2. Select Export Program....

  3. Under Export toolchain, select Eclipse (GCC ARM).

    For most targets you can also export to ARMCC.

  4. Click Export.

  5. Unpack to a convenient location. Make a note of this location for the import step.

    Exporting to Eclipse

Arm Mbed CLI

In your project folder, run:

## Replace K64F with your target board
## If you're not using GCC ARM, use -i eclipse_armc5 for ARMCC, or -i eclipse_iar for IAR

$ mbed export -i eclipse_gcc_arm -m K64F --profile debug

Importing the project in Eclipse

  1. Open Eclipse.

  2. On the Welcome screen, select Import a project with a working Makefile.

  3. Select the folder to which you extracted your Mbed OS project.

  4. Under Toolchain for Indexer Settings, select <none>.

    Import project

  5. Click Finish.

  6. Dismiss the Welcome screen.

  7. Select Project > Build Project to build the project.

Once the project builds, you can configure the debugger. The configuration depends on the debug server you're using: pyOCD or OpenOCD.

If the build fails with an error:

  1. make[1]: arm-none-eabi-g++: No such file or directory, you need to configure Eclipse's PATH (not your OS PATH).
  2. Program "make" not found in PATH, install GNU-Make utility, version at least 4.0:
    • On Windows, you can find a compatible version of Make in Cygwin and MSYS2 distrubitions. Install the make package, and add either C:/cygwin64/bin or C:/msys64/usr/bin to Eclipse's PATH.
    • On macOS, you can install make as part of Xcode command-line tools.
    • On Linux, the distrubition package manager provides make.

Steps to update Eclipse's PATH:

  1. In Eclipse, click Project > Properties > C/C++ Build > Environment.

  2. Click Add.

  3. Under Name, enter PATH.

  4. Under Value, add the location of the GNU ARM Embedded Toolchain. To find it:

    • On Windows, from a CMD window, run where arm-none-eabi-g++.
    • On macOS and Linux, from a Terminal, run which arm-none-eabi-g++.

    Setting up PATH

pyOCD

  1. Select Run > Debug Configurations....

  2. If no configuration exists under GDB pyOCD Debugging, click on New launch configuration.

  3. In the Main tab:

    • Under C/C++ Application, select the .elf file (BUILD/projectname.elf).

    Main tab

  4. In the Debugger tab:

    • Under pyOCD Setup, set the Executable path to your copy of pyocd-gdbserver.
    • Under GDB Server Setup, set the Executable path to your copy of arm-none-eabi-gdb.
    • If you cannot see the GDB Server Setup section, the scrollbar might be hidden; switch tabs to make the scrollbar reappear.

    Debugger tab

  5. Click Apply.

  6. Click Debug to start debugging.

OpenOCD

  1. Select Run > Debug Configurations....

  2. If a configuration already exists under GDB pyOCD Debugging, please remove it.

  3. If no configuration exists under GDB OpenOCD Debugging, click on New launch configuration.

  4. In the Main tab:

    • Select the .elf file (BUILD/projectname.elf) under C/C++ Application.

    Main tab

  5. In the Debugger tab:

    • Under OpenOCD Setup, set the Executable path to your copy of openocd.
    • Under OpenOCD Setup, set the Config options to the setup options from the Configure your local debug toolchain guide.
    • Under GDB Client Setup, set the Executable path to your copy of arm-none-eabi-gdb.
    • If you cannot see the GDB Server Setup section, the scrollbar might be hidden; switch tabs to make the scrollbar reappear.

    Debugger tab

  6. Click Apply.

  7. Click Debug to start debugging.

    Debugging an Mbed OS application in Eclipse

Building with Mbed CLI

We build using Make, but you can also use Mbed CLI for building from Eclipse:

  1. Go to Project > Properties > C/C++ Build.
  2. Remove the check Use default build command.
  3. Set Build command to mbed.
  4. Under Behavior > Build (Incremental build), select your Mbed CLI build options. For example: compile -m K64F -t GCC_ARM --profile debug.
  5. Make sure to update the paths to the .elf file in your debug configuration.
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.