I cloned this repo and tried to flash my STM32F3 DIscovery board using make flash
. The relevant rule is this:
flash: main.axf
openocd -f oocd.cfg -c "program main.axf verify reset" -c "shutdown"
oocd.cfg:
telnet_port 4444
gdb_port 3333
source [find board/stm32f3discovery.cfg]
make flash
then gives me the following output:
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
none separate
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : clock speed 950 kHz
Info : STLINK v2 JTAG v21 API v2 SWIM v0 VID 0x0483 PID 0x3748
Info : using stlink api v2
Info : Target voltage: 2.883108
Info : stm32f3x.cpu: hardware has 6 breakpoints, 4 watchpoints
adapter speed: 1000 kHz
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x0800234c msp: 0x2000a000
adapter speed: 8000 kHz
** Programming Started **
auto erase enabled
Info : device id = 0x10036422
Info : flash size = 256kbytes
Warn : no flash bank found for address 0
Warn : no flash bank found for address 704
wrote 0 bytes from file main.axf in 0.001628s (0.000 KiB/s)
** Programming Finished **
The program
command shows me that no flash bank found
and no data was written. Naturally, the verify
command fails.
I built OpenOCD from the 0.9 tag. I installed libusb-1.0-0-dev
using aptitude, which was necessary for ST-Link support.
What is wrong in my configuration, or is there an alternative to OpenOCD that I could try for this task?
It looks like you have the wrong defined FLASH address. It is flashing from address 0
, and not from 0x08000000
where FLASH in STM32F3 is.
I had a short look into the GitHub repository and the problem seems to be in the linker script. In file LM4F.ld
the FLASH address is defined at 0x00000000
.