Has anybody gotten OpenOCD to work with an Atmel AT91SAM9G20?

I found a thread from about 6 months ago that indicated it was
partially working with an Amontek JTAG interface, but there
were problems and the thread contained no indication that the
problems had ever been resolved.

I'm trying to use an Olimex tiny with the 'G20 and I'm having
little luck.  The Olimex interface worked fine with an Atmel
ATRM9200, so I know the hardware is OK and openocd/libftdi both
work.

If I attempt to connect to a the board (an Atmel AT92SAM9G20-EK
Rev B eval board), OpenOCD _occasionally_ finds the CPU, but it
usually complains like this:

   Open On-Chip Debugger 0.1.0 (2009-06-29-11:11) Release
   $URL: 
https://kc8...@svn.berlios.de/svnroot/repos/openocd/tags/openocd-0.1.0/src/openocd.c
 $
   jtag_speed: 5
   use of EmbeddedICE dbgrq instead of breakpoint for target halt enabled
   Error: couldn't read the requested number of bytes from FT2232 device (19 < 
81)
   Error: couldn't read from FT2232
   Error: number of discovered devices in JTAG chain (0) doesn't match 
(enabled) configuration (1), total taps: 1
   Error: check the config file and ensure proper JTAG communication 
(connections, speed, ...)
   Error: trying to validate configured JTAG chain anyway...
   Warn : no tcl port specified, using default port 6666

or like this:

   Open On-Chip Debugger 0.1.0 (2009-06-29-11:11) Release
   $URL: 
https://kc8...@svn.berlios.de/svnroot/repos/openocd/tags/openocd-0.1.0/src/openocd.c
 $
   jtag_speed: 5
   use of EmbeddedICE dbgrq instead of breakpoint for target halt enabled
   Info : JTAG tap: at91sam9g20.cpu tap/device found: 0x0792603f (Manufacturer: 
0x01f, Part: 0x7926, Version: 0x0)
   Info : JTAG Tap/device matched
   Warn : no tcl port specified, using default port 6666
   Warn : DBGACK set while target was in unknown state. Reset or initialize 
target.
   
If I cycle power on the board immediately before starting
openocd it will connect sometimes (maybe 20% of the time):

   Open On-Chip Debugger 0.1.0 (2009-06-29-11:11) Release
   $URL: 
https://kc8...@svn.berlios.de/svnroot/repos/openocd/tags/openocd-0.1.0/src/openocd.c
 $
   jtag_speed: 5
   use of EmbeddedICE dbgrq instead of breakpoint for target halt enabled
   Info : JTAG tap: at91sam9g20.cpu tap/device found: 0x0792603f (Manufacturer: 
0x01f, Part: 0x7926, Version: 0x0)
   Info : JTAG Tap/device matched
   Warn : no tcl port specified, using default port 6666

But then when I telnet in, it won't do anything useful.
Attempting to read memory fails with a "device not halted"
message, but the 'halt' command just hangs forever.

I'm now a bit stumped, and would appreciate the loan of a
clue...

