create your own

Remote debugging for ARM target board

79
rate or flag this page

By bhagwat dig it


I was struggling to set up gdbserver for ARM target board. I done google and got some information, but that was not specific to my board and most of the information was generic, Thought of sharing this with technical reader, just to save time,

I have posted the same here

Remote debugging for ARM target board

Remote target needs to have debugging stub (gdbserver),


>>

The gdbserver is also referred to as the 'stub' and must be cross-compiled for that target.

You also have to use a version of gdb on the host that was built

with the correct target in mind. Executing your gdb with the -v flag will give you information on how it was built.

before you begin, you need a communication interface between the PC running GDBand the target platform: either a serial link or, preferably, an Ethernet network connection. You also need a cross-target toolchain: a GNU C compiler (together with a C run-time library and binary utilities, a.k.a. binutils) that runs on the development workstation and generates executables for the target processor. You will build two sets of binaries from the GDB source code:

cross-target -- where the host is the development workstation and the target is the target processor native -- where both host and target are the target processor

First download the GDB source code compressed archive, and unpack it

The GDB source package uses the GNU build system, where generating binaries is usually just a few commands away (

./configure ; make ; make install

)

Configure gdbserver for ARM target board

 

To remote debug need a gdb built for the correct target. To do this, download the latest gdb release (6.8)


>>


>>
    $ tar –xvzf .gz 
    $ cd gdb-6.8 
    $ ./configure --host=i386 --target=arm-linux --build=i686 


>>


>>

--prefix=/home/bhagwat/arm-tools/bin/arm-linux-gdb

    $ make
    $ make install 
 

Cross target GDB ie arm-linux-gdb will be available in /home/bhagwat/arm-tools/bin/arm-linux-gdb/bin

 

Then, to build 'the stub' aka gdbserver for the arm-linux platform

 
    $ cd gdb-6.8/gdb/gdbserver 
    $ export CC=arm-linux-gcc   // if required
    $ export LD=arm-linux-ld    // if required 
    $ ./configure --build=i686 --host=arm-linux --target=arm-linux
    $ make
 

Copy gdbserver on target platform

gdbserver requires libthread_db.so.1 library, copy this from standard path to target boards /lib path.


Start with Remote Debugging

Start with simple hello.c example program


$ vi hello.c 
#include 
int main ( void)
{
   printf ( ”Hello , World ! \ n” ) ;
   return 0;
}
 

To build this program, you must use a cross compiler that is configured to generate binaries for the ARM Linux target (arm-linux-gcc).

Compile using arm-linux-gcc


>>
$ arm-linux-gcc -g -Wall -o hello hello.c

Copy the program to board.

Telnet into the target and start gdbserver:

 $ gdbserver :4000 hello

The port number (4000) is arbitrary. Be sure to include the full path to your executable.

On the host, cd to the hello.c program directory and type:

 $ /home/bhagwat/arm-tools/bin/arm-linux-gdb/bin/arm-linux-gdb hello
 $ target remote ds:4000
 $ break main
 $ continue

Where "ds" is the name or IP address of your target board.

If you want to have some comfort, use ddd:

 $ ddd --gdb --debugger /home/bhagwat/arm-tools/bin/arm-linux-gdb/bin/arm-linux-gdb hello


Keep me updating.


Happy remote debugging.

Remote debugging for ARM target board


Print   —   Rate it:  up  down  flag this hub

Comments

RSS for comments on this Hub

rightranjit profile image

rightranjit  says:
8 months ago

thanks....

bhagwat dig it  says:
8 months ago

welcome rightranjit

showkat shaheen  says:
6 months ago

i l u

lakshman  says:
10 days ago

sir,

please relese police reselt

Submit a Comment

Members and Guests

Sign in or sign up and post using a hubpages account.


optional


  • No HTML is allowed in comments, but URLs will be hyperlinked
  • Comments are not for promoting your hubs or other sites

VMware Fusion 3 VMware Fusion 3
Price: $69.77
List Price: $79.99
Star Trek: The Complete Comic Book Collection Star Trek: The Complete Comic Book Collection
Price: $23.46
List Price: $29.99
Chessmaster: Grandmaster Edition Chessmaster: Grandmaster Edition
Price: $16.90
List Price: $19.99
Archie Bronze Age Series Archie Bronze Age Series
Price: $9.49
List Price: $19.99
working