All Boards TCP

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

All Boards TCP

All Boards TCP

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 
CXXFLAGS = -Wall

To:

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 192.168.16.35 IP address and our HelloWorld application is located at /usr/bin/hello on the target board.

Execute the gdbserver:

gdbserver 192.168.16.35:10000 /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:

/sbin/ifconfig 

In our example the target board has the 192.168.16.36 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.

Eclipse_import.png

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...



No ratings
Version history
Last update:
‎09-10-2020 02:08 AM
Updated by: