
Will Donnelly wrote a script to program the STM32 Discovery board with the Bus Pirate:
I wanted to program my new STM32 Discovery boards under Linux, and I had a Bus Pirate, so I just finished writing a SWD programmer for it using the raw 2-wire interface.
Get a Bus Pirate v3b for $30, including worldwide shipping at Seeed Studio. Adafruit also has the Bus Pirate and probe cables in stock and ready to ship.

There is no instruction about how to implement this feature. The git only has the files.