The config I'm using was gleaned from various mailing list
postings:

   # REFERENCE:  http://www.olimex.com/dev/arm-usb-tiny.html
   interface ft2232
   ft2232_device_desc "Olimex OpenOCD JTAG TINY"
   ft2232_layout olimex-jtag
   ft2232_vid_pid 0x15ba 0x0004
   
   #daemon configuration
   telnet_port 4444
   gdb_port 3333
   
   set CHIPNAME at91sam9g20
   set ENDIAN little
   set CPUTAPID 0x0792603f
   # chip
   source [find target/at91sam9260.cfg]
   
   jtag_speed 5
   
   $_TARGETNAME configure -event reset-init {
           # at reset chip runs at 32khz
           jtag_khz 8
           mww 0xfffffd08 0xa5000501         # RSTC_MR : enable user reset
           mww 0xfffffd44 0x00008000         # WDT_MR : disable watchdog
           mww 0xfffffc20 0x00004001         # CKGR_MOR : enable the main 
oscillator
           sleep 20                          # wait 20 ms
           mww 0xfffffc30 0x00000001         # PMC_MCKR : switch to main 
oscillator
           sleep 10                          # wait 10 ms
           mww 0xfffffc28 0x2060bf09         # CKGR_PLLAR: Set PLLA Register 
for 198,656MHz
           sleep 20                          # wait 20 ms
           mww 0xfffffc30 0x00000101         # PMC_MCKR : Select prescaler
           sleep 10                          # wait 10 ms
           mww 0xfffffc30 0x00000102         # PMC_MCKR : Clock from PLLA is 
selected
           sleep 10                          # wait 10 ms
           # Now run at anything fast... ie: 10mhz!
           jtag_khz 10000                    # Increase JTAG Speed to 6 MHz
           arm7_9 dcc_downloads enable       # Enable faster DCC downloads
   }
   #this chip has more sram
   # Internal sram2 memory
   $_TARGETNAME configure -work-area-virt 0 -work-area-phys 0x00200000 
-work-area-size 0x1000 -work-area-backup 1
   
   #gdb
   gdb_memory_map enable
   arm7_9 dbgrq enable
   
Here's a debug log for the case that comes closest to working
(where the CPU is identified correctly).  I then telnet in and
issue an "mdb" command and then a "halt" command.  At that
point, openocd hangs and I kill it with Ctrl-C:

# openocd -d3
Open On-Chip Debugger 0.1.0 (2009-06-29-11:11) Release
$URL: 
https://kc8...@svn.berlios.de/svnroot/repos/openocd/tags/openocd-0.1.0/src/openocd.c
 $
