The LibSWD and OpenOCD has just made its first steps into flash memory access and writing program code to the ARM Cortex-M3 based Stm32Primer2 device using cheap and generic FT2232H‘s based JTAG/SWD KT-LINK interface :-) The current connection speed is around 10sec/1kB but still I have some ideas on how to improve it, even with the USB bottleneck. The LibSWD is platform independent, so it can drive any other type of hardware (RLink, GPIO based, Parallel Port, etc), also it can be uploaded into dedicated hardware dongle if necessary :-) Feedback and testing are welcome :-)
You can get the code from remote GIT repository at http://repo.or.cz/w/openocd/libswd.git. The project implementation details and history is at http://stm32primer2swd.sf.net/.
%telnet localhost 4444
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Open On-Chip Debugger
> halt
target was in unknown state when halt was requested
> flash probe 0
device id = 0x10016414
flash size = 512kbytes
device id = 0x10016414
flash size = 512kbytes
flash 'stm32x' found at 0x08000000
> stm32x mass_erase 0
stm32x mass erase complete
> flash write_image toggle.hex
wrote 1936 bytes from file toggle.hex in 18.636387s (0.101 KiB/s)