Embedded Studio with GDB Server

From SEGGER Wiki
Jump to: navigation, search

Embedded Studio directly integrates debugging support with J-Link. In addition third-party debug probes are supported via the GDB Server Interface. Any debug probe that can be controlled via GDB Server or an equivalent tool, such as OpenOCD, can be used for debugging with Embedded Studio.

Embedded Studio uses the GDB remote debugging protocol to communicate with the GDB Server and supports the standard debugging features. Embedded Studio can automatically launch the 3rd party GDB Server upon starting a debug session, keeping debugging easy and convenient. Port number, host and protocol features are configurable for maximum flexibility.

J-Link GDB Server

Note: It is recommended to use the native J-Link Support instead of the J-Link GDB Server.

To debug using J-Link GDB Server, open the project options and set:

  • Debug -> Debugger -> Target Connection to "GDB Server"
  • Debug -> GDB Server -> Type to "J-Link"

The GDB Server Command Line is used to start J-Link GDB Server. For the installation path the macro $(JLinkDir) can be used. Additionally at least the device name need to be set and if necessary the target connection needs to be configured via command line optoions.

The default GDB Server Command Line is "$(JLinkDIR)/JLinkGDBServerCL" -device "$(DeviceName)" -silent.

The default connection is "localhost" on port 2331. If another port should be used, change the project option as well as the command line option -port.

ST-Link GDB Server

To debug using ST-Link GDB Server, open the project options and set:

  • Debug -> Debugger -> Target Connection to "GDB Server"
  • Debug -> GDB Server -> Type to "ST-LINK"

The GDB Server Command Line is used to start ST-Link GDB Server.

OpenOCD

  • Under project options -> Debug -> Debugger Select "GDB Server" as interface.
    ES OpenOCD GDBServerSelect.png
  • Under project options -> Debug -> GDB Server set the path to the GDB Server executable (under Windows: openocd.exe), pass the config file for the target via the -f command line option and finally select "Yes" for "Auto Start GDB Server"
    ES OpenOCD GDBServerSettings.png
  • Start a debug session as usual (F5)

OpenOCD can either be build from source here or alternatively, binaries (pre-build .exe etc.) may be downloaded from here

Other GDB Servers

Other GDB Servers or equivalent tools can be used with Embedded Studio, too.

Set Debug -> GDB Server -> Type to "Generic" and set up the options accordingly.