title: STM32F3Discovery programming with openocd
body: <p><br> first of all I'm sorry for my really poor English.<br>
  I'm learning how to use an STM32F3Discovery board.
  I wrote a simple program that turn-on all the on-board led, using STMCubeMX for configuration-code generation. <br>
  The code i've written is just the following eight line.</p>
  
  <pre><code>  HAL_GPIO_WritePin(GPIOE, GPIO_PIN_8, GPIO_PIN_SET);
    HAL_GPIO_WritePin(GPIOE, GPIO_PIN_9, GPIO_PIN_SET);
    HAL_GPIO_WritePin(GPIOE, GPIO_PIN_10, GPIO_PIN_SET);
    HAL_GPIO_WritePin(GPIOE, GPIO_PIN_11, GPIO_PIN_SET);
    HAL_GPIO_WritePin(GPIOE, GPIO_PIN_12, GPIO_PIN_SET);
    HAL_GPIO_WritePin(GPIOE, GPIO_PIN_13, GPIO_PIN_SET);
    HAL_GPIO_WritePin(GPIOE, GPIO_PIN_14, GPIO_PIN_SET);
    HAL_GPIO_WritePin(GPIOE, GPIO_PIN_15, GPIO_PIN_SET);
  </code></pre>
  
  <p>There is a copy of the Eclipse project <a href="https://www.dropbox.com/s/bryn7x73ftlv45g/blink.zip?dl=0" rel="nofollow">Here</a>.<br>
  I'm trying to program the board using openocd, so I run</p>
  
  <pre><code>openocd -f /usr/share/openocd/scripts/board/stm32f3discovery.cfg -f /usr/share/openocd/scripts/interface/stlink-v2.cfg
  </code></pre>
  
  <p>then</p>
  
  <pre><code>​telnet localhost 4444 
  ​reset halt
  flash write_image erase blink.elf
  ​reset
  </code></pre>
  
  <p>The output of openocd is</p>
  
  <pre><code>Open On-Chip Debugger
  &gt; reset halt
  target state: halted
  target halted due to debug-request, current mode: Thread 
  xPSR: 0x01000000 pc: 0x2b061a1a msp: 0x48054b04
  &gt; flash write_image erase blink.elf
  auto erase enabled
  couldn't open blink.elf
  in procedure 'flash'
  &gt; flash write_image erase blink.elf
  auto erase enabled
  device id = 0x10036422
  flash size = 256kbytes
  target state: halted
  target halted due to breakpoint, current mode: Thread 
  xPSR: 0x61000000 pc: 0x2000003a msp: 0x48054b04
  wrote 2048 bytes from file blink.elf in 0.224231s (8.919 KiB/s)
  &gt; reset
  </code></pre>
  
  <p>But none of the led is turned on!<br>
  What should I do?</p>