User : 5 1 command.c:494 command_run_line(): 
Debug: 6 1 configuration.c:88 find_file(): found openocd.cfg
Debug: 8 1 command.c:91 script_command(): script_command - interface
Debug: 9 1 command.c:108 script_command(): script_command - interface, 
argv[0]=ocd_interface
Debug: 10 1 command.c:108 script_command(): script_command - interface, 
argv[1]=ft2232
Debug: 12 1 command.c:91 script_command(): script_command - ft2232_device_desc
Debug: 13 1 command.c:108 script_command(): script_command - 
ft2232_device_desc, argv[0]=ocd_ft2232_device_desc
Debug: 14 1 command.c:108 script_command(): script_command - 
ft2232_device_desc, argv[1]=Olimex OpenOCD JTAG TINY
Debug: 16 1 command.c:91 script_command(): script_command - ft2232_layout
Debug: 17 1 command.c:108 script_command(): script_command - ft2232_layout, 
argv[0]=ocd_ft2232_layout
Debug: 18 1 command.c:108 script_command(): script_command - ft2232_layout, 
argv[1]=olimex-jtag
Debug: 20 1 command.c:91 script_command(): script_command - ft2232_vid_pid
Debug: 21 1 command.c:108 script_command(): script_command - ft2232_vid_pid, 
argv[0]=ocd_ft2232_vid_pid
Debug: 22 1 command.c:108 script_command(): script_command - ft2232_vid_pid, 
argv[1]=0x15ba
Debug: 23 1 command.c:108 script_command(): script_command - ft2232_vid_pid, 
argv[2]=0x0004
Debug: 25 1 command.c:91 script_command(): script_command - telnet_port
Debug: 26 1 command.c:108 script_command(): script_command - telnet_port, 
argv[0]=ocd_telnet_port
Debug: 27 1 command.c:108 script_command(): script_command - telnet_port, 
argv[1]=4444
Debug: 29 1 command.c:91 script_command(): script_command - gdb_port
Debug: 30 1 command.c:108 script_command(): script_command - gdb_port, 
argv[0]=ocd_gdb_port
Debug: 31 1 command.c:108 script_command(): script_command - gdb_port, 
argv[1]=3333
Debug: 32 1 configuration.c:88 find_file(): found 
/usr/lib/openocd/target/at91sam9260.cfg
Debug: 33 1 configuration.c:88 find_file(): found 
/usr/lib/openocd/target/at91sam9260minimal.cfg
Debug: 35 2 command.c:91 script_command(): script_command - reset_config
Debug: 36 2 command.c:108 script_command(): script_command - reset_config, 
argv[0]=ocd_reset_config
Debug: 37 2 command.c:108 script_command(): script_command - reset_config, 
argv[1]=trst_and_srst
Debug: 38 2 jtag.c:1892 jim_newtap_cmd(): Creating New Tap, Chip: at91sam9g20, 
Tap: cpu, Dotted: at91sam9g20.cpu, 8 params
Debug: 39 2 jtag.c:1911 jim_newtap_cmd(): Processing option: -irlen
Debug: 40 2 jtag.c:1911 jim_newtap_cmd(): Processing option: -ircapture
Debug: 41 2 jtag.c:1911 jim_newtap_cmd(): Processing option: -irmask
Debug: 42 2 jtag.c:1911 jim_newtap_cmd(): Processing option: -expected-id
Debug: 43 2 jtag.c:2024 jim_newtap_cmd(): Created Tap: at91sam9g20.cpu @ abs 
position 0, irlen 4, capture: 0x1 mask: 0xf
Debug: 45 2 command.c:91 script_command(): script_command - jtag_nsrst_delay
Debug: 46 2 command.c:108 script_command(): script_command - jtag_nsrst_delay, 
argv[0]=ocd_jtag_nsrst_delay
Debug: 47 2 command.c:108 script_command(): script_command - jtag_nsrst_delay, 
argv[1]=200
Debug: 49 2 command.c:91 script_command(): script_command - jtag_ntrst_delay
Debug: 50 2 command.c:108 script_command(): script_command - jtag_ntrst_delay, 
argv[0]=ocd_jtag_ntrst_delay
Debug: 51 2 command.c:108 script_command(): script_command - jtag_ntrst_delay, 
argv[1]=200
Debug: 52 2 target.c:3911 jim_target(): Target command params:
Debug: 53 2 target.c:3912 jim_target(): target create at91sam9g20.cpu arm926ejs 
-endian little -chain-position at91sam9g20.cpu -variant arm926ejs 
Debug: 55 2 command.c:91 script_command(): script_command - bank
Debug: 56 2 command.c:108 script_command(): script_command - bank, 
argv[0]=ocd_flash_bank
Debug: 57 2 command.c:108 script_command(): script_command - bank, argv[1]=cfi
Debug: 58 2 command.c:108 script_command(): script_command - bank, 
argv[2]=0x10000000
Debug: 59 2 command.c:108 script_command(): script_command - bank, 
argv[3]=0x01000000
Debug: 60 2 command.c:108 script_command(): script_command - bank, argv[4]=2
Debug: 61 2 command.c:108 script_command(): script_command - bank, argv[5]=2
Debug: 62 2 command.c:108 script_command(): script_command - bank, argv[6]=0
Debug: 64 3 command.c:91 script_command(): script_command - jtag_speed
Debug: 65 3 command.c:108 script_command(): script_command - jtag_speed, 
argv[0]=ocd_jtag_speed
Debug: 66 3 command.c:108 script_command(): script_command - jtag_speed, 
argv[1]=5
Debug: 67 3 jtag.c:2620 handle_jtag_speed_command(): handle jtag speed
User : 68 3 command.c:383 command_print(): jtag_speed: 5
Debug: 70 3 command.c:91 script_command(): script_command - gdb_memory_map
Debug: 71 3 command.c:108 script_command(): script_command - gdb_memory_map, 
argv[0]=ocd_gdb_memory_map
Debug: 72 3 command.c:108 script_command(): script_command - gdb_memory_map, 
argv[1]=enable
Debug: 74 3 command.c:91 script_command(): script_command - dbgrq
Debug: 75 3 command.c:108 script_command(): script_command - dbgrq, 
argv[0]=ocd_arm7_9_dbgrq
Debug: 76 3 command.c:108 script_command(): script_command - dbgrq, 
argv[1]=enable
User : 77 3 command.c:383 command_print(): use of EmbeddedICE dbgrq instead of 
breakpoint for target halt enabled
User : 78 3 command.c:494 command_run_line(): 
Debug: 80 3 command.c:91 script_command(): script_command - init
Debug: 81 3 command.c:108 script_command(): script_command - init, 
argv[0]=ocd_init
Debug: 82 3 openocd.c:144 handle_init_command(): target init complete
Debug: 83 3 ft2232.c:1588 ft2232_init_libftdi(): 'ft2232' interface using 
libftdi with 'olimex-jtag' layout (15ba:0004)
Debug: 84 9 ft2232.c:1630 ft2232_init_libftdi(): current latency timer: 2
Debug: 85 9 ft2232.c:1966 olimex_jtag_init(): 80 08 1b
Debug: 86 9 ft2232.c:2009 olimex_jtag_init(): 82 09 0f
Debug: 87 9 ft2232.c:276 ft2232_speed(): 86 05 00
Debug: 88 10 openocd.c:151 handle_init_command(): jtag interface init complete
Debug: 89 10 jtag.c:2240 jtag_init_inner(): Init JTAG chain
Debug: 90 10 jtag.c:434 jtag_call_event_callbacks(): jtag event: JTAG 
controller reset (RESET or TRST)
Debug: 91 10 jtag.c:1487 jtag_reset_callback(): -
Debug: 92 10 jtag.c:434 jtag_call_event_callbacks(): jtag event: JTAG 
controller reset (RESET or TRST)
Debug: 93 10 jtag.c:1487 jtag_reset_callback(): -
Info : 94 12 jtag.c:1607 jtag_examine_chain(): JTAG tap: at91sam9g20.cpu 
tap/device found: 0x0792603f (Manufacturer: 0x01f, Part: 0x7926, Version: 0x0)
Info : 95 12 jtag.c:1645 jtag_examine_chain(): JTAG Tap/device matched
Debug: 96 12 jtag.c:434 jtag_call_event_callbacks(): jtag event: JTAG 
controller reset (RESET or TRST)
Debug: 97 12 jtag.c:1487 jtag_reset_callback(): -
Debug: 98 16 openocd.c:157 handle_init_command(): jtag init complete
Debug: 99 20 embeddedice.c:401 embeddedice_write_reg(): 0: 0x00000000
Debug: 100 20 embeddedice.c:401 embeddedice_write_reg(): 12: 0x00000000
Debug: 101 20 embeddedice.c:401 embeddedice_write_reg(): 20: 0x00000000
Debug: 102 20 openocd.c:160 handle_init_command(): jtag examine complete
Debug: 103 20 openocd.c:166 handle_init_command(): flash init complete
Debug: 104 20 openocd.c:170 handle_init_command(): mflash init complete
Debug: 105 20 openocd.c:174 handle_init_command(): NAND init complete
Debug: 106 20 openocd.c:178 handle_init_command(): pld init complete
Debug: 107 20 gdb_server.c:2225 gdb_init(): gdb service for target arm926ejs at 
port 3333
Warn : 108 20 tcl_server.c:178 tcl_init(): no tcl port specified, using default 
port 6666
User : 109 20 command.c:494 command_run_line(): 
Info : 110 18110 server.c:89 add_connection(): accepting 'telnet' connection 
from 0
Debug: 112 20448 command.c:91 script_command(): script_command - mdb
Debug: 113 20448 command.c:108 script_command(): script_command - mdb, 
argv[0]=ocd_mdb
Debug: 114 20448 command.c:108 script_command(): script_command - mdb, argv[1]=0
Debug: 115 20448 arm7_9_common.c:1966 arm7_9_read_memory(): address: 
0x00000000, size: 0x00000001, count: 0x00000001
Warn : 116 20448 arm7_9_common.c:1970 arm7_9_read_memory(): target not halted
Debug: 117 20448 command.c:427 run_command(): Command failed with error code 
-304
User : 118 20448 command.c:626 openocd_jim_vfprintf(): Runtime error, file 
"command.c", line 456:
    User : 119 20448 command.c:626 openocd_jim_vfprintf(): 
