gdb with openocd on beaglebone for debugging a program

668 views
Skip to first unread message

aniket jesu

unread,
Jul 9, 2013, 9:13:05 AM7/9/13
to beagl...@googlegroups.com
Hi all,
Need some help regarding how to use gdb with open ocd for remote debugging a program on beaglebone.

Firstly I followed these link to get started with open ocd!!


http://www.mattlmassey.com/2012/04/26/using-openocd-with-the-beaglebone/
http://elinux.org/Running_OpenOCD_on_Linux_with_the_Beaglebone


And it seems to be worked to get
connect with beaglebone using gdb through open ocd. even able to get connected using telnet!!

following are the steps I'm following>>

1st)

sudo openocd -f board/ti_beaglebone.cfg -c init -c "reset init"

2nd) I can connect to the beaglebone by telnet as

sudo telnet localhost 4444

when I get connected I can halt, resume the cpu and I can see the effect of it on board!!

3rd)I can connect to the beaglebone by gdb as

arm-argo-linux-gnueabi-gdb

4th)On the other side on target beaglebone I'm setting the gdbserver to debug the hello word program as

gdbserver /dev/ttyO0 hello

as I'm not using the ethernet connection for it.

5th)on host side I'm doing this>

i.arm-argo-linux-gnueabi-gdb hello
ii.set sysroot /path/to/copy/of/rootfs
iii.target remote localhost:3333
iv.b main
v.continue


and when I say
continue it says this>>
 on host side>>


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

Locking debug access failed on first, but succeeded on second try.
Warn : am335x.cpu: ran after reset and before halt ...
target state: halted
target halted in ARM state due to debug-request, current mode: Supervisor
cpsr: 0x60000093 pc: 0xc001bc28
MMU: enabled, D-Cache: enabled, I-Cache: enabled
Info : accepting 'telnet' connection from 4444
Info : dropped 'telnet' connection
Info : accepting 'telnet' connection from 4444
force soft breakpoints
Info : accepting 'gdb' connection from 3333
target state: halted
target halted in ARM state due to debug-request, current mode: Supervisor
cpsr: 0x60000093 pc: 0xc001bc28
MMU: enabled, D-Cache: enabled, I-Cache: enabled
Warn : acknowledgment received, but no packet pending
Error: Address translation failure
Error: Address translation failure
Error: Address translation failure
Error: Address translation failure
Error: Address translation failure
Error: Address translation failure
Error: DSCR_DTR_RX_FULL, dscr 0x4b0f6043
Error: Timeout waiting for read dcc
>>>>Error: can't add breakpoint: unknown reason<<<<
Error: DSCR_DTR_RX_FULL, dscr 0x4b0f6043
Error: DSCR_DTR_RX_FULL, dscr 0x4b0f6003
Error: DSCR_DTR_RX_FULL, dscr 0x4b0f6043
Error: Timeout waiting for read dcc
Error: DSCR_DTR_RX_FULL, dscr 0x4b0f6043
Error: Timeout waiting for read dcc
Error: DSCR_DTR_RX_FULL, dscr 0x4b0f6043
Error: Timeout waiting for read dcc
Error: DSCR_DTR_RX_FULL, dscr 0x4b0f6043
Error: Timeout waiting for read dcc
Info : dropped 'gdb' connection

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



on target beaglebone kernel get crashed!!

=======================================================================================
root@beaglebone:~# [  698.816451] Unable to handle kernel paging request at virt
ual address 8e68c56c                                                           
[  698.824010] pgd = c0004000                                                  
[  698.826830] [8e68c56c] *pgd=00000000                                        
[  698.830573] Internal error: Oops: 805 [#1] SMP ARM                          
[  698.835567] Modules linked in:                                              
[  698.838758] CPU: 0    Not tainted  (3.8.13-00641-g768bfaf #1)               
[  698.844766] PC is at cpu_v7_dcache_clean_area+0x14/0x2c                     
[  698.850220] LR is at default_idle+0x20/0x2c                                 
[  698.854579] pc : [<c001bc40>]    lr : [<c000ebd4>]    psr: 60000093         
[  698.854579] sp : c07d5fb0  ip : 00000000  fp : 00000000                     
[  698.866539] r10: 00000000  r9 : 413fc082  r8 : 80004059                     
[  698.871981] r7 : c0aab280  r6 : c052b228  r5 : c0845c48  r4 : c07d4000      
[  698.878780] r3 : 00000000  r2 : 002de000  r1 : 00000000  r0 : 8e68c56c      
[  698.885595] Flags: nZCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment ker
nel                                                                            
[  698.893309] Control: 10c5387d  Table: 8f5d0019  DAC: 00000015               
[  698.899303] Process swapper/0 (pid: 0, stack limit = 0xc07d4238)            
[  698.905564] Stack: (0xc07d5fb0 to 0xc07d6000)                               
[  698.910109] 5fa0:                                     c000ebb4 c000ed70 c07dd
3c8 ffffffff                                                                   
[  698.918640] 5fc0: c07bd178 c078f7a4 ffffffff ffffffff c078f228 00000000 00000
000 c07bd178                                                                   
[  698.927163] 5fe0: 00000000 10c5387d c07dc4f0 c07bd174 c07e0cac 80008078 00000
000 00000000                                                                   
[  698.935721] [<c001bc40>] (cpu_v7_dcache_clean_area+0x14/0x2c) from [<c07bd174
>] (__atags_pointer+0x0/0x4)                                                   
[  698.945702] Code: e1a03823 e203300f e3a02004 e1a02312 (ee070f3a)            
[  698.952070] ---[ end trace f8a12ea9c3f74cfa ]---                            
[  698.956888] Kernel panic - not syncing: Attempted to kill the idle task!
========================================================================================

this line>>
[  698.816451] Unable to handle kernel paging request at virt
ual address 8e68c56c

how to avoid this error??


looking at the line,
>>>>Error: can't add breakpoint: unknown reason<<<<

I changed gdb_breakpoint_override to hard, default set to soft.
by this kernel is not getting crashed but some how few seconds after I say "continue" in gdb
target says connection is disconnected by the remote gdb and this message is shown continuously
in the loop.

and host side says>>>
>>Continuing.
>>couldn't write MPSSE commands to FT2232
>>Polling target failed, GDB will be halted. Polling again in 100ms



well, I'm a newbie.
I hope I'll get some help here.

thanks,
aniket

aniket jesu

unread,
Jul 10, 2013, 10:58:16 AM7/10/13
to beagl...@googlegroups.com

hi all,


I just did one change here,

now I'm using the gdb in cross compiler tool chain!!!

and using the ethernet connection to board for the remote debug!!

on target I changed to>>

>>>gdbserver 192.168.134.144:12345 hello

here 192.168.134.144 is the ip add of host and 12345 is the unique port number

and on host I changed to


>>>target remote 192.168.1.145:12345 hello

here 192.168.1.145 is ip add of target and 12345 is same port no used on target for communication

and hello is app program!!!

and finally I'm able to do remote debug a prog on beaglebone using gdb/gdbserver with openocd!!

thanks,
aniket

robert.berger

unread,
Jul 11, 2013, 3:45:43 AM7/11/13
to beagl...@googlegroups.com
Hi,


On Wednesday, July 10, 2013 5:58:16 PM UTC+3, aniket jesu wrote:


and hello is app program!!!

and finally I'm able to do remote debug a prog on beaglebone using gdb/gdbserver with openocd!!

I assume hello app a user space program.

Why would you use opencd to debug it and not just gdbserver running on the target and gdb on the host?

From what you write you debug without opencod.

Just unplug it and it's still going to work!

Regards,

Robert

aniket jesu

unread,
Jul 11, 2013, 4:26:00 AM7/11/13
to beagl...@googlegroups.com
Hi robert,

thanks for the reply.
well, yes it's working without openocd!!

Actually, I referres this link 1st up>>
http://openocd.sourceforge.net/doc/html/GDB-and-OpenOCD.html#GDB-and-OpenOCD

it explains>>

===================================================================

21.1 Connecting to GDB

Use GDB 6.7 or newer with OpenOCD if you run into trouble. For instance GDB 6.3 has a known

bug that produces bogus memory access errors,

which has since been fixed; see http://osdir.com/ml/gdb.bugs.discuss/2004-12/msg00018.html

OpenOCD can communicate with GDB in two ways:

  1. A socket (TCP/IP) connection is typically started as follows:
              target remote localhost:3333
    

    This would cause GDB to connect to the gdbserver on the local pc using port 3333.

    It is also possible to use the GDB extended remote protocol as follows:

              target extended-remote localhost:3333
    
  2. A pipe connection is typically started as follows:
              target remote | openocd -c "gdb_port pipe; log_output openocd.log"
    

    This would cause GDB to run OpenOCD and communicate using pipes (stdin/stdout).Using this method has the advantage of GDB starting/stopping OpenOCD for the debug session. log_output sends the log output to a file to ensure that the pipe is not saturated when using higher debug level outputs.

To list the available OpenOCD commands type monitor help on the GDB command line.


===================================================================

I tried this thing to remote debug that user space prog,
on target I was selecting /dev/ttyO0 as communication device for debug the only device connected to host, as uart0 as well as jtag connector,
and on host I was doing in dgb>> target remote localhost:3333 hello
 but only able to crash the kernel on target BB,
then I tried with ethernet, and as u told it's working without openocd with only gdb/gdbserver.

I just want to ask you a simple question, is openocd only for low level debugging and not for user space app debugging??

Now, I'll be trying out this kind of example on beaglebone to work,
>>https://github.com/mlu/cortal_dendrites/tree/6ed04b7e838981f594eb6b701a17c220fff952dd/cortex_a8/standalone/LEDblink

thanks,
aniket
Reply all
Reply to author
Forward
0 new messages