SparkFun Forums 

Where electronics enthusiasts find answers.

Open source ARM Debugger
By ottelo
#153843
Hi,

I bought a JTAG adapter from Olimex (http://www.olimex.com ARM-USB-TINY-H) for my LPC1768 Board (own design) to flash and debug it. I spent days to find the correct makefile & project.cfg to compile and flash the firmware. This works fine. But I dont know how to configure the Debug GDB Config under Eclipse. Although I have found a few tips and lines of code, but it still does not work :(. In the lpc1768.cfg file in openocd-0.6.1\scripts\target\ I changed "CCLK" to 96000 (set up in system_LPC17xx.c).

On the pictures are the config settings. I tried differnt Init & Run Commands with different error messages. Nothing works. Can someone help me?

The project files:
Image

The Run config for Eclipse:
Image

project.cfg for flashing the firmware:
Image

project2.cfg for only connect (and then debug):
Image

Debug GDP Config Tab 1:
Image

Debug GDP Config Tab 2:
Image

Debug GDP Config Tab 3:
Image

Debug GDP Config Tab 6:
Image

Initialize commands:
Code: Select all
target remote localhost:3333
monitor reset
Monitor soft_reset_halt
MWW monitor 0xE01FC040 0x0002
load
Run commands:
Code: Select all
monitor reg r13 = (0x10000000)
monitor reg pc = (0x10000004)
continue
Error messages:
Code: Select all
Open On-Chip Debugger 0.6.1 (2012-10-07-10:34)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.sourceforge.net/doc/doxygen/bugs.html
Info : only one transport option; autoselect 'jtag'
adapter_nsrst_delay: 200
jtag_ntrst_delay: 200
adapter speed: 10 kHz
cortex_m3 reset_config vectreset
Info : max TCK change to: 30000 kHz
Info : clock speed 10 kHz
Info : JTAG tap: lpc1768.cpu tap/device found: 0x4ba00477 (mfg: 0x23b, part: 0xba00, ver: 0x4)
Info : lpc1768.cpu: hardware has 6 breakpoints, 4 watchpoints

target remote localhost:3333
0x000000d0 in __do_global_dtors_aux ()
monitor reset
ftdi_write_data: usb bulk write failed
couldn't write MPSSE commands to FT2232
error: -104

in procedure 'reset'
Monitor soft_reset_halt
requesting target halt and executing a soft reset
ftdi_write_data: usb bulk write failed
couldn't write MPSSE commands to FT2232
MWW monitor 0xE01FC040 0x0002
Undefined command: "MWW".  Try "help".
load
Error erasing flash with vFlashErase packet
monitor reg r13 = (0x10000000)
register r13 not found in current target
monitor reg pc = (0x10000004)
  arm mcr cpnum op1 CRn op2 CRm value
  arm mrc cpnum op1 CRn op2 CRm
  arm reg   dap apid [ap_num]
  flash write_image [erase] [unlock] filename [offset [file_type]]
gdb_sync     lpc1768.cpu arm mcr cpnum op1 CRn op2 CRm value
    lpc1768.cpu arm mrc cpnum op1 CRn op2 CRm
    lpc1768.cpu arm reg     lpc1768.cpu dap apid [ap_num]
reg [(register_name|register_number) [value]]
in procedure 'reg'
continue
Note: automatically using hardware breakpoints for read-only addresses.
Warning:
Cannot insert hardware breakpoint 1.
Could not insert hardware breakpoints:
You may have requested too many hardware breakpoints/watchpoints.
Error Windows: Execution is suspended because of error
#153849
Ok I answer myself:

I put these commands into my project.cfg file:
Code: Select all
init
sleep 200
reset init
halt
wait_halt
so my entire project.cfg:
Code: Select all
# project file for Debug Sessions

source [find target/lpc1768.cfg]
reset_config srst_only

adapter_khz 500

init
sleep 200
reset init
halt
wait_halt
In the Init/Run fields of GDB/Debug Config I wrote these lines:
Code: Select all
target remote localhost:3333
load
Code: Select all
stepi
break main
continue
Now I get these Output:
Code: Select all
source .gdbinit
target remote localhost:3333
0x1fff0080 in ?? ()
load
Loading section .text, size 0x428 lma 0x0
Start address 0x251, load size 1064
Transfer rate: 302 bytes/sec, 1064 bytes/write.
stepi
Note: automatically using hardware breakpoints for read-only addresses.
stepi ignored. GDB will now fetch the register state from the target.

Program received signal SIGINT, Interrupt.
Reset_Handler () at core/cm3/startup_LPC17xx.c:191
191	{
break main
Breakpoint 3 at 0x11a: file main.c, line 29.
continue

Breakpoint 1, main () at main.c:29
29		LPC_GPIO1->FIODIR |= 1 << 29; // P1.29 connected to LED
And everything works! :)
long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]