Eclipse

From SEGGER Wiki
Revision as of 13:25, 8 October 2020 by Matthias (talk | contribs)
Jump to: navigation, search

Eclipse is a universal customizable IDE, which is also the base for many common commercial IDEs. In order to work with Eclipse and debug with J-Link, you also need to install a toolchain which includes compiler, assembler, linker + GDB (GNU Debugger) for debugging (e.g. GNU Tools for ARM). Moreover, in order to allow hardware debugging on embedded systems via GDB + GDB Server, there is also an Eclipse plugin needed, which enables hardware debugging via GDB (e.g. the CDT plugin). After setting up Eclipse + Plugin, Eclipse will use GDB as debugger where GDB communicates via the GDB protocol with J-Link GDB Server, allowing to debug the target hardware which is connected to a J-Link.

The tutorials in this article are based on Eclipse Neon.3 setup with the GNU MCU Eclipse environment by following the official install instructions. The GNU MCU Eclipse project is a collection of plug-ins for Eclipse CDT and ARM toolchains including extensions for easy embedded development in Eclipse. It is recommended to use this plug-in when working with a standard Eclipse installation.


Note: J-Link GDB Server is part of the J-Link Software and Documentation Pack and can be used free of charge.


Getting started

Creating a J-Link Debug Configuration

  • Open Run -> Debug Configurations...
  • Double click GDB SEGGER J-Link Debugging
  • Eclipse CreateJLinkDebugConf.png
  • Eclipse will create a New Debug Configuration and set setting to defaults based on the workspace and project
  • Eclipse JLinkDebugConfDefault.png


Configuring the target interface type

  • Open Run -> Debug Configurations...
  • On the left side, select the used Debug configuration in the group GDB SEGGER J-Link Debugging
  • Switch to the tab Debugger
  • The target interface can be selected in the area marked below
  • Eclipse JLinkDebugConf Debugger TargetInterface.png


Configuring the target interface speed

  1. Initial interface speed before/during connect
    • Open Run -> Debug Configurations...
    • On the left side, select the used Debug configuration in the group GDB SEGGER J-Link Debugging
    • Switch to the tab Debugger
    • The interface speed before connect can be specified in the field Initial speed marked below
    • Eclipse JLinkDebugConf Debugger TargetInterfaceSpeed Initial.png
  2. Interface speed after connect to target before/during reset & halt
    • Open Run -> Debug Configurations...
    • On the left side, select the used Debug configuration in the group GDB SEGGER J-Link Debugging
    • Switch to the tab Startup
    • The interface speed after connect to target before/during reset & halt can be specified in the field Low speed marked below
    • Eclipse JLinkDebugConf Startup TargetInterfaceSpeed ResetHalt.png
  3. Interface speed after initialization
    • Open Run -> Debug Configurations...
    • On the left side, select the used Debug configuration in the group GDB SEGGER J-Link Debugging
    • Switch to the tab Startup
    • The initial speed can be specified in the area JTAG/SWD Speed marked below
    • Eclipse JLinkDebugConf Startup TargetInterfaceSpeed.png


Specifying the target device

  • Open Run -> Debug Configurations...
  • On the left side, select the used Debug configuration in the group GDB SEGGER J-Link Debugging
  • Switch to the tab Debugger
  • The target device can be specified in the field Device name: marked below
  • Eclipse JLinkDebugConf Debugger TargetDevice.png


Specifying J-Link GDB Server commandline options

For a list of available commandline options, please refer to UM08001. Commandline options for GDB Server can used for various J-Link features, e.g.

  • specifying a J-Link Settings file
  • specifying a J-Link script file
  • specifying a J-Link Command String

Commandline options can be specified by editing the field Other options:

  • Open Run -> Debug Configurations...
  • On the left side, select the used Debug configuration in the group GDB SEGGER J-Link Debugging
  • Switch to the tab Debugger
  • Commandline options can be specified by editing the field Other options marked below
  • Eclipse JLinkDebugConf Debugger GDBServerCLO.png


