All Boards TCP

Document created by jesseg Employee on Aug 15, 2012Last modified by Jodi Paul on Apr 9, 2013
Version 2Show Document
  • View in full screen mode

Debugging with Eclipse and GDB on Linux user space


This is a good open-source choice to debug i.MX processors. The integration of popular tools like Eclipse and GDB offers a good and stable connection between host and target.


The first step is to install the tools on host. Click here to get instructions of how to install the tools.

Let's debug a ready hello world program into the ltib. To extract the hello world package, type on ltib directory:

$./ltib -m prep -p helloworld 

Change the code of hello.c to:

#include <stdio.h> 
int main(int argc, char** argv)
    int i; 
    for (i = 0; i < 100; ++ i) 
        printf(“Welcome to GDB ! %d /n”, i); 
    return 0; 

Change the Makefile to add debug symbols

Change the two following lines from: 
CFLAGS = -Wall 


CFLAGS = -Wall -g 
CXXFLAGS = -Wall -g

Build and deploy the new source-code:

$./ltib –p helloworld –m scbuild 
$./ltib –p helloworld –m scdeploy

Configuring the Target

On target, gdbserver needs to be run to perform debug. The gdbserver command has the following structure:

gdbserver ip_host:port /full/path/app/app_name 



If gdbserver is not installed on target, select gdb package on ltib configuration.



In this example our host has the IP address and our HelloWorld application is located at /usr/bin/hello on the target board.

Execute the gdbserver:

gdbserver /usr/bin/hello 



You can use other port number as long as you use the same number when configuring the Eclipse.



Setting a GDB Debug Session on Eclipse

Now we will configure Eclipse C/C++ to start a GDB session with our remote i.MX board.

We will need to know which is the target board’s IP address.

To get your target’s IP address:




In our example the target board has the IP address.



Open-up Eclipse and choose the C/C++ perspective. We will import the HelloWorld executable built by LTIB. Go to the menu File -> Import You will see the “Import” screen.



Select “C/C++ Executable” option.

Hit the “Next” button.



Eclipse automaticaly creates a new project when whe use the “Import” option.



In the next screen, select the “Search Directory” option and hit the “Browse” button.



This session is incomplete and is being edited...