This is the way I’m flashing NuttX on my board (called “GreenBone”) using the current (as of 20150129) OpenOCD:
This is my openocd.cfg :
# STM32F107 Target # Using stlink as SWD programmer source [find interface/stlink-v2.cfg] # SWD as transport transport select hla_swd # Use STM32F1X target set WORKAREASIZE 0x4000 source [find target/stm32f1x.cfg]
Then I execute OpenOCD this way:
$ sudo openocd -f openocd.cfg Open On-Chip Debugger 0.9.0-dev-00251-g1fa4c72 (2015-01-28-20:08) Licensed under GNU GPL v2 For bug reports, read http://openocd.sourceforge.net/doc/doxygen/bugs.html Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD adapter speed: 1000 kHz adapter_nsrst_delay: 100 none separate 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 v17 API v2 SWIM v4 VID 0x0483 PID 0x3748 Info : using stlink api v2 Info : Target voltage: 3.145571 Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints Info : accepting 'telnet' connection on tcp/4444
Finally I connect to its telnet server and flash nuttx.bin:
$ telnet 127.0.0.1 4444 Trying 127.0.0.1... Connected to 127.0.0.1. Escape character is '^]'. Open On-Chip Debugger > reset halt target state: halted target halted due to debug-request, current mode: Thread xPSR: 0x01000000 pc: 0x200001e0 msp: 0x20005000 > flash write_image erase nuttx.bin 0x08000000 auto erase enabled device id = 0x10016418 flash size = 256kbytes target state: halted target halted due to breakpoint, current mode: Thread xPSR: 0x61000000 pc: 0x2000003a msp: 0x20005000 wrote 69632 bytes from file nuttx.bin in 3.056594s (22.247 KiB/s) > reset run > exit