Jump to content
ntfreak

ICDI support in OpenOCD

Recommended Posts

UPDATE: I was using the yagarto toolchain, with the ARM GCC toolchain i do not have this problem.

 

I have got the following error: in GDB console

 

(gdb) target remote :3333
Remote debugging using :3333
Remote 'g' packet reply is too long: 0000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000007c454c46ffffffff010
10100000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000

 

and in opendocd console i see:

 

Open On-Chip Debugger 0.7.0-dev-00062-g170c851 (2012-10-25-22:34)
Licensed under GNU GPL v2
For bug reports, read
 http://openocd.sourceforge.net/doc/doxygen/bugs.html
adapter speed: 1000 kHz
Info : clock speed 1000 kHz
Info : ICDI Firmware version: 9270
Info : lm4f23x.cpu: hardware has 6 breakpoints, 4 watchpoints
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x00010100 msp: 0x464c457c
Info : accepting 'gdb' connection from 3333
Warn : acknowledgment received, but no packet pending
Info : dropped 'gdb' connection

 

I am building the blinky code in the TI supplied stellarisware software.

 

Computer: 64 bit windows 7

 

BTW: I did flash the device with "LM Flash programmer" , i suppose that does not mater.

Share this post


Link to post
Share on other sites

Does not seem to break a second time at a breakpoint.

 

Code snip from the blinky example.

   while(1)
   {
    //
    // Turn on the LED.
    //
    GPIO_PORTF_DATA_R |= 0x08;
    //
    // Delay for a bit.
    //
    for(ulLoop = 0; ulLoop < 200000; ulLoop++)//break point is here
    {
    }
    //
    // Turn off the LED.
    //
    GPIO_PORTF_DATA_R &= ~(0x08);
    //
    // Delay for a bit.
    //
    for(ulLoop = 0; ulLoop < 200000; ulLoop++)
    {
    }
   }

 

What is do is:

 

GNU gdb (GNU Tools for ARM Embedded Processors) 7.3.1.20110908-cvs
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=i586-mingw32 --target=arm-none-eabi".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from C:\Misc\StellarisWare\boards\ek-lm4f120xl\blinky\gcc/blinky
.axf...done.
(gdb) target remote :3333
Remote debugging using :3333
ResetISR () at startup_gcc.c:251
251		 for(pulDest = &_data; pulDest < &_edata; )
(gdb) break blinky.c:78
Breakpoint 1 at 0x284: file blinky.c, line 78.
(gdb) monitor halt reset
Invalid command argument
halt [milliseconds]
 lm4f23x.cpu arp_halt
 lm4f23x.cpu arp_halt_gdb
reset [run|halt|init]
soft_reset_halt wait_halt [milliseconds]
in procedure 'halt'
(gdb) c
Continuing.
Note: automatically using hardware breakpoints for read-only addresses.
Breakpoint 1, main () at blinky.c:78
78			  for(ulLoop = 0; ulLoop < 200000; ulLoop++)
(gdb) c
Continuing.

 

I was expecting that it breaked very very often :), but is does not it just continues.

Share this post


Link to post
Share on other sites

Thanks, we all really appreciate your efforts!

 

I used this as my cfg file:

 

#
# TI Stellaris Launchpad ek-lm4f120xl Evaluation Kits
#
# http://www.ti.com/tool/ek-lm4f120xl
#
#
# NOTE: using the bundled ICDI interface is optional!
# This interface is not ftdi based as previous board were
#
source [find interface/ti-icdi.cfg]
set WORKAREASIZE 0x4000
set CHIPNAME lm4f120h5qr
source [find target/stellaris_icdi.cfg]

 

Flashing code, setting breakpoints, triggering breakpoints, 'step', 'finish', and 'next' all seemed to work great. I wasn't able to get watchpoints working. Should watchpoints work OK?

 

-rick

 

Breakpoints work ? When I look at the git repository, the file /ti_icdi_usb.c contains no code to set or clear breakpoints.

Share this post


Link to post
Share on other sites

 

Breakpoints work ? When I look at the git repository, the file /ti_icdi_usb.c contains no code to set or clear breakpoints.

 

The code to set breakpoints is in target/cortex_m.c

 

Spen

Share this post


Link to post
Share on other sites

I have got the following error: in GDB console

 

(gdb) target remote :3333
Remote debugging using :3333
Remote 'g' packet reply is too long: 0 .....

 

Sorry, yeah I had already patched my openocd so it would work with the stm32 chips. I'm also using a version of yagarto.

 

-rick

Share this post


Link to post
Share on other sites

Does not seem to break a second time at a breakpoint.

 

Code snip from the blinky example.

while(1)
{
 //
 // Turn on the LED.
 //
 GPIO_PORTF_DATA_R |= 0x08;
 //
 // Delay for a bit.
 //
 for(ulLoop = 0; ulLoop < 200000; ulLoop++)//break point is here
 {
 }
 //
 // Turn off the LED.
 //
 GPIO_PORTF_DATA_R &= ~(0x08);
 //
 // Delay for a bit.
 //
 for(ulLoop = 0; ulLoop < 200000; ulLoop++)
 {
 }
}

 

What is do is:

 

GNU gdb (GNU Tools for ARM Embedded Processors) 7.3.1.20110908-cvs
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=i586-mingw32 --target=arm-none-eabi".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from C:\Misc\StellarisWare\boards\ek-lm4f120xl\blinky\gcc/blinky
.axf...done.
(gdb) target remote :3333
Remote debugging using :3333
ResetISR () at startup_gcc.c:251
251		 for(pulDest = &_data; pulDest < &_edata; )
(gdb) break blinky.c:78
Breakpoint 1 at 0x284: file blinky.c, line 78.
(gdb) monitor halt reset
Invalid command argument
halt [milliseconds]
lm4f23x.cpu arp_halt
lm4f23x.cpu arp_halt_gdb
reset [run|halt|init]
soft_reset_halt wait_halt [milliseconds]
in procedure 'halt'
(gdb) c
Continuing.
Note: automatically using hardware breakpoints for read-only addresses.
Breakpoint 1, main () at blinky.c:78
78			 for(ulLoop = 0; ulLoop < 200000; ulLoop++)
(gdb) c
Continuing.

 

I was expecting that it breaked very very often :), but is does not it just continues.

 

try using 'monitor reset halt' rather than 'monitor halt reset'.

As a side note it is often safer to use 'monitor reset init'. this does the same as reset halt except it will call any registered reset scripts - if any.

 

you may also use extended remote rather than remote, then you have access to the gdb start/run cmd's that will perform a reset and set a breakpoint on main automatically.

so use target extended-remote :3333 rather than target remote :3333

 

Spen

Share this post


Link to post
Share on other sites

When running openocd for the ek-lm4f120xl : openocd -s ~/lib/openocd/tcl -f board/ek-lm4f120xl.cfg

I get: Error: The specified debug interface was not found (hla)

 

A search on that error turns up empty. Anybody know how this could be fixed?

 

Thomas

Share this post


Link to post
Share on other sites

When running openocd for the ek-lm4f120xl : openocd -s ~/lib/openocd/tcl -f board/ek-lm4f120xl.cfg

I get: Error: The specified debug interface was not found (hla)

 

How did you build OpenOCD, you will need to pass --enable-ti-icdi to configure

 

Spen

Share this post


Link to post
Share on other sites

Thanks a lot for all the work getting this working! It's really nice to be able to develop for this board using only free tools!

 

I'd love to set up these tools for debugging, but I'm too noobish to get it done without some more hints about the process :P

 

Right now I have the cross compiler and lmtools working. Building programs and flashing them works perfect. But I don't know how to continue. Reading this thread, it looks like I have to compile a patched version of openocd... where can I find it?

Share this post


Link to post
Share on other sites

Is there a way to mask interrupts while stepping? I'm trying to debug a USB CDC enabled code. After a breakpoint I try stepping and end up in USB0DeviceIntHandler.

 

I've seen some posts about cortex_m3 maskint, but it seems this command is not available (nor applicable) in this patched version on OpenOCD.

 

gdb) next
Single stepping until exit from function USBRingBufUsed,
which has no line number information.
0x00001dfc in USB0DeviceIntHandler ()

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×