J-Link Settings File

Please refer to Specifying J-Link GDB Server commandline options


Using J-Link Command Strings

Please refer to Specifying J-Link GDB Server commandline options
Please note that J-Link Command Strings can also be executed from J-Link script files.


Using J-Link script files

Please refer to Specifying J-Link GDB Server commandline options


Connecting to J-Link via J-Link Remote Server

The J-Link Remote Server makes it possible for Eclipse/ GDB to connect to a J-Link remotely, without needing a physical connection to the J-Link.

In order to connect to a J-Link Remote Server using Eclipse/ GDB follow these instructions:

  • Make sure that a J-Link Debug Configuration is already created, as described above
  • Open Run -> Debug Configurations...
  • Select a J-Link Debug Configuration under GDB SEGGER J-Link Debugging
  • Select the Debugger tab
  • For Connection select IP
  • Edit the IP field:
    • For a remote server running in LAN mode, enter "<RemoteServerIP>".
    • For a remote server running in tunneling mode, enter "tunnel:<SN/Nickname>[:<Pasword>[:tunnelserver[:port]]]"
  • Eclipse ConnectToRemoteServer.png
  • Click Apply


FAQ

I am using a standard Eclipse. What do I need to debug my application with J-Link?

To debug with J-Link the CDT plugin with GDB Server support, the GNU ARM Eclipse plugins or a similar plugin are required.

I have all plugins installed. What else do I need?

To use J-Link, the J-Link Software and Documentation Pack has to be installed. It includes the J-Link USB drivers and the J-Link GDB Server.

I cannot set a debug session with one of the plugins. Where can I get help?

For setting up a debug session, please refer to the respective documentation of the used plugin. SEGGER can only provide support for problems which are directly related to J-Link or GDB Server.

Does SEGGER support and maintain the GNU ARM Eclipse plugins?

No. The GNU ARM Eclipse plugins are not affiliated with SEGGER and are created, supported and maintained by Liviu Ionescu. SEGGER does only recommend these plugins as they are easy to use.

I am missing a feature in Eclipse. Can SEGGER add it?

No. SEGGER does not develop Eclipse or its plugins. Please contact the respective distributors.

When debugging with Eclipse, some commands do not work with J-Link. Why not?

Eclipse was mainly designed for JAVA development, later C/C++ development features and debugging features were added via plugins. Some of the plugins even work for embedded development, but there might be limitations related to the used plugin. In some cases it is possible to control J-Link and GDB Server by issuing monitor commands directly via GDB. (In the Eclipse Consoles -> ".../arm-...-gdb.exe") For the available GDB Server commands refer to the corresponding chapters in the J-Link User Manual (UM08001_JLink.pdf). Otherwise another debugger plugin or debugger might be needed.

Where can I find the GDB and GDB Server output?

Most Eclipse plugins invocate GDB and GDB Server and redirect input and output to the Console Window. GDB commands can be executed in the arm-...-gdb Console. gdb traces shows the log output of executed GDB commands. JLinkGDBServer(CL) shows the log output of GDB Server.

Eclipse FAQ 1.png

I am absolutely sure I set up everything correctly, but GDB Server or J-Link report errors. Can SEGGER help?

In this case, mostly yes. If your J-Link is within the support period (12 / 24 months), contact us at support@segger.com. If you are using a J-Link LITE / EDU / OB or an older J-Link, please use the SEGGER Forum. To allow fast response, please add your J-Link S/N, your target device name, the Eclipse version number, the used plugin and the GDB Server output to your mail or post.

Is there an alternative to debugging with Eclipse?

Yes. There are many commercial and free IDEs and stand-alone debuggers available. If you want to use Eclipse for your project development but not for debugging, J-Link Debugger is a good soulution. It is a full featured stand-alone GUI debugger to be used with J-Link, featuring nearly all functionality of J-Link. J-Link Debugger is as flexible as Eclipse, but with better performance and intuitively easy to use user interface. It is available free of charge and can also be used with Eclipse-created applications.