I was having trouble flashing BetaFlight to my SPRacingF3 board, so I used the SWD port to load the firmware.
First build the binary with the following command. I'm using a
SPRACINGF3 target. Switch this to match whatever target you're working with:
Then, from the same directory where you built the binary, flash it with:
openocd -f ~/Desktop/stm32f3.cfg -c "program ./obj/main/betaflight_SPRACINGF3.elf verify reset exit"
› cat ~/Desktop/stm32f3.cfg # This is an STM32F3 discovery board with a single STM32F303VCT6 chip. # http://www.st.com/internet/evalboard/product/254044.jsp source [find interface/stlink-v2.cfg] transport select hla_swd source [find target/stm32f3x.cfg] reset_config none separate
The key line in that file is the last line:
reset_config none separate.
If you have trouble getting the board to reset, you'll see an error like this:
timed out while waiting for target halted TARGET: stm32f3x.cpu - Not halted in procedure 'reset' in procedure 'ocd_bouncer'
By default the config is set to use the
Instead, send the reset command over the SWD pins with:
reset_config none separate