ts-7000
[Top] [All Lists]

[ts-7000] Re: Eclipse + Ubuntu + gdbserver in TS-7300

To:
Subject: [ts-7000] Re: Eclipse + Ubuntu + gdbserver in TS-7300
From: "mario.huizar" <>
Date: Wed, 10 Mar 2010 12:00:17 -0000

--- In  "mario.huizar" <> wrote:
>
> Hello everyone,
>
> I go a TS-7300 and I am trying to set-up a remote debugging with gdbserver. I 
> have been not able still to find it how.
>
> I have read the posts about it but I have not found the answer yet.
>
> I have already installed the crosstools and I am able to compile in my Ubuntu 
> with the crosscompiler. I have already made a NFS mount of my workspace on 
> the TS-7300, but how to make a remote debugging?!?!?
>
> I run gdbserver on my TS-7300 with the command
> gdbserver :10000 target
>
> and then in eclipse I configure also the debugger using gdb because I did not 
> find any croos gdb debugger...
>
> Basically what I did in eclipse was:
>                                                                     Run �> 
> Debug Configurations . . . Click the New launch configuration button.
> A new configuration named target Debug is created, referencing the target 
> project and the Debug/target application. I select the Debugger tab. I Opened 
> the Debugger drop-down menu and select gdbserver Debugger. Enter the name 
> "gdb" in the GDB debugger field. Click the Connection tab under Debugger 
> Options. Select TCP from the Type drop-down and enter the IP address of your 
> target in the Host name or IP address field (Figure 5.13). Click Apply and 
> then Close.
>
> But when I try to connect it appears an error Program file not specified.
>
> Any sugesstions will be greatly appreciated...
>
> Best regards,
> Mario Huizar
>

Hello,

I was fighting again and finally I got it working.. it was no easy but it is 
now working. I need still to do some fine tuning. Here is what I did in case 
someone find it useful:

For more information: Doug Abbot, Embedded Linux Development Using Eclipse, 
November 2008, Newnes, UK page page 95-103

1.You need to stablish a SSH connection (you could also use minicom)

2.You need also to mount your workspace in the TS-7300 with NFS

In order to do that you need first to install a NFS server in Ubuntu

For more information see: http://ubuntuforums.org/showthread.php?t=249889

install the packets: nfs-kernel-server nfs-common portmap. At the terminal type:

sudo apt-get install nfs-kernel-server nfs-common portmap
#When configuring portmap do =not= bind loopback. If you do you can either edit 
#/etc/default/portmap by hand or run:
sudo dpkg-reconfigure portmap
sudo /etc/init.d/portmap restart

Editing /etc/exports

the /etc/exports file is used for creating a share on the NFS server.

gedit /etc/exports
# /etc/exports: the access control list for filesystems which may be exported
#               to NFS clients.  See exports(5).
#
# Example for NFSv2 and NFSv3:
# /srv/homes       hostname1(rw,sync,no_subtree_check) 
hostname2(ro,sync,no_subtree_check)
#
# Example for NFSv4:
# /srv/nfs4        gss/krb5i(rw,sync,fsid=0,crossmnt,no_subtree_check)
# /srv/nfs4/homes  gss/krb5i(rw,sync,no_subtree_check)
#
#Here instead of /home/mario/TS7300workspace put the folder where your 
workspace is.
/home/mario/TS7300workspace/TS7300 
*(rw,no_root_squash,no_all_squash,sync,no_subtree_check)

To be sure that the NFS server is working type:

/etc/init.d/nfs-kernel-server status
#after modifying the exports file restart the server:
sudo /etc/init.d/nfs-kernel-server restart
sudo exportfs -a

On the TS-7300 in order to mount the shared folder in a directory:

#mount the workspace folder to /home
mount 129.187.74.225:/home/mario/TS7300workspace/TS7300 /home

If everything went ok, all the contents of your workspace will be reflected on 
the /home directory on the TS7300.

3.Using gdb and gdbserver to remotely debug

In order to establish a remote debug you need to use gdb and gdbserver. The 
TS-7300 comes already with the gdbserver 6.3 as default. So what we did was a 
sort of crosscompile gdb 6.3 in Ubuntu for an arm-linux target. What you need 
to do is:

a.Download gdb6.3 from gnu: http://www.gnu.org/software/gdb/download/