Debug: 121 21707 command.c:91 script_command(): script_command - halt
Debug: 122 21707 command.c:108 script_command(): script_command - halt, 
argv[0]=ocd_halt
Debug: 123 21707 target.c:1744 handle_halt_command(): -
Debug: 124 21707 arm7_9_common.c:1054 arm7_9_halt(): target->state: running
Debug: 125 21707 embeddedice.c:401 embeddedice_write_reg(): 0: 0x00000002
Debug: 126 21712 embeddedice.c:401 embeddedice_write_reg(): 0: 0x00000005
Debug: 127 21712 embeddedice.c:401 embeddedice_write_reg(): 0: 0x00000005
Debug: 128 21713 arm926ejs.c:343 arm926ejs_examine_debug_reason(): internal 
debug request
Debug: 129 21713 arm7_9_common.c:1153 arm7_9_debug_entry(): target entered 
debug from ARM state
Debug: 130 21720 arm7_9_common.c:1185 arm7_9_debug_entry(): target entered 
debug state in Supervisor mode
Debug: 131 21720 arm7_9_common.c:1216 arm7_9_debug_entry(): r0: 0x00000000
Debug: 132 21720 arm7_9_common.c:1216 arm7_9_debug_entry(): r1: 0x0005317f
Debug: 133 21720 arm7_9_common.c:1216 arm7_9_debug_entry(): r2: 0x0005217f
Debug: 134 21720 arm7_9_common.c:1216 arm7_9_debug_entry(): r3: 0x60000093
Debug: 135 21720 arm7_9_common.c:1216 arm7_9_debug_entry(): r4: 0xc002929c
Debug: 136 21720 arm7_9_common.c:1216 arm7_9_debug_entry(): r5: 0xc02e8000
Debug: 137 21720 arm7_9_common.c:1216 arm7_9_debug_entry(): r6: 0xc02ebe30
Debug: 138 21720 arm7_9_common.c:1216 arm7_9_debug_entry(): r7: 0xc002929c
Debug: 139 21720 arm7_9_common.c:1216 arm7_9_debug_entry(): r8: 0xc0305124
Debug: 140 21720 arm7_9_common.c:1216 arm7_9_debug_entry(): r9: 0x41069265
Debug: 141 21720 arm7_9_common.c:1216 arm7_9_debug_entry(): r10: 0x20021cf4
Debug: 142 21720 arm7_9_common.c:1216 arm7_9_debug_entry(): r11: 0xc02e9f94
Debug: 143 21720 arm7_9_common.c:1216 arm7_9_debug_entry(): r12: 0x600000d3
Debug: 144 21720 arm7_9_common.c:1216 arm7_9_debug_entry(): r13: 0xc02e9f88
Debug: 145 21720 arm7_9_common.c:1216 arm7_9_debug_entry(): r14: 0xc00292e0
Debug: 146 21720 arm7_9_common.c:1216 arm7_9_debug_entry(): r15: 0xc0030824
Debug: 147 21720 arm7_9_common.c:1222 arm7_9_debug_entry(): entered debug state 
at PC 0xc0030824
Debug: 148 21728 arm926ejs.c:477 arm926ejs_post_debug_entry(): 
cp15_control_reg: 0005217f
Debug: 149 21737 arm926ejs.c:498 arm926ejs_post_debug_entry(): D FSR: 
0x00000017, D FAR: 0x00092765, I FSR: 0x00000017
Debug: 150 21744 target.c:696 target_call_event_callbacks(): target event 4 
(early-halted)
^C



Any ideas?

_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to