I found some configuration provided on the web, they are for the older version of OpenOCD. I’m using the very latest version of SVN.
My current configuration is:
#daemon configuration
telnet_port 4444
gdb_port 3333
#interface
interface jlink
jtag_speed 0
#use combined on interfaces or targets that can't set TRST/SRST separately
reset_config trst_only
#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 reset
#target
#target arm7tdmi
target arm7tdmi little run_and_init 0 arm7tdmi-s_r4
run_and_halt_time 0 30
working_area 0 0x40000000 0x4000 nobackup
flash bank lpc2000 0x0 0x7D000 0 0 0 lpc2000_v2 12000 calc_checksum
Is that OK?
How to configure reset_config if SRST is not connected, only TRST is available?
My target runs on 11.0592MHz quartz.
Any My JTAG speed is about 350KHz.
OpenOCD initialized OK, but when I telnet to it and send “mdw 0x00000000 1”:
Debug: 4 5 command.c:430 command_run_line(): script openocd_lpc2138.cfg
Debug: 5 5 configuration.c:87 open_file_from_path(): opened openocd_lpc2138.cfg
Debug: 6 5 command.c:430 command_run_line(): telnet_port 4444
Debug: 7 5 command.c:430 command_run_line(): gdb_port 3333
Debug: 8 5 command.c:430 command_run_line(): interface jlink
Debug: 9 5 command.c:430 command_run_line(): jtag_speed 0
Debug: 10 6 jtag.c:1863 handle_jtag_speed_command(): handle jtag speed
Info: 11 6 options.c:50 configuration_output_handler(): jtag_speed: 0, 0
Debug: 12 6 command.c:430 command_run_line(): reset_config trst_only
Debug: 13 6 command.c:430 command_run_line(): jtag_device 4 0x1 0xf 0xe
Debug: 14 6 command.c:430 command_run_line(): daemon_startup reset
Info: 15 6 options.c:50 configuration_output_handler(): Open On-Chip Debugger 1.0 (2008-06-04-19:24) svn:702M
Debug: 16 6 command.c:430 command_run_line(): target arm7tdmi little run_and_halt 0 arm7tdmi-s_r4
Debug: 17 6 command.c:430 command_run_line(): run_and_halt_time 0 30
Debug: 18 6 command.c:430 command_run_line(): working_area 0 0x40000000 0x40000 nobackup
Debug: 19 6 command.c:430 command_run_line(): flash bank lpc2000 0x0 0x7D000 0 0 0 lpc2000_v2 12000 calc_checksum
Debug: 20 6 command.c:430 command_run_line(): init
Debug: 21 7 openocd.c:102 handle_init_command(): target init complete
Info: 22 268 jlink.c:530 jlink_get_version_info(): o-link by Simon
Info: 23 271 jlink.c:498 jlink_get_status(): Vref = 5.0 TCK=0 TDI=1 TDO=0 TMS=1 SRST=0 TRST=0
Info: 24 271 jlink.c:319 jlink_init(): J-Link JTAG Interface ready
Debug: 25 271 jlink.c:448 jlink_reset(): trst: 0, srst: 0
Debug: 26 274 openocd.c:109 handle_init_command(): jtag interface init complete
Debug: 27 274 jtag.c:1537 jtag_init_inner(): Init JTAG chain
Debug: 28 274 jtag.c:326 jtag_call_event_callbacks(): jtag event: JTAG controller reset(tms or TRST)
Debug: 29 274 jtag.c:1295 jtag_reset_callback(): -
Debug: 30 278 jtag.c:326 jtag_call_event_callbacks(): jtag event: JTAG controller reset(tms or TRST)
Debug: 31 278 jtag.c:1295 jtag_reset_callback(): -
Info: 32 281 jtag.c:1389 jtag_examine_chain(): JTAG device found: 0x4f1f0f0f (Manufacturer: 0x787, Part: 0xf1f0, Version: 0x4)
Debug: 33 281 jtag.c:326 jtag_call_event_callbacks(): jtag event: JTAG controller reset(tms or TRST)
Debug: 34 281 jtag.c:1295 jtag_reset_callback(): -
Debug: 35 284 openocd.c:116 handle_init_command(): jtag init complete
Debug: 36 290 embeddedice.c:397 embeddedice_write_reg(): 0: 0x00000000
Debug: 37 292 openocd.c:119 handle_init_command(): jtag examine complete
Debug: 38 292 openocd.c:126 handle_init_command(): flash init complete
Debug: 39 292 openocd.c:130 handle_init_command(): NAND init complete
Debug: 40 292 openocd.c:134 handle_init_command(): pld init complete
Debug: 41 300 gdb_server.c:2036 gdb_init(): gdb service for target arm7tdmi at port 3333
Debug: 42 300 command.c:430 command_run_line(): reset
Debug: 43 301 target.c:1851 handle_reset_command(): -
Debug: 44 301 jtag.c:1581 jtag_init_reset(): Trying to bring the JTAG controller to life by asserting TRST / tms
Debug: 45 301 jtag.c:996 jtag_add_reset(): SRST line released
Debug: 46 301 jtag.c:1015 jtag_add_reset(): TRST line asserted
Debug: 47 302 jtag.c:326 jtag_call_event_callbacks(): jtag event: JTAG controller reset(tms or TRST)
Debug: 48 302 jtag.c:1295 jtag_reset_callback(): -
Debug: 49 302 jtag.c:996 jtag_add_reset(): SRST line released
Debug: 50 302 jlink.c:448 jlink_reset(): trst: 1, srst: 0
Debug: 51 305 jlink.c:448 jlink_reset(): trst: 0, srst: 0
Debug: 52 310 jtag.c:1537 jtag_init_inner(): Init JTAG chain
Debug: 53 314 jtag.c:326 jtag_call_event_callbacks(): jtag event: JTAG controller reset(tms or TRST)
Debug: 54 314 jtag.c:1295 jtag_reset_callback(): -
Info: 55 317 jtag.c:1389 jtag_examine_chain(): JTAG device found: 0x4f1f0f0f (Manufacturer: 0x787, Part: 0xf1f0, Version: 0x4)
Debug: 56 317 jtag.c:326 jtag_call_event_callbacks(): jtag event: JTAG controller reset(tms or TRST)
Debug: 57 317 jtag.c:1295 jtag_reset_callback(): -
Debug: 58 323 embeddedice.c:397 embeddedice_write_reg(): 0: 0x00000000
Debug: 59 326 arm7_9_common.c:759 arm7_9_assert_reset(): target->state: unknown
Error: 60 326 arm7_9_common.c:763 arm7_9_assert_reset(): Can't assert SRST
Debug: 61 326 arm7_9_common.c:812 arm7_9_deassert_reset(): target->state: unknown
Debug: 62 326 jtag.c:996 jtag_add_reset(): SRST line released
Debug: 63 326 jlink.c:448 jlink_reset(): trst: 0, srst: 0
Debug: 64 329 target.c:411 target_process_reset(): Waiting for halted stated as approperiate
Debug: 65 333 target.c:425 target_process_reset(): Polling target
Debug: 67 845 arm7_9_common.c:952 arm7_9_halt(): target->state: running
Debug: 68 846 embeddedice.c:397 embeddedice_write_reg(): 9: 0xffffffff
Debug: 69 846 embeddedice.c:397 embeddedice_write_reg(): 11: 0xffffffff
Debug: 70 846 embeddedice.c:397 embeddedice_write_reg(): 12: 0x00000100
Debug: 71 846 embeddedice.c:397 embeddedice_write_reg(): 13: 0x000000f7
Debug: 72 846 target.c:425 target_process_reset(): Polling target
Debug: 73 849 embeddedice.c:397 embeddedice_write_reg(): 0: 0x00000005
Debug: 74 849 embeddedice.c:397 embeddedice_write_reg(): 12: 0x00000000
Debug: 75 852 arm7_9_common.c:1062 arm7_9_debug_entry(): target entered debug from ARM state
Debug: 76 857 arm7_9_common.c:1094 arm7_9_debug_entry(): target entered debug state in System mode
Debug: 77 857 arm7_9_common.c:1125 arm7_9_debug_entry(): r0: 0x000000a3
Debug: 78 857 arm7_9_common.c:1125 arm7_9_debug_entry(): r1: 0x40001f64
Debug: 79 857 arm7_9_common.c:1125 arm7_9_debug_entry(): r2: 0x000014bc
Debug: 80 857 arm7_9_common.c:1125 arm7_9_debug_entry(): r3: 0xfefefeff
Debug: 81 857 arm7_9_common.c:1125 arm7_9_debug_entry(): r4: 0x00000000
Debug: 82 857 arm7_9_common.c:1125 arm7_9_debug_entry(): r5: 0x40001f60
Debug: 83 857 arm7_9_common.c:1125 arm7_9_debug_entry(): r6: 0x40001f2c
Debug: 84 857 arm7_9_common.c:1125 arm7_9_debug_entry(): r7: 0x000006e8
Debug: 85 857 arm7_9_common.c:1125 arm7_9_debug_entry(): r8: 0x0000000d
Debug: 86 857 arm7_9_common.c:1125 arm7_9_debug_entry(): r9: 0x00800000
Debug: 87 857 arm7_9_common.c:1125 arm7_9_debug_entry(): r10: 0x00000064
Debug: 88 857 arm7_9_common.c:1125 arm7_9_debug_entry(): r11: 0x00000000
Debug: 89 857 arm7_9_common.c:1125 arm7_9_debug_entry(): r12: 0x00000f51
Debug: 90 857 arm7_9_common.c:1125 arm7_9_debug_entry(): r13: 0x40001ef0
Debug: 91 857 arm7_9_common.c:1125 arm7_9_debug_entry(): r14: 0x000007c8
Debug: 92 857 arm7_9_common.c:1125 arm7_9_debug_entry(): r15: 0x000014bc
Debug: 93 858 arm7_9_common.c:1131 arm7_9_debug_entry(): entered debug state at PC 0x14bc
Debug: 94 858 target.c:724 target_call_event_callbacks(): target event 0
Info: 95 3932 server.c:78 add_connection(): accepting 'telnet' connection from 0
Debug: 96 12230 command.c:430 command_run_line(): mdw 0x00000000 1
Debug: 97 12230 arm7_9_common.c:1809 arm7_9_read_memory(): address: 0x00000000, size: 0x00000004, count: 0x00000001
Error: 98 17382 arm7_9_common.c:577 arm7_9_execute_sys_speed(): timeout waiting for SYSCOMP & DBGACK, last DBG_STATUS: 0
My tool is tested OK on STM32 target.
No one can help?
I tested the svn 706 and it works, but…
Open On-Chip Debugger
> halt
> mdw 0 8
0x00000000: e59ff018 e59ff018 e59ff018 e59ff018 e59ff018 b9205f80 e51ffff0 e59ff018
> mdw 0 8
0x00000000: e59ff018 e59ff018 e59ff018 e59ff018 e59ff018 b9205f80 e51ffff0 e59ff018
> mdw 0 1
0x00000000: e59ff018
> mdw 0 16
timeout waiting for SYSCOMP & DBGACK, last DBG_STATUS: 0
timeout waiting for SYSCOMP & DBGACK, last DBG_STATUS: 0
0x00000000: 00400000 00000000 40001f64 00000000 00000000 00000000 00000000 00000000
0x00000020: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
>
I do can read the flash from address 0, and verify the data read is OK, but not every time.
And the log file:
Debug: 4 5 command.c:430 command_run_line(): script openocd_lpc2138.cfg
Debug: 5 5 configuration.c:87 open_file_from_path(): opened openocd_lpc2138.cfg
Debug: 6 5 command.c:430 command_run_line(): telnet_port 4444
Debug: 7 5 command.c:430 command_run_line(): gdb_port 3333
Debug: 8 5 command.c:430 command_run_line(): interface jlink
Debug: 9 5 command.c:430 command_run_line(): jtag_speed 0
Debug: 10 5 jtag.c:1863 handle_jtag_speed_command(): handle jtag speed
Info: 11 5 options.c:50 configuration_output_handler(): jtag_speed: 0, 0
Debug: 12 6 command.c:430 command_run_line(): reset_config trst_and_srst separate
Debug: 13 6 command.c:430 command_run_line(): jtag_device 4 0x1 0xf 0xe
Debug: 14 6 command.c:430 command_run_line(): daemon_startup reset
Info: 15 6 options.c:50 configuration_output_handler(): Open On-Chip Debugger 1.0 (2008-06-06-20:50) svn:706M
Debug: 16 6 command.c:430 command_run_line(): target arm7tdmi little run_and_init 0 arm7tdmi-s_r4
Debug: 17 6 command.c:430 command_run_line(): run_and_halt_time 0 200
Debug: 18 6 command.c:430 command_run_line(): working_area 0 0x40000000 0x4000 nobackup
Debug: 19 6 command.c:430 command_run_line(): flash bank lpc2000 0x0 0x7D000 0 0 0 lpc2000_v2 11059 calc_checksum
Debug: 20 6 command.c:430 command_run_line(): init
Debug: 21 6 openocd.c:102 handle_init_command(): target init complete
Info: 22 266 jlink.c:525 jlink_get_version_info(): o-link by Simon
Info: 23 269 jlink.c:493 jlink_get_status(): Vref = 5.0 TCK=0 TDI=1 TDO=0 TMS=1 SRST=0 TRST=0
Info: 24 269 jlink.c:314 jlink_init(): J-Link JTAG Interface ready
Debug: 25 269 jlink.c:443 jlink_reset(): trst: 0, srst: 0
Debug: 26 272 openocd.c:109 handle_init_command(): jtag interface init complete
Debug: 27 272 jtag.c:1537 jtag_init_inner(): Init JTAG chain
Debug: 28 272 jtag.c:326 jtag_call_event_callbacks(): jtag event: JTAG controller reset(tms or TRST)
Debug: 29 272 jtag.c:1295 jtag_reset_callback(): -
Debug: 30 276 jtag.c:326 jtag_call_event_callbacks(): jtag event: JTAG controller reset(tms or TRST)
Debug: 31 277 jtag.c:1295 jtag_reset_callback(): -
Error: 32 280 jtag.c:1351 jtag_examine_chain(): JTAG communication failure, check connection, JTAG interface, target power etc.
Error: 33 280 jtag.c:1556 jtag_init_inner(): trying to validate configured JTAG chain anyway...
Debug: 34 280 jtag.c:326 jtag_call_event_callbacks(): jtag event: JTAG controller reset(tms or TRST)
Debug: 35 280 jtag.c:1295 jtag_reset_callback(): -
Debug: 36 283 openocd.c:116 handle_init_command(): jtag init complete
Error: 37 286 embeddedice.c:191 embeddedice_build_reg_cache(): unknown EmbeddedICE version (comms ctrl: 0x00000000)
Debug: 38 286 openocd.c:119 handle_init_command(): jtag examine complete
Debug: 39 286 openocd.c:126 handle_init_command(): flash init complete
Debug: 40 286 openocd.c:130 handle_init_command(): NAND init complete
Debug: 41 286 openocd.c:134 handle_init_command(): pld init complete
Debug: 42 294 gdb_server.c:2036 gdb_init(): gdb service for target arm7tdmi at port 3333
Debug: 43 294 command.c:430 command_run_line(): reset
Debug: 44 294 target.c:1851 handle_reset_command(): -
Debug: 45 295 jtag.c:1581 jtag_init_reset(): Trying to bring the JTAG controller to life by asserting TRST / tms
Debug: 46 295 jtag.c:996 jtag_add_reset(): SRST line released
Debug: 47 295 jtag.c:1015 jtag_add_reset(): TRST line asserted
Debug: 48 295 jtag.c:326 jtag_call_event_callbacks(): jtag event: JTAG controller reset(tms or TRST)
Debug: 49 295 jtag.c:1295 jtag_reset_callback(): -
Debug: 50 295 jtag.c:992 jtag_add_reset(): SRST line asserted
Debug: 51 295 jtag.c:1015 jtag_add_reset(): TRST line asserted
Debug: 52 295 jtag.c:326 jtag_call_event_callbacks(): jtag event: JTAG controller reset(tms or TRST)
Debug: 53 295 jtag.c:1295 jtag_reset_callback(): -
Debug: 54 295 jtag.c:992 jtag_add_reset(): SRST line asserted
Debug: 55 295 jtag.c:996 jtag_add_reset(): SRST line released
Debug: 56 295 jlink.c:443 jlink_reset(): trst: 1, srst: 0
Debug: 57 299 jlink.c:443 jlink_reset(): trst: 1, srst: 1
Debug: 58 303 jlink.c:443 jlink_reset(): trst: 0, srst: 1
Debug: 59 307 jlink.c:443 jlink_reset(): trst: 0, srst: 0
Debug: 60 311 jtag.c:1537 jtag_init_inner(): Init JTAG chain
Debug: 61 315 jtag.c:326 jtag_call_event_callbacks(): jtag event: JTAG controller reset(tms or TRST)
Debug: 62 315 jtag.c:1295 jtag_reset_callback(): -
Error: 63 319 jtag.c:1351 jtag_examine_chain(): JTAG communication failure, check connection, JTAG interface, target power etc.
Error: 64 319 jtag.c:1556 jtag_init_inner(): trying to validate configured JTAG chain anyway...
Debug: 65 319 jtag.c:326 jtag_call_event_callbacks(): jtag event: JTAG controller reset(tms or TRST)
Debug: 66 319 jtag.c:1295 jtag_reset_callback(): -
Debug: 67 322 arm7_9_common.c:767 arm7_9_assert_reset(): target->state: unknown
Debug: 68 322 jtag.c:992 jtag_add_reset(): SRST line asserted
Debug: 69 322 jlink.c:443 jlink_reset(): trst: 0, srst: 1
Debug: 70 383 arm7_9_common.c:820 arm7_9_deassert_reset(): target->state: reset
Debug: 71 383 jtag.c:996 jtag_add_reset(): SRST line released
Debug: 72 383 jlink.c:443 jlink_reset(): trst: 0, srst: 0
Debug: 73 386 target.c:411 target_process_reset(): Waiting for halted stated as approperiate
Debug: 74 390 target.c:425 target_process_reset(): Polling target
Debug: 76 895 embeddedice.c:397 embeddedice_write_reg(): 0: 0x00000005
Debug: 77 895 embeddedice.c:397 embeddedice_write_reg(): 12: 0x00000000
Debug: 78 902 arm7_9_common.c:1074 arm7_9_debug_entry(): target entered debug from ARM state
Error: 79 907 armv4_5.h:114 armv4_5_mode_to_number(): invalid mode value encountered
Error: 80 907 arm7_9_common.c:1102 arm7_9_debug_entry(): cpsr contains invalid mode value - communication failure
Debug: 81 907 arm7_9_common.c:960 arm7_9_halt(): target->state: unknown
Warning: 82 907 arm7_9_common.c:970 arm7_9_halt(): target was in unknown state when halt was requested
Debug: 83 907 embeddedice.c:397 embeddedice_write_reg(): 9: 0xffffffff
Debug: 84 907 embeddedice.c:397 embeddedice_write_reg(): 11: 0xffffffff
Debug: 85 907 embeddedice.c:397 embeddedice_write_reg(): 12: 0x00000100
Debug: 86 907 embeddedice.c:397 embeddedice_write_reg(): 13: 0x000000f7
Debug: 87 907 target.c:425 target_process_reset(): Polling target
Warning: 88 910 arm7_9_common.c:700 arm7_9_poll(): DBGACK set while target was in unknown state. Reset or initialize target.
Debug: 89 910 embeddedice.c:397 embeddedice_write_reg(): 0: 0x00000005
Debug: 90 910 embeddedice.c:397 embeddedice_write_reg(): 12: 0x00000000
Debug: 91 913 arm7_9_common.c:1074 arm7_9_debug_entry(): target entered debug from ARM state
Debug: 92 917 arm7_9_common.c:1106 arm7_9_debug_entry(): target entered debug state in Abort mode
Debug: 93 917 arm7_9_common.c:1137 arm7_9_debug_entry(): r0: 0x800000d7
Debug: 94 917 arm7_9_common.c:1137 arm7_9_debug_entry(): r1: 0x00007fdd
Debug: 95 917 arm7_9_common.c:1137 arm7_9_debug_entry(): r2: 0x00000000
Debug: 96 917 arm7_9_common.c:1137 arm7_9_debug_entry(): r3: 0x00000001
Debug: 97 917 arm7_9_common.c:1137 arm7_9_debug_entry(): r4: 0x00000000
Debug: 98 917 arm7_9_common.c:1137 arm7_9_debug_entry(): r5: 0xe0028000
Debug: 99 917 arm7_9_common.c:1137 arm7_9_debug_entry(): r6: 0x00040000
Debug: 100 917 arm7_9_common.c:1137 arm7_9_debug_entry(): r7: 0x00000000
Debug: 101 917 arm7_9_common.c:1137 arm7_9_debug_entry(): r8: 0x00000000
Debug: 102 917 arm7_9_common.c:1137 arm7_9_debug_entry(): r9: 0x00800000
Debug: 103 917 arm7_9_common.c:1137 arm7_9_debug_entry(): r10: 0x03fc0000
Debug: 104 917 arm7_9_common.c:1137 arm7_9_debug_entry(): r11: 0x00000000
Debug: 105 918 arm7_9_common.c:1137 arm7_9_debug_entry(): r12: 0xffffbfdd
Debug: 106 918 arm7_9_common.c:1137 arm7_9_debug_entry(): r13: 0x40000584
Debug: 107 918 arm7_9_common.c:1137 arm7_9_debug_entry(): r14: 0x00000018
Debug: 108 918 arm7_9_common.c:1137 arm7_9_debug_entry(): r15: 0x000620e8
Debug: 109 918 arm7_9_common.c:1143 arm7_9_debug_entry(): entered debug state at PC 0x620e8
Debug: 110 921 target.c:724 target_call_event_callbacks(): target event 0
Info: 111 6270 server.c:78 add_connection(): accepting 'telnet' connection from 0
Debug: 112 11665 command.c:430 command_run_line(): halt
Debug: 113 11665 target.c:1823 handle_halt_command(): -
Debug: 114 11665 arm7_9_common.c:960 arm7_9_halt(): target->state: halted
Debug: 115 11665 arm7_9_common.c:964 arm7_9_halt(): target was already halted
Debug: 116 14799 command.c:430 command_run_line(): mdw 0 16
Debug: 117 14800 arm7_9_common.c:1825 arm7_9_read_memory(): address: 0x00000000, size: 0x00000004, count: 0x00000010
Debug: 118 20232 command.c:430 command_run_line(): mdw 0 1
Debug: 119 20232 arm7_9_common.c:1825 arm7_9_read_memory(): address: 0x00000000, size: 0x00000004, count: 0x00000001
Error: 120 25387 arm7_9_common.c:581 arm7_9_execute_sys_speed(): timeout waiting for SYSCOMP & DBGACK, last DBG_STATUS: 0
Debug: 121 31855 command.c:430 command_run_line(): shutdown
Info: 122 31855 server.c:395 server_loop(): dropped 'telnet' connection