OpenOCD dropped connection

Hi.

I am having trouble trying to use OpenOCD with Insight on my Linux machine to talk to an AT91SAM7S256 MCU.

I am very new to all this, so please be gentle!

I have OpenOCD using the following config file.

#daemon configuration
telnet_port 4444
gdb_port 3333

#interface
interface parport
parport_port 0 #x378
parport_cable wiggler
jtag_speed 2

#use combined on interfaces or targets that can't set TRST/SRST separately
reset_config srst_only #trst_and_srst #srst_pulls_trst

#jtag scan chain
#format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)
jtag_device 4 0x1 0xf 0xe

#target configuration
daemon_startup attach
#target <type> <startup mode>
target arm7tdmi little reset_halt 0 arm7tdmi
#working_area 0 0x200000 0x4000 backup
#run_and_halt_time 0 5000

#flash configuration (K9D1208V0M: 512Mbit, x8, 3.3V, Mode: Normal, 1st gen)
#NOR flash configuration (SST39VF400A 4Mbit, x16, 3.3V, 128sect, 4k/sect, 8 blocks (64kByte per block)
# flash bank cfg addr length chip_width bus_width target
flash bank at91sam7 0 0 0 0 0

And when I try and run the program on the MCU I get the following from within the Insight console.

(gdb) file main.elf
Using host libthread_db library "/lib/libthread_db.so.1".

(gdb) target remote localhost:3333
Remote debugging using localhost:3333
0x00000020 in ?? ()

(gdb) break main
Note: breakpoints 1 and -2 also set at pc 0x200248.
Breakpoint 2 at 0x200248: file main.c, line 68.

(gdb) load
Loading section .text, size 0x550 lma 0x200000
Loading section .rodata, size 0x20 lma 0x200550
Loading section .data, size 0x4 lma 0x200570
Start address 0x200000, load size 1396
Ignoring packet error, continuing...
Transfer rate: 2 KB/sec, 465 bytes/write.

(gdb) continue
Continuing.

Error: putpkt: write failed: Broken pipe.

(gdb)

and here is the OpenOCD output

