Remote Debugging with Eclipse - Linux Embedded systems

Eclipse contains interesting tools for remote debugging that are part of the Eclipse platform: CDT and DSDP. Because the embedded development parts of Eclipse are leading edge, you need to download the latest Eclipse distribution and packages for embedded development and debugging.

Unlike the other tools in this section, Eclipse isn’t a debugger it’s an entire IDE. In order to use just the debugging features, you must import your project into Eclipse and possibly restructure how the project builds. If you’re starting a new project and use Eclipse from the beginning, this isn’t a factor.

After it’s unpacked, the software is ready to run in the directory where it was unpacked. You can relocate this directory to your /opt or /usr/bin directory; but Eclipse runs just fine in any directory.

When you have Eclipse in the desired directory, run it. Then, do the following to install the Target Management and Device Debugging plug-ins that extend Eclipse functionality:

  1. Select Help Software Updates.
  2. In the Software Updates and Add Ons dialog, click the Add Site button
  3. The software churns for a little while and then presents you with a list of software to install. Select all the items in the list.
  4. The wizard walks you through the installation process, asking you to agree to license terms and confirm your selections. After installation, the software asks you to restart.

Eclipse is now updated with the correct plug-ins for remote C and C++ debugging. The first package installed is a tool that manages a remote target; you can use it to copy files to the target without resorting to going to the command line.

To start a remote debugging session, select Run Debug Configurations, and double-click the C and C++ Remote Application item to create a new empty Debug Configuration. This example assumes you’ve created a simple “hello” project in Eclipse earlier and are reusing that code. The program that’s being debugged is less important that the process of configuring Eclipse for remote debugging. You see a dialog that looks like Figure below.

Remote Debugging with Eclipse

Supply a name for the configuration (it can be anything). The next thing of interest is the connection: this is where you tell Eclipse how to communicate with the remote target when starting a debug session or downloading files. Click the New button to start the wizard. You’re asked the type of system, with Linux being an obvious choice. Don’t be tempted, because this configures Eclipse to communicate with an agent, dstore, that hasn’t been installed on most systems; instead, select Ssh Only, because most embedded systems have small versions of SSH installed.

Enabling-SSH Under Eclipse

The next panel asks you for the IP address or host name of the remote machine. In this example, the IP address is 192.168.10.21, but it will likely be different for you. The connection name defaults to the host name or IP address; the Description field is optional. The last two panels in the wizard define how Eclipse opens a shell on the target and transfers files.

SSH-configuration

Back at the Debug Configuration panel, fill in the name of the project containing the sample program. Next, click the Search Project button, and select the binary for your project. Make the remote path /tmp/remote the place to download the binary to the target machine. You must have write privileges for this directory or the download will fail.
The next step is to switch to the Debugger tab and select a debugger. The default value for this field is GDB, which is the debugger residing on the host system, not on the target. If you’re curious, there’s a drop-down for selecting the protocol where you can select Default, mi1, mi2, or mi3. This field means the version of the machine interface protocol that Eclipse should use when communicating with the debugger. You only need to set this if the debugger in use is older and must use one of the older protocols. For the most part, Default is an acceptable value.

Now, you’re ready to debug. Click the Apply button, and then Debug. A small dialog appears, asking for a user name and password for the remote host, to be used for transferring the file and opening the shell. The application file is downloaded, and the debugger starts. The debugging works the same as if you were debugging locally.


All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Linux Embedded systems Topics