0


first of all I'm sorry for my really poor English.
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.
The code i've written is just the following eight line.

  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);

There is a copy of the Eclipse project Here.
I'm trying to program the board using openocd, so I run

openocd -f /usr/share/openocd/scripts/board/stm32f3discovery.cfg -f /usr/share/openocd/scripts/interface/stlink-v2.cfg

then

​telnet localhost 4444 
​reset halt
flash write_image erase blink.elf
​reset

The output of openocd is

Open On-Chip Debugger
> reset halt
target state: halted
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x2b061a1a msp: 0x48054b04
> flash write_image erase blink.elf
auto erase enabled
couldn't open blink.elf
in procedure 'flash'
> 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)
> reset

But none of the led is turned on!
What should I do?

2 Answers2

0

The couldn't open blink.elf message indicates that the file blink.elf might not be in the current directory.

Make sure to execute the openocd command from the folder that contains the blink.elf firmware image you intend to program.

0

I also encountered the same problem. If you're using Windows, the solution is to open Terminal with administrator privileges. If you're using Linux, you might need to use sudo.