Open On-Chip Debugger 1.0 (2008-05-15-21:08) svn:658
$URL: svn://svn.berlios.de/openocd/trunk/src/openocd.c $
Debug:   3 0 command.c:425 command_run_line(): script openocd.cfg
Debug:   4 0 configuration.c:87 open_file_from_path(): opened openocd.cfg
Debug:   5 0 command.c:425 command_run_line(): telnet_port 4444
Debug:   6 0 command.c:425 command_run_line(): gdb_port 3333
Debug:   7 0 command.c:425 command_run_line(): interface parport
Debug:   8 0 command.c:425 command_run_line(): parport_port 0
Debug:   9 0 command.c:425 command_run_line(): parport_cable wiggler
Debug:   10 0 command.c:425 command_run_line(): jtag_speed 2
Debug:   11 0 jtag.c:1857 handle_jtag_speed_command(): handle jtag speed
Info:    12 0 options.c:50 configuration_output_handler(): jtag_speed: 2, 2
Debug:   13 0 command.c:425 command_run_line(): reset_config srst_only
Debug:   14 0 command.c:425 command_run_line(): jtag_device 4 0x1 0xf 0xe
Debug:   15 0 command.c:425 command_run_line(): daemon_startup attach
Info:    16 0 options.c:50 configuration_output_handler(): Open On-Chip Debugger 1.0 (2008-05-15-21:08) svn:658
Debug:   17 0 command.c:425 command_run_line(): target arm7tdmi little reset_halt 0 arm7tdmi
Debug:   18 0 command.c:425 command_run_line(): flash bank at91sam7 0 0 0 0 0
Debug:   19 0 command.c:425 command_run_line(): init
Debug:   20 1 openocd.c:102 handle_init_command(): target init complete
Debug:   21 1 parport.c:349 parport_init(): opening /dev/parport0...
Debug:   22 1 parport.c:361 parport_init(): ...open
Debug:   23 39 parport.c:233 parport_reset(): trst: 0, srst: 0
Debug:   24 39 openocd.c:109 handle_init_command(): jtag interface init complete
Debug:   25 39 jtag.c:1531 jtag_init_inner(): Init JTAG chain
Debug:   26 39 jtag.c:326 jtag_call_event_callbacks(): jtag event: JTAG controller reset(tms or TRST)
Debug:   27 39 jtag.c:1289 jtag_reset_callback(): -
Debug:   28 39 jtag.c:326 jtag_call_event_callbacks(): jtag event: JTAG controller reset(tms or TRST)
Debug:   29 39 jtag.c:1289 jtag_reset_callback(): -
Info:    30 47 jtag.c:1383 jtag_examine_chain(): JTAG device found: 0x3f0f0f0f (Manufacturer: 0x787, Part: 0xf0f0, Version: 0x3)
Debug:   31 47 jtag.c:326 jtag_call_event_callbacks(): jtag event: JTAG controller reset(tms or TRST)
Debug:   32 47 jtag.c:1289 jtag_reset_callback(): -
Debug:   33 47 openocd.c:116 handle_init_command(): jtag init complete
Debug:   34 51 openocd.c:119 handle_init_command(): jtag examine complete
Debug:   35 51 openocd.c:126 handle_init_command(): flash init complete
Debug:   36 51 openocd.c:130 handle_init_command(): NAND init complete
Debug:   37 51 openocd.c:134 handle_init_command(): pld init complete
Debug:   38 51 gdb_server.c:2036 gdb_init(): gdb service for target arm7tdmi at port 3333
Warning: 39 103 arm7_9_common.c:692 arm7_9_poll(): DBGACK set while target was in unknown state. Reset or initialize target.
Debug:   40 103 embeddedice.c:397 embeddedice_write_reg(): 0: 0x00000005
Debug:   41 103 embeddedice.c:397 embeddedice_write_reg(): 12: 0x00000000
Debug:   42 105 arm7_9_common.c:1036 arm7_9_debug_entry(): target entered debug from ARM state
Debug:   43 123 arm7_9_common.c:1068 arm7_9_debug_entry(): target entered debug state in System mode
Debug:   44 123 arm7_9_common.c:1097 arm7_9_debug_entry(): r0: 0x200000df
Debug:   45 124 arm7_9_common.c:1097 arm7_9_debug_entry(): r1: 0x0001d3f8
Debug:   46 124 arm7_9_common.c:1097 arm7_9_debug_entry(): r2: 0x00000800
Debug:   47 124 arm7_9_common.c:1097 arm7_9_debug_entry(): r3: 0x00000400
Debug:   48 124 arm7_9_common.c:1097 arm7_9_debug_entry(): r4: 0x00000200
Debug:   49 124 arm7_9_common.c:1097 arm7_9_debug_entry(): r5: 0x00000100
Debug:   50 124 arm7_9_common.c:1097 arm7_9_debug_entry(): r6: 0x00000080
Debug:   51 124 arm7_9_common.c:1097 arm7_9_debug_entry(): r7: 0x00000040
Debug:   52 124 arm7_9_common.c:1097 arm7_9_debug_entry(): r8: 0x00000020
Debug:   53 124 arm7_9_common.c:1097 arm7_9_debug_entry(): r9: 0xdaffffef
Debug:   54 124 arm7_9_common.c:1097 arm7_9_debug_entry(): r10: 0xe3a03102
Debug:   55 124 arm7_9_common.c:1097 arm7_9_debug_entry(): r11: 0xe1a039c3
Debug:   56 124 arm7_9_common.c:1097 arm7_9_debug_entry(): r12: 0xe59f2010
Debug:   57 124 arm7_9_common.c:1097 arm7_9_debug_entry(): r13: 0xe5832134
Debug:   58 124 arm7_9_common.c:1097 arm7_9_debug_entry(): r14: 0xe28dd008
Debug:   59 124 arm7_9_common.c:1097 arm7_9_debug_entry(): r15: 0x00001830
Debug:   60 124 arm7_9_common.c:1103 arm7_9_debug_entry(): entered debug state at PC 0x1830
Debug:   61 128 target.c:723 target_call_event_callbacks(): target event 0
Info:    62 22868 server.c:78 add_connection(): accepting 'gdb' connection from 0
Debug:   63 22868 arm7_9_common.c:926 arm7_9_halt(): target->state: halted
Debug:   64 22868 arm7_9_common.c:930 arm7_9_halt(): target was already halted
Debug:   65 22870 gdb_server.c:1878 gdb_input_inner(): received packet: 'qSupported'
Warning: 66 22870 gdb_server.c:416 gdb_get_packet_inner(): acknowledgment received, but no packet pending
Debug:   67 22870 gdb_server.c:1878 gdb_input_inner(): received packet: 'Hc-1'
Debug:   68 22872 gdb_server.c:1878 gdb_input_inner(): received packet: 'qC'
Debug:   69 22872 gdb_server.c:1878 gdb_input_inner(): received packet: 'qOffsets'
Debug:   70 22872 gdb_server.c:1878 gdb_input_inner(): received packet: '?'
Debug:   71 22872 gdb_server.c:1878 gdb_input_inner(): received packet: 'Hg0'
Debug:   72 22872 gdb_server.c:1878 gdb_input_inner(): received packet: 'g'
Debug:   73 22872 gdb_server.c:1878 gdb_input_inner(): received packet: 'qXfer:memory-map:read::0,fff'
Debug:   74 22872 arm7_9_common.c:1764 arm7_9_read_memory(): address: 0xfffff240, size: 0x00000004, count: 0x00000001
Debug:   75 22888 target.c:1149 target_read_u32(): address: 0xfffff240, value: 0x270d0940
Debug:   76 22888 at91sam7.c:366 at91sam7_read_part_info(): nvptyp: 0x002, arch: 0x0070
Debug:   77 22888 arm7_9_common.c:1764 arm7_9_read_memory(): address: 0xfffffc24, size: 0x00000004, count: 0x00000001
Debug:   78 22903 target.c:1149 target_read_u32(): address: 0xfffffc24, value: 0x000128af
Debug:   79 22903 arm7_9_common.c:1764 arm7_9_read_memory(): address: 0xfffffc30, size: 0x00000004, count: 0x00000001
Debug:   80 22922 target.c:1149 target_read_u32(): address: 0xfffffc30, value: 0x00000003
Debug:   81 22922 arm7_9_common.c:1764 arm7_9_read_memory(): address: 0xfffffc2c, size: 0x00000004, count: 0x00000001
Debug:   82 22937 target.c:1149 target_read_u32(): address: 0xfffffc2c, value: 0x001a3f0a
Debug:   83 22937 arm7_9_common.c:1764 arm7_9_read_memory(): address: 0xfffffc2c, size: 0x00000004, count: 0x00000001
Debug:   84 22952 target.c:1149 target_read_u32(): address: 0xfffffc2c, value: 0x001a3f0a
Debug:   85 22952 arm7_9_common.c:1764 arm7_9_read_memory(): address: 0xffffff68, size: 0x00000004, count: 0x00000001
Debug:   86 22967 target.c:1149 target_read_u32(): address: 0xffffff68, value: 0x00030001
Debug:   87 22967 arm7_9_common.c:1764 arm7_9_read_memory(): address: 0xffffff68, size: 0x00000004, count: 0x00000001
Debug:   88 22984 target.c:1149 target_read_u32(): address: 0xffffff68, value: 0x00030001
Debug:   89 22984 gdb_server.c:1878 gdb_input_inner(): received packet: 'm20,8'
Debug:   90 22984 gdb_server.c:1063 gdb_read_memory_packet(): addr: 0x00000020, len: 0x00000008
Debug:   91 22984 target.c:1044 target_read_buffer(): reading buffer of 8 byte at 0x00000020
Debug:   92 22984 arm7_9_common.c:1764 arm7_9_read_memory(): address: 0x00000020, size: 0x00000004, count: 0x00000002
Debug:   93 23001 gdb_server.c:1878 gdb_input_inner(): received packet: 'm20,7'
Debug:   94 23001 gdb_server.c:1063 gdb_read_memory_packet(): addr: 0x00000020, len: 0x00000007
Debug:   95 23001 target.c:1044 target_read_buffer(): reading buffer of 7 byte at 0x00000020
Debug:   96 23001 arm7_9_common.c:1764 arm7_9_read_memory(): address: 0x00000020, size: 0x00000004, count: 0x00000001
Debug:   97 23016 arm7_9_common.c:1764 arm7_9_read_memory(): address: 0x00000024, size: 0x00000001, count: 0x00000003
Debug:   98 23044 gdb_server.c:1878 gdb_input_inner(): received packet: 'qSymbol::'
Debug:   99 25866 gdb_server.c:1878 gdb_input_inner(): received packet: 'X200000,0:'
Debug:   100 25867 gdb_server.c:1878 gdb_input_inner(): received packet: 'X200000,550:'
Debug:   101 25867 gdb_server.c:1198 gdb_write_memory_binary_packet(): addr: 0x00200000, len: 0x00000550
Debug:   102 25867 target.c:975 target_write_buffer(): writing buffer of 1360 byte at 0x00200000
Debug:   103 25867 embeddedice.c:397 embeddedice_write_reg(): 0: 0x00000004
Debug:   104 26287 embeddedice.c:397 embeddedice_write_reg(): 0: 0x00000005
Debug:   105 26298 gdb_server.c:1878 gdb_input_inner(): received packet: 'X200550,20:'
Debug:   106 26298 gdb_server.c:1198 gdb_write_memory_binary_packet(): addr: 0x00200550, len: 0x00000020
Debug:   107 26298 target.c:975 target_write_buffer(): writing buffer of 32 byte at 0x00200550
Debug:   108 26298 embeddedice.c:397 embeddedice_write_reg(): 0: 0x00000004
Debug:   109 26316 embeddedice.c:397 embeddedice_write_reg(): 0: 0x00000005
Debug:   110 26325 gdb_server.c:1878 gdb_input_inner(): received packet: 'X200570,4:øÓ'
Debug:   111 26325 gdb_server.c:1198 gdb_write_memory_binary_packet(): addr: 0x00200570, len: 0x00000004
Debug:   112 26325 target.c:975 target_write_buffer(): writing buffer of 4 byte at 0x00200570
Debug:   113 26325 embeddedice.c:397 embeddedice_write_reg(): 0: 0x00000004
Debug:   114 26339 embeddedice.c:397 embeddedice_write_reg(): 0: 0x00000005
Debug:   115 26348 gdb_server.c:1878 gdb_input_inner(): received packet: 'P8=00002000'
Debug:   116 26348 gdb_server.c:961 gdb_set_register_packet(): -
Debug:   117 26349 gdb_server.c:1878 gdb_input_inner(): received packet: 'P29=ffffffff'
Debug:   118 26349 gdb_server.c:961 gdb_set_register_packet(): -
Error:   119 26349 gdb_server.c:970 gdb_set_register_packet(): gdb requested a non-existing register
Info:    120 26352 server.c:395 server_loop(): dropped 'gdb' connection

The final line

server.c:395 server_loop(): dropped 'gdb' connection

happens once it has loaded the file.

I am guessing (hoping) I have made some simple mistake somewhere.

I will greatly appreciate any help.

Cheers

-John

I get this same error, if anyone can make sense of it.

Does a packet error mean between GDB and OpenOCD, or between OpenOCD and the target?

-R

you are trying to access a non-existent arm register.

Debug: 117 26349 gdb_server.c:1878 gdb_input_inner(): received packet: ‘P29=ffffffff’

Are you sure your gdb is configured for arm and not i386?

Cheers

Spen