MultiTech's official mbed team.

Using Eclipse and mbed 5 for MTS Devices


This wiki page will provide instructions for setting up a development and debug environment for MultiTech mbed platforms using the Eclipse IDE and the mbed-cli tools. The same or similar steps can be followed to develop and debug for other platforms.

Setting Up

Mac & Linux Users

This wiki is written for Windows users, but Mac or Linux users should be able to follow the same steps using the appropriate package managers or downloads instead.

A number of applications need to be installed:

Create or Import a Project with mbed-cli

Full mbed-cli documentation can be found here.

Create or import a project

  • open Command Prompt
  • type "mbed import <project>" or "mbed new <project>"

Configure the toolchain location

  • set the GCC_ARM path in the mbed global configuration
  • cd in to the <project> directory
  • issue the command below
    • if there are spaces in the path, put double quotes around the entire path
    • the default Windows install path is "C:\Program Files (x86)\GNU Tools ARM Embedded\4.9 2015q3\bin"
mbed config --global GCC_ARM_PATH <path to GNU ARM Embedded Tools bin directory>

Configuring Eclipse

Install Eclipse Plugins

Import the Project into Eclipse

  • click "File->New->Makefile Project with Existing Code"
  • put the path to <project> in the "Existing Code Location" box
  • set "Toolchain for Indexer Settings" to "none"
  • check both the "C" and "C++" language boxes
  • click "Finish"

Configure the Project to Compile Using mbed-cli Tools

For the default build configuration:

  • click "Project->Properties"
  • select the "C/C++ Build" tab and the "Builder Settings" window
  • the "Configuration" dropdown box should say "Default" or "Default [ Active ]"
  • unselect the "Use default build command" box
  • in the "Build command" box paste "mbed compile -t GCC_ARM -m <platform>"
    • <platform> should be a valid mbed platform name
      • xDot -> XDOT_L151CC
      • mDot -> MTS_MDOT_F411RE
      • Dragonfly -> MTS_DRAGONFLY_F411RE
      • DotBox or EVB -> MTS_MDOT_F411RE
    • "-c" can be added to the custom build command to do a clean build each time
      • this will make the build take much longer and isn't usually necessary
  • select the "Behavior" window
  • select the "Build (Incremental Build)" check box and clear the contents of its text box
  • unselect the "Clean" box
  • click "Apply"

The debug build configuration should be the same as the default with the following changes:

  • click "Manage Configurations" next to the "Configuration" dropdown box
  • click "New"
  • type "Debug" in the "Name" box
  • choose to copy settings from your default configuration
  • click "OK" and "OK"
  • paste the string below in the "Build command" box
    • "c" and "profile" options inform mbed-cli that we want a clean build with debug symbols included
mbed compile -t GCC_ARM -m <platform> -c --profile mbed-os/tools/profiles/debug.json
  • click "Apply" and "OK"

At this point, both the default and debug configurations should trigger a build of the application for the selected platform.

Set Up Debugging in Eclipse

Create a Debug Configuration for the Project

  • click "Run->Debug Configurations..."
  • right click "GDB OpenOCD Debugging" and click "New"
  • verify that the correct project is selected in the "Project" box
  • put the full path to the .elf file in the "C/C++ Application" box
    • the path should be of the form "<path to project folder>\<project>\.build\<target>\GCC_ARM\<project>.elf
  • select the debug configuration from the "Build Configuration" dropdown box
  • select the "Enable auto build" radio button

OpenOCD Configuration

  • select the "Debugger" window and look at the "OpenOCD Setup" area
  • select the "Start OpenOCD locally" box
  • enter the full path to openocd.exe in the "Executable" box
  • set "GDB port" to 3333
  • set "Telnet port" to 4444
  • add the following lines to "Config options"
    • these files specify the target hardware and debug connection configuration
    • for the mDot, DotBox/EVB, and Dragonfly use the following:
      • "-f interface\stlink-v2.cfg"
      • "-f board\st_nucleo_f4.cfg"
    • for the xDot, use the following:
      • "-f interface\cmsis-dap.cfg"
      • "-f target\stm32l1.cfg"

GDB Client Configuration

  • select the "Debugger" window and look at the "GDB Client Setup" area
  • enter the full path to arm-non-eabi-gdb.exe in the "Executable" box
  • paste "set mem inaccessible-by-default off" in the "Commands" box
  • select the "Common" window
  • in the "Save As" area, select the "Shared file" radio button
  • check the "Debug" box in the "Display in favorites menu" area
  • click "Apply" and "Close"

At this point, the debug button should trigger a clean build with debug symbols and load a debug session on the selected platform.

Happy Debugging!

All wikipages