Here is my current code making an attempt at a STM32F103 over JTAG:
$ openocd -d3 -f interface/cmsis-dap.cfg -c "transport select jtag" -c "adapter_khz 1000" -f target/stm32f1x.cfg
Open On-Chip Debugger 0.11.0
Licensed under GNU GPL v2
For bug reports, read
[url]http://openocd.org/doc/doxygen/bugs.html[/url]
User : 13 6 options.c:63 configuration_output_handler(): debug_level: 3
User : 14 6 options.c:63 configuration_output_handler():
Debug: 15 6 options.c:244 add_default_dirs(): bindir=/usr/local/Cellar/open-ocd/0.11.0/bin
Debug: 16 6 options.c:245 add_default_dirs(): pkgdatadir=/usr/local/Cellar/open-ocd/0.11.0/share/openocd
Debug: 17 6 options.c:246 add_default_dirs(): exepath=/usr/local/Cellar/open-ocd/0.11.0/bin
Debug: 18 6 options.c:247 add_default_dirs(): bin2data=../share/openocd
Debug: 19 6 configuration.c:42 add_script_search_dir(): adding /Users/user/Library/Preferences/org.openocd
Debug: 20 6 configuration.c:42 add_script_search_dir(): adding /Users/user/.config/openocd
Debug: 21 6 configuration.c:42 add_script_search_dir(): adding /Users/user/.openocd
Debug: 22 6 configuration.c:42 add_script_search_dir(): adding /usr/local/Cellar/open-ocd/0.11.0/bin/../share/openocd/site
Debug: 23 6 configuration.c:42 add_script_search_dir(): adding /usr/local/Cellar/open-ocd/0.11.0/bin/../share/openocd/scripts
Debug: 24 7 configuration.c:97 find_file(): found /usr/local/Cellar/open-ocd/0.11.0/bin/../share/openocd/scripts/interface/cmsis-dap.cfg
Debug: 25 7 command.c:146 script_debug(): command - adapter driver cmsis-dap
Debug: 27 8 command.c:146 script_debug(): command - transport select jtag
User : 28 8 options.c:63 configuration_output_handler(): jtagUser : 29 8 options.c:63 configuration_output_handler():
Debug: 30 8 command.c:146 script_debug(): command - echo DEPRECATED! use 'adapter speed' not 'adapter_khz'
User : 32 8 command.c:769 jim_echo(): DEPRECATED! use 'adapter speed' not 'adapter_khz'
Debug: 33 8 command.c:146 script_debug(): command - adapter speed 1000
Debug: 35 8 core.c:1822 jtag_config_khz(): handle jtag khz
Debug: 36 8 core.c:1785 adapter_khz_to_speed(): convert khz to interface specific speed value
Debug: 37 8 core.c:1785 adapter_khz_to_speed(): convert khz to interface specific speed value
User : 38 8 options.c:63 configuration_output_handler(): adapter speed: 1000 kHz
User : 39 8 options.c:63 configuration_output_handler():
Debug: 40 9 configuration.c:97 find_file(): found /usr/local/Cellar/open-ocd/0.11.0/bin/../share/openocd/scripts/target/stm32f1x.cfg
Debug: 41 10 configuration.c:97 find_file(): found /usr/local/Cellar/open-ocd/0.11.0/bin/../share/openocd/scripts/target/swj-dp.tcl
Debug: 42 10 command.c:146 script_debug(): command - transport select
Debug: 43 10 configuration.c:97 find_file(): found /usr/local/Cellar/open-ocd/0.11.0/bin/../share/openocd/scripts/mem_helper.tcl
Debug: 44 11 command.c:146 script_debug(): command - add_usage_text mrw address
Debug: 46 11 command.c:1115 help_add_command(): added 'mrw' help text
Debug: 47 11 command.c:146 script_debug(): command - add_help_text mrw Returns value of word in memory.
Debug: 49 11 command.c:1128 help_add_command(): added 'mrw' help text
Debug: 50 11 command.c:146 script_debug(): command - add_usage_text mrh address
Debug: 52 11 command.c:1115 help_add_command(): added 'mrh' help text
Debug: 53 11 command.c:146 script_debug(): command - add_help_text mrh Returns value of halfword in memory.
Debug: 55 11 command.c:1128 help_add_command(): added 'mrh' help text
Debug: 56 11 command.c:146 script_debug(): command - add_usage_text mrb address
Debug: 58 11 command.c:1115 help_add_command(): added 'mrb' help text
Debug: 59 11 command.c:146 script_debug(): command - add_help_text mrb Returns value of byte in memory.
Debug: 61 11 command.c:1128 help_add_command(): added 'mrb' help text
Debug: 62 11 command.c:146 script_debug(): command - add_usage_text mmw address setbits clearbits
Debug: 64 11 command.c:1115 help_add_command(): added 'mmw' help text
Debug: 65 11 command.c:146 script_debug(): command - add_help_text mmw Modify word in memory. new_val = (old_val & ~clearbits) | setbits;
Debug: 67 11 command.c:1128 help_add_command(): added 'mmw' help text
Debug: 68 11 command.c:146 script_debug(): command - transport select
Debug: 69 11 command.c:146 script_debug(): command - transport select
Debug: 70 11 command.c:146 script_debug(): command - transport select
Debug: 71 11 command.c:146 script_debug(): command - jtag newtap stm32f1x cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id 0x3ba00477
Debug: 72 11 tcl.c:572 jim_newtap_cmd(): Creating New Tap, Chip: stm32f1x, Tap: cpu, Dotted: stm32f1x.cpu, 8 params
Debug: 73 11 tcl.c:596 jim_newtap_cmd(): Processing option: -irlen
Debug: 74 11 tcl.c:596 jim_newtap_cmd(): Processing option: -ircapture
Debug: 75 11 tcl.c:596 jim_newtap_cmd(): Processing option: -irmask
Debug: 76 11 tcl.c:596 jim_newtap_cmd(): Processing option: -expected-id
Debug: 77 11 core.c:1488 jtag_tap_init(): Created Tap: stm32f1x.cpu @ abs position 0, irlen 4, capture: 0x1 mask: 0xf
Debug: 78 11 command.c:146 script_debug(): command - dap create stm32f1x.dap -chain-position stm32f1x.cpu
Debug: 79 11 command.c:146 script_debug(): command - transport select
Debug: 80 11 command.c:146 script_debug(): command - jtag newtap stm32f1x bs -irlen 5
Debug: 81 11 tcl.c:572 jim_newtap_cmd(): Creating New Tap, Chip: stm32f1x, Tap: bs, Dotted: stm32f1x.bs, 2 params
Debug: 82 11 tcl.c:596 jim_newtap_cmd(): Processing option: -irlen
Debug: 83 11 core.c:1488 jtag_tap_init(): Created Tap: stm32f1x.bs @ abs position 1, irlen 5, capture: 0x1 mask: 0x3
Debug: 84 11 command.c:146 script_debug(): command - target create stm32f1x.cpu cortex_m -endian little -dap stm32f1x.dap
Debug: 85 12 command.c:376 register_command(): command 'rtt' is already registered in '<global>' context
Debug: 86 12 command.c:146 script_debug(): command - stm32f1x.cpu configure -work-area-phys 0x20000000 -work-area-size 0x1000 -work-area-backup 0
Debug: 87 12 target.c:2172 target_free_all_working_areas_restore(): freeing all working areas
Debug: 88 12 target.c:2172 target_free_all_working_areas_restore(): freeing all working areas
Debug: 89 12 target.c:2172 target_free_all_working_areas_restore(): freeing all working areas
Debug: 90 12 command.c:146 script_debug(): command - flash bank stm32f1x.flash stm32f1x 0x08000000 0 0 0 stm32f1x.cpu
Debug: 92 13 tcl.c:1319 handle_flash_bank_command(): 'stm32f1x' driver usage field missing
Debug: 93 13 command.c:146 script_debug(): command - adapter speed 1000
Debug: 95 13 core.c:1822 jtag_config_khz(): handle jtag khz
Debug: 96 13 core.c:1785 adapter_khz_to_speed(): convert khz to interface specific speed value
Debug: 97 13 core.c:1785 adapter_khz_to_speed(): convert khz to interface specific speed value
Debug: 98 13 command.c:146 script_debug(): command - adapter srst delay 100
Debug: 100 13 command.c:146 script_debug(): command - transport select
Debug: 101 13 command.c:146 script_debug(): command - jtag_ntrst_delay 100
Debug: 103 13 command.c:146 script_debug(): command - reset_config srst_nogate
Debug: 105 13 command.c:146 script_debug(): command - transport select
Debug: 106 13 command.c:146 script_debug(): command - cortex_m reset_config sysresetreq
Debug: 108 13 command.c:146 script_debug(): command - stm32f1x.cpu configure -event examine-end
# DBGMCU_CR |= DBG_WWDG_STOP | DBG_IWDG_STOP |
# DBG_STANDBY | DBG_STOP | DBG_SLEEP
mmw 0xE0042004 0x00000307 0
Debug: 109 13 command.c:146 script_debug(): command - stm32f1x.cpu configure -event trace-config
# Set TRACE_IOEN; TRACE_MODE is set to async; when using sync
# change this value accordingly to configure trace pins
# assignment
mmw 0xE0042004 0x00000020 0
Info : 110 13 server.c:312 add_service(): Listening on port 6666 for tcl connections
Info : 111 13 server.c:312 add_service(): Listening on port 4444 for telnet connections
Debug: 112 13 command.c:146 script_debug(): command - init
Debug: 114 13 command.c:146 script_debug(): command - target init
Debug: 116 13 command.c:146 script_debug(): command - target names
Debug: 117 13 command.c:146 script_debug(): command - stm32f1x.cpu cget -event gdb-flash-erase-start
Debug: 118 13 command.c:146 script_debug(): command - stm32f1x.cpu configure -event gdb-flash-erase-start reset init
Debug: 119 13 command.c:146 script_debug(): command - stm32f1x.cpu cget -event gdb-flash-write-end
Debug: 120 14 command.c:146 script_debug(): command - stm32f1x.cpu configure -event gdb-flash-write-end reset halt
Debug: 121 14 command.c:146 script_debug(): command - stm32f1x.cpu cget -event gdb-attach
Debug: 122 14 command.c:146 script_debug(): command - stm32f1x.cpu configure -event gdb-attach halt 1000
Debug: 123 14 target.c:1639 handle_target_init_command(): Initializing targets...
Debug: 124 14 semihosting_common.c:99 semihosting_common_init():
Debug: 125 2492 cmsis_dap_usb_bulk.c:157 cmsis_dap_usb_open(): found product string of 0x0002:0xda42 'SushiBits One with CMSIS-DAP'
Debug: 126 2492 cmsis_dap_usb_bulk.c:177 cmsis_dap_usb_open(): enumerating interfaces of 0x0002:0xda42
Debug: 127 2492 cmsis_dap_usb_bulk.c:237 cmsis_dap_usb_open(): skipping interface 0, has only 1 endpoints
Debug: 128 2492 cmsis_dap_usb_bulk.c:285 cmsis_dap_usb_open(): skipping interface 1, class 10 subclass 0 protocol 0
Debug: 129 2492 cmsis_dap_usb_bulk.c:224 cmsis_dap_usb_open(): found interface 2 string 'SushiBits One Embedded CMSIS-DAP'
Debug: 130 2492 cmsis_dap_usb_bulk.c:244 cmsis_dap_usb_open(): skipping interface 2, endpoint[0] is not bulk out
Debug: 131 2658 cmsis_dap_usb_bulk.c:177 cmsis_dap_usb_open(): enumerating interfaces of 0x1a40:0x0101
Debug: 132 2660 cmsis_dap_usb_bulk.c:177 cmsis_dap_usb_open(): enumerating interfaces of 0x0002:0x2812
Debug: 133 2660 cmsis_dap_usb_bulk.c:177 cmsis_dap_usb_open(): enumerating interfaces of 0x03eb:0x2104
Debug: 134 2660 cmsis_dap_usb_bulk.c:177 cmsis_dap_usb_open(): enumerating interfaces of 0x046d:0xc52b
Debug: 135 2661 cmsis_dap_usb_bulk.c:177 cmsis_dap_usb_open(): enumerating interfaces of 0x03f0:0x052a
Debug: 136 2662 cmsis_dap_usb_bulk.c:177 cmsis_dap_usb_open(): enumerating interfaces of 0x04d8:0x9012
Debug: 137 2662 cmsis_dap_usb_bulk.c:177 cmsis_dap_usb_open(): enumerating interfaces of 0x1366:0x0101
Debug: 138 2836 cmsis_dap_usb_bulk.c:177 cmsis_dap_usb_open(): enumerating interfaces of 0x0002:0xf003
Debug: 139 3007 cmsis_dap_usb_bulk.c:177 cmsis_dap_usb_open(): enumerating interfaces of 0x0451:0x8140
Debug: 140 3186 cmsis_dap_usb_bulk.c:177 cmsis_dap_usb_open(): enumerating interfaces of 0x1050:0x0407
Debug: 141 3366 cmsis_dap_usb_bulk.c:177 cmsis_dap_usb_open(): enumerating interfaces of 0x2109:0x2812
Debug: 142 3547 cmsis_dap_usb_bulk.c:177 cmsis_dap_usb_open(): enumerating interfaces of 0x2109:0x2812
Debug: 143 3547 cmsis_dap_usb_bulk.c:177 cmsis_dap_usb_open(): enumerating interfaces of 0x046d:0x085c
Debug: 144 3719 cmsis_dap_usb_bulk.c:177 cmsis_dap_usb_open(): enumerating interfaces of 0x0451:0x8142
Debug: 145 3720 cmsis_dap_usb_bulk.c:177 cmsis_dap_usb_open(): enumerating interfaces of 0x1a86:0x752d
Debug: 146 3886 cmsis_dap_usb_bulk.c:177 cmsis_dap_usb_open(): enumerating interfaces of 0x1a40:0x0101
Info : 147 3896 cmsis_dap.c:788 cmsis_dap_get_caps_info(): CMSIS-DAP: SWD Supported
Info : 148 3896 cmsis_dap.c:790 cmsis_dap_get_caps_info(): CMSIS-DAP: JTAG Supported
Info : 149 3898 cmsis_dap.c:768 cmsis_dap_get_version_info(): CMSIS-DAP: FW Version = 1.0
Info : 150 3902 cmsis_dap.c:921 cmsis_dap_init(): CMSIS-DAP: Interface Initialised (JTAG)
Debug: 151 3903 cmsis_dap.c:953 cmsis_dap_init(): CMSIS-DAP: Packet Size = 64
Debug: 152 3905 cmsis_dap.c:966 cmsis_dap_init(): CMSIS-DAP: Packet Count = 8
Debug: 153 3905 cmsis_dap.c:969 cmsis_dap_init(): Allocating FIFO for 3 pending packets
Info : 154 3907 cmsis_dap.c:809 cmsis_dap_get_status(): SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 1 TDO = 1 nTRST = 1 nRESET = 1
Info : 155 3915 cmsis_dap.c:1023 cmsis_dap_init(): CMSIS-DAP: Interface ready
Debug: 156 3915 core.c:1785 adapter_khz_to_speed(): convert khz to interface specific speed value
Debug: 157 3915 core.c:1789 adapter_khz_to_speed(): have interface set up
Debug: 158 3917 core.c:1785 adapter_khz_to_speed(): convert khz to interface specific speed value
Debug: 159 3917 core.c:1789 adapter_khz_to_speed(): have interface set up
Info : 160 3917 core.c:1565 adapter_init(): clock speed 1000 kHz
Debug: 161 3917 openocd.c:143 handle_init_command(): Debug Adapter init complete
Debug: 162 3917 command.c:146 script_debug(): command - transport init
Debug: 163 3917 log.c:428 gdb_timeout_warning(): keep_alive() was not invoked in the 1000 ms timelimit (3917 ms). This may cause trouble with GDB connections.
Debug: 166 3917 transport.c:229 handle_transport_init(): handle_transport_init
Debug: 167 3919 core.c:830 jtag_add_reset(): SRST line released
Debug: 168 3919 core.c:855 jtag_add_reset(): TRST line released
Debug: 169 3919 core.c:327 jtag_call_event_callbacks(): jtag event: TAP reset
Debug: 170 4137 command.c:146 script_debug(): command - jtag arp_init
Debug: 171 4137 core.c:1578 jtag_init_inner(): Init JTAG chain
Debug: 172 4137 core.c:327 jtag_call_event_callbacks(): jtag event: TAP reset
Info : 173 4137 cmsis_dap.c:1076 cmsis_dap_execute_tlr_reset(): cmsis-dap JTAG TLR_RESET
Debug: 174 4171 core.c:1243 jtag_examine_chain(): DR scan interrogation for IDCODE/BYPASS
Debug: 175 4171 core.c:327 jtag_call_event_callbacks(): jtag event: TAP reset
Info : 176 4178 cmsis_dap.c:1076 cmsis_dap_execute_tlr_reset(): cmsis-dap JTAG TLR_RESET
Info : 177 4181 core.c:1142 jtag_examine_chain_display(): JTAG tap: stm32f1x.cpu tap/device found: 0x3ba00477 (mfg: 0x23b (ARM Ltd), part: 0xba00, ver: 0x3)
Info : 178 4181 core.c:1142 jtag_examine_chain_display(): JTAG tap: stm32f1x.bs tap/device found: 0x16410041 (mfg: 0x020 (STMicroelectronics), part: 0x6410, ver: 0x1)
Debug: 179 4181 core.c:1374 jtag_validate_ircapture(): IR capture validation scan
Debug: 180 4184 core.c:1432 jtag_validate_ircapture(): stm32f1x.cpu: IR capture 0x01
Debug: 181 4184 core.c:1432 jtag_validate_ircapture(): stm32f1x.bs: IR capture 0x01
Debug: 182 4184 command.c:146 script_debug(): command - dap init
Debug: 184 4184 arm_dap.c:106 dap_init_all(): Initializing all DAPs ...
Debug: 185 4184 arm_adi_v5.c:653 dap_dp_init(): stm32f1x.dap
Debug: 186 4184 arm_adi_v5.c:685 dap_dp_init(): DAP: wait CDBGPWRUPACK
Debug: 187 4184 arm_adi_v5.h:507 dap_dp_poll_register(): DAP: poll 4, mask 0x20000000, value 0x20000000
Error: 188 4194 adi_v5_jtag.c:425 jtagdp_overrun_check(): Invalid ACK (4) in DAP response
Debug: 189 4196 command.c:629 run_command(): Command 'dap init' failed with error code -107
User : 190 4196 command.c:694 command_run_line():
Debug: 191 4196 command.c:629 run_command(): Command 'init' failed with error code -4
User : 192 4196 command.c:694 command_run_line():
Debug: 193 4197 target.c:2172 target_free_all_working_areas_restore(): freeing all working areas