Debugging with GNU MCU Eclipse¶
Introduction¶
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¶
- A nRF52840 M.2 Developer Kit (including nRF52840 M.2 Module and M.2 Dock)
- A macOS, Linux or Windows computer
Installing Eclipse¶
You need to install Eclipse CDT with the GNU MCU Eclipse plugins to begin:
- Install Eclipse IDE for C/C++ Developers.
- Open Eclipse.
- Create a workspace directory. This will be separate from your code.
- Install the GNU MCU Eclipse plugin:
- Click the Help menu item and select Eclipse Marketplaceā¦
- Find GNU MCU Eclipse and install.
- 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¶
- Open Eclipse.
- On the Welcome window, select Import a project with a working Makefile.
- Select the folder to your project with a Makefile. E.g., blinky/armgcc.
- Under Toolchain for Indexer Settings, select
Cross ARM GCC
. - Click Finish.
Configuring the debugger¶
- Select Run > Debug Configurations....
- If no configuration exists under GDB pyOCD Debugging, click on New launch configuration.
-
In the Main tab, select the
.out
file (_build/nrf52840_xxaa.out
) under C/C++ Application. -
In the Debugger tab:
- Under pyOCD Setup, set the Executable path and make sure that it is pointing to your latest version of the
pyocd-gdbserver
. - Under GDB Client Setup, set the Executable path to your
arm-none-eabi-gdb
. - Click Apply.
- Under pyOCD Setup, set the Executable path and make sure that it is pointing to your latest version of the
Tip
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¶
- Mount the nRF52840 M.2 Module
- Connect the Debugger USB port of M.2 Dock to your PC using the provided USB-C Cable
- 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: