title: OpenOCD Failed to execute MI command: -target-select remote localhost:3333
body: <p>I'm used to using Segger at work, but I didn't want to spend that kind of money for home use, so this is my first time using OpenOCD for debugging.
  I've got the Olimex ARM-USB-TINY-H. </p>
  
  <p>My OS is Ubuntu.
  I'm using MCUXpresso (Eclipse) with the OpenOCD Plugin.
  I'm having problems with gdb connecting to OpenOCD.
  Any pointers would be super helpful.</p>
  
  <p>I've got the config options set to</p>
  
  <pre><code>-s /usr/local/share/openocd/scripts/  -f /usr/local/share/openocd/scripts/interface/ftdi/olimex-arm-usb-tiny-h.cfg -f /home/username/Documents/Code/kl27z-ARM_USB_TINY.cfg
  </code></pre>
  
  <p>The console output:</p>
  
  <pre><code>Open On-Chip Debugger 0.10.0
  Licensed under GNU GPL v2
  For bug reports, read
      http://openocd.org/doc/doxygen/bugs.html
  Info : FTDI SWD mode enabled
  none separate
  Info : add flash_bank kinetis kl27.flash
  adapter speed: 1000 kHz
  none separate
  cortex_m reset_config sysresetreq
  Started by GNU MCU Eclipse
  Info : clock speed 1000 kHz
  in procedure 'init' 
  in procedure 'ocd_bouncer'
  </code></pre>
  
  <p>Eclipse Pops up this error:</p>
  
  <pre><code>Error in final launch sequence
  Failed to execute MI command:
  -target-select remote localhost:3333
  Error message from debugger back end:
  localhost:3333: Connection timed out.
  Failed to execute MI command:
  -target-select remote localhost:3333
  Error message from debugger back end:
  localhost:3333: Connection timed out.
  localhost:3333: Connection
  </code></pre>
  
  <p>Here is the .cfg file</p>
  
  <pre><code># inteface: olimex arm usb tiny h
  # transport: swd
  
  # adapter/interface
  #interface ftdi
  #source [find interface/ftdi/olimex-arm-usb-tiny-h.cfg]
  
  transport select swd
  
  # increase working area to 16KB
  # set WORKAREASIZE 0x4000
  
  set CHIPNAME kl27
  
  #reset_config srst_only srst_nogate connect_assert_srst
  reset_config none separate
  
  source [find target/klx.cfg]
  
  ftdi_layout_signal SWD_EN -data 0
  
  $CHIPNAME.cpu configure -event examine-end {
      kinetis mdm check_security
  }
  
  #gdb_memory_map disable
  
  $_TARGETNAME configure -event gdb-attach {
     echo "Halting Target"
     reset init
  }
  </code></pre>
  
  <p>Update, running with --debug 0 the last part of the console is</p>
  
  <pre><code>Debug: 272 20 transport.c:239 handle_transport_init(): handle_transport_init
  Debug: 273 20 ftdi.c:1223 ftdi_swd_switch_seq(): JTAG-to-SWD
  Debug: 274 20 ftdi.c:1077 ftdi_swd_run_queue(): Executing 2 queued transactions
  Debug: 275 20 ftdi.c:1109 ftdi_swd_run_queue(): JUNK DP read reg 0 = 00000000
  Debug: 276 20 command.c:626 run_command(): Command failed with error code -4
  User : 277 21 command.c:687 command_run_line(): in procedure 'init' 
  in procedure 'ocd_bouncer'
  Debug: 278 21 command.c:626 run_command(): Command failed with error code -4
  User : 279 21 command.c:687 command_run_line(): 
  </code></pre>