MCU Eclipse/J-Link Debugging for PX4

This topic explains how to setup and use MCU Eclipse with a Segger Jlink adapter to debug PX4 running on NuttX (e.g. Pixhawk series boards).

Required Hardware

  • J-Link EDU Mini
  • Adapter to connect Segger JLink to debug port.
  • USB micro cable
  • Suitable cables to connect your target.



Setup PX4 by following the normal guidelines:


To install Eclipse:

  1. Download Eclipse CDT for C/C++ Developers (MCU GitHub).
  2. Extract the Eclipse folder and copy it anywhere (there is no need to run any install scripts).
  3. Run Eclipse and choose a location for your initial workbench.

To install the Segger Jlink tools:

  1. Download and run the J-Link Software and Documentation Pack for your OS (Windows and Linux packages available).
    • On Linux the tools are installed in usr/bin.

For more information, see:

First Use

  1. Connect the Segger JLink to the host computer and the flight controller debug port (via an adapter).
  2. Power the flight controller.
  3. Run Eclipse.
  4. Add a source by choosing File > Import > C/C++ > Existing Code as Makefile Project and click Next.
  5. Point it to the Firmware folder and give it a name, then select ARM Cross GCC in the Toolchain for Indexer Settings and click Finish. Import takes a while, wait for it to complete.
  6. Set the MCU settings: right-click on the top-level project in the Project Explorer, select Properties then under MCU choose SEGGER J-Link Path. Set it as shown in the screenshot below. Eclipse: Segger J-Link Path
  7. Update packs:

    • Click the small icon on the top right called Open Perspective and open the Packs perspective. Eclipse: Workspace
    • Click the update all button.

      This takes a VERY LONG TIME (10 minutes). Ignore all the errors about missing packages that pop up.

      Eclipse: Workspace Packs Perspective

    • The STM32Fxx devices are found in the Keil folder, install by right-clicking and then selecting install on the according device for F4 and F7.
  8. Setup debug configuration for target:

    • Right click project and open the Settings (menu: C/C++ Build > Settings)
    • Choose the Devices Tab, Devices section (Not Boards).
    • Find the FMU chip you wish to debug.

    Eclipse: Select FMU in settings

  9. Select debug configurations with the small drop-down next to the bug symbol: Eclipse: Debug config
  10. Then select GDB SEGGER J-Link Debugging and then the New config button on the top left. Eclipse: GDB Segger Debug config
  11. Setup build config:

    • Give it a name and set the C/C++ Application to the corresponding .elf file.
    • Choose Disable Auto build

      Remember that you must build the target from the command line before starting a debug session.

    Eclipse: GDB Segger Debug config

  12. The Debugger and Startup tabs shouldn’t need any modifications (just verify your settings with the screenshots below)

    Eclipse: GDB Segger Debug config: debugger tab Eclipse: GDB Segger Debug config: startup tab


Target CPU not in Package Manager

If the target CPU does not appear in the package manager you may need these steps to get the register view working.

This should not generally happen (but anecdotally has been reported when connecting to an STM F7 controller).

Adding missing SVD files for the Peripheral View:

  1. Find out where MCU Eclipse stores its packages (Preferences > C/C++ > MCU Packages): Eclipse: MCU Packages
  2. Download missing packages from:
  3. Open downloaded pack with a decompression tool, and extract the .SVD files from: /CMSIS/SVD.
  4. Select desired .SVD file in: Debug Options > GDB SEGGER JLink Debugging > SVD Path Eclipse: SVD File path

results matching ""

    No results matching ""