Skip to content

Debugging with GNU MCU Eclipse


GNU MCU Eclipse fully supports pyOCD with an included pyOCD debugging plugin. This guide explains how to configure the local debug toolchain using M.2 Dock with GNU MCU Eclipse.

What you'll need

Installing Eclipse

You need to install Eclipse CDT with the GNU MCU 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 MCU Eclipse plugin:
    1. Click the Help menu item and select Eclipse Marketplaceā€¦
    2. Find GNU MCU Eclipse and install.
    3. Select GNU MCU Eclipse x.x.x and confirm.

Install pyOCD

The latest stable version of pyOCD may be installed via pip as follows. Skip this step if pyOCD already exists.

pip install -U pyocd

Install GNU Arm Embedded Toolchain

Download and install the GNU ARM Embedded Toolchain. Skip this step if the toolchain already exists.

Importing the project in Eclipse

  1. Open Eclipse.
  2. On the Welcome window, select Import a project with a working Makefile.
  3. Select the folder to your project with a Makefile. E.g., blinky/armgcc.
  4. Under Toolchain for Indexer Settings, select Cross ARM GCC.
  5. Click Finish.

Configuring the debugger

  1. Select Run > Debug Configurations....
  2. If no configuration exists under GDB pyOCD Debugging, click on New launch configuration.
  3. In the Main tab, select the .out file (_build/nrf52840_xxaa.out) under C/C++ Application.

  4. In the Debugger tab:

    1. Under pyOCD Setup, set the Executable path and make sure that it is pointing to your latest version of the pyocd-gdbserver.
    2. Under GDB Client Setup, set the Executable path to your arm-none-eabi-gdb.
    3. Click Apply.


The which(on macOS/Linux) or where(on Windows) shell command can be used to find the location of pyocd-gdbserver and arm-none-eabi-gdb. E.g., which pyocd-gdbserver and which arm-none-eabi-gdb.

Connecting the target

  1. Mount the nRF52840 M.2 Module
  2. Connect the Debugger USB port of M.2 Dock to your PC using the provided USB-C Cable
  3. A disk drive called M2-DOCK will be automatically detected by the computer.

Debugging your project

Click the menu Run -> Debug, and debugging starts. Click on the Debugger Console tab to see the debug output:

Create an Issue

Interested in contributing to this project? Want to report a bug? Feel free to click here: