This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Using OpenOCD with Beaglebone

Hi

We are looking for help in connecting Beaglebone with openOCD JTAG debugger.

We want to know if we can use the generally available Olimex ARM USB JTAG connector for hardware connection. 

Also any help in setting up openOCD tool on Ubuntu machine for debugging with Beaglebone would be highly appreciated.

Thanks and regards

Rajam

  • Hi Rajam,
     
    Unfortunately the Olimex ARM USB JTAG is not compatible with the Beaglebone. The Beaglebone has a built-in FTDI-based serial/JTAG and on-board hub to give the same cable simultaneous access to a USB device port on the target processor. For more details: http://beagleboard.org/bone/.
     
    Best Regards
    Biser
  • Thanks a lot for your reply and that clarified that there is no separate hardware adapter required for connecting Beaglebone board with openOCD. There was also help from this link: http://www.mattlmassey.com/2012/04/26/using-openocd-with-the-beaglebone/ which we referred.

    We are able to connect to the board as per the link but there are some errors:

    > am335x.cpu mdw 0x4804c000 1
    JTAG-DP STICKY ERROR
    MEM_AP_CSW 0x2800052, MEM_AP_TAR 0x4804c000
    JTAG-DP STICKY ERROR
    MEM_AP_CSW 0x2800052, MEM_AP_TAR 0x4804c000
    Block read error address 0x4804c000
    Runtime Error: embedded:startup.tcl:20: error reading target @ 0x4804c000

    Can someone help in how to access memory from commands in Beaglebone?

    Thanks and regards

    Rajam

  • I was able to load a binary into AM335x based ICE board using openocd. Any help still required?

    Regards,

    Torsten

  • Hi 

    Thanks for sharing the update. We moved into using CCS since we had issues with OpenOCD. 

    But now we would like to give a try if you could share the information on the process you followed. 

    Thanks and regards

    Rajam

  • Well,

    it works, but there is much room for improvements. At first you need openocd 0.7.0. I basically followed Matt Massey's blog entry to change my installation with some updated files:

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

    After this you should be able to connect to the target with something like the following command:

    openocd-0.7.0.exe -f board/ti_beaglebone.cfg

    following .gdbinit file loads the binary into the external RAM:

    echo *** Executing .gdbint to set up the environment for debugging gdb:\n
    # This connects to OpenOcd at localhost:3333
    target remote localhost:3333
    # dbginit must be run in OpenOCD after every reset
    monitor am335x.cpu cortex_a dbginit
    monitor reset
    monitor sleep 500
    monitor halt
    monitor sleep 500
    load ../Release/appl.out
    cont

    I still have a problem there, since the application causes an exception here. If I just break the app by pressing ctrl-c and reload the binary, a restart using the command "continue" runs my application.

    So you see, it works for me, but it's not really working as it should be. Maybe anyone has some time to investigate the issues.

    Regards,

     Torsten

     

  • 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
     
    is it ok? as I'm not using the ethernet connection for it. or I must use ethernet connection???

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

  • 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