b.Compile gdb6.3 for an arm-linux target. More info at the readme file of 
gdb6.3 and at: 
http://cplusadd.blogspot.com/2009/05/compiling-and-using-gdb-for-arm-linux.html?showComment=1268154806167_AIe9_BHKHIh43n4Hk3SzmVZAlUgTIgmWwRHWDyGevTm-9VA2ndU1VZFTFzAzj0Yrf72X6XJecCZi-41fisrj2QcWt_MdnFEBpfMZlip0GgL7hIoWbTBdvVhBYWC8yT0rnA94pPxpfUUQfVYMchCObVA6swi8_oy3z_b1TkYJ8WFqMvnTfNvfFGpWw1WZyimN_ri92Fjka5YZ6iQIV5sBNL0LVTvLRZstCS4pIfevrU9oimT14kTP_8HYdZ5TAdx44VDP3A3nCXvB#c1367182892360842713

In my case I also needed to install the following packages:

#More info at:http://ubuntuforums.org/showthread.php?t=241707
sudo apt-get install ncurses-base
sudo apt-get install ncurses-bin
sudo apt-get install ncurses-term
sudo apt-get install bison
sudo apt-get install flex

and I also had to apply a patch to sim/arm/iwmmxt.c file because it was 
displaying some warnings. More info at: 
http://sources.redhat.com/ml/gdb-patches/2005-04/msg00193.html

After that you have to configure the ./configure file to set as target an 
arm-linux:

#It is also a good idea to compile the gdb6.3 in a different folder than the 
sources
#see the readme file from gdb6.3 for more information 
(....../gdb-6.3/gdb/Readme)
cd gdb-6.3
mkdir ../gdb-arm
cd ../gdb-arm
#more info: http://tech.groups.yahoo.com/group/ts-7000/message/12459
../gdb-6.3/configure --target=arm-linux
make

Now it is a good time to test your gdbserver gdb connection:

#First the server should be started in the  **arm processor** by issuing 
something like:
gdbserver host:10000 hello
#gdbserver host:1234 _executable_
#Where _executable_ is the application that is going to be debugged and 
host:1234 tells #gdbserver to listen for connections to port 1234.

#To run gdb just type this in a **PC** shell:
#you have to change the location to your gdb in your PC...
#<path>/gdb --se=_executable_
/home/mario/Documents/gdb6.3/gdb-arm/gdb/gdb --se=hello
#To resume execution type 'continue'.

4.Setting up Eclipse

Install Eclipse with the CDT plugin (This should not be a problem:D)

Create a new C++ make project with the --Other Toolchain-- option.

Then you have to modify the makefile to fit your project. You can use my 
makefile (you have to change the paths and sources variables):

CCFLAGS =       -Wall -g -o

SOURCES =       TS7300.cpp

OBJS =          TS7300.o

LIBS =

TARGET =        TS7300

ARMGCC =        /opt/crosstool/gcc-3.3.4-glibc-2.3.2/bin/arm-linux-g++

$(TARGET):      $(OBJS)
        $(ARMGCC) $(CCFLAGS) $(TARGET) $(SOURCES) $(LIBS)

all:    $(TARGET)

clean:
        rm -f $(OBJS) $(TARGET)

Also in Project->Properties->C/C++Build (Discover Option) in the compiler 
invocation command field place your crosscompiler path (in my case):

/opt/crosstool/gcc-3.3.4-glibc-2.3.2/bin/arm-linux-g++

You will be able now to crosscompile in Eclipse.

Now to debug what you need to do is:With the target project selected in the 
Project Explorer view, select Run â?"> Debug Configurations . . . and double 
click to create a new C/C++ App configuration

On the Main drop-down menu you have to take care that in the textfield "C/C++ 
Application" is the name of your executable file. In my case:

/home/mario/TS7300workspace/TS7300/hello

Open the Debugger drop-down menu and select gdbserver Debugger. Enter the name 
of your cross gdb in the GDB debugger field.

Click the Connection tab under Debugger Options. Select TCP from the Type 
drop-down and enter the IP address of your target in the Host name or IP 
address field. Click Apply and then Close. GDB is now configured to talk to 
your target board over the network.

Before running the Debug command in eclipse you have to run the command:

gdbserver host:10000 hello

in the TS-7300 board. And then on eclipse type Run->Debug. And thats it. :D

Mario Huizar



------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ts-7000/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/ts-7000/join
    (Yahoo! ID required)

<*> To change settings via email:
    
    

<*> To unsubscribe from this group, send an email to:
    

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

<Prev in Thread] Current Thread [Next in Thread>
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU