This is a quick guide to building and flashing CleanFlight via ST-Link

To build a custom version of CleanFlight for the NAZE 32:

cd into your cleanflight source directory (mine is in ~/src/rc/cleanflight) and run:

TARGET=NAZE make clean && TARGET=NAZE make

in one terminal, run:

openocd -f support/openocd/stm32f10x.cfg

where support/openocd/stm32f10x.cfg:

source [find interface/stlink-v2.cfg]
source [find target/stm32f1x.cfg]
# if you have the reset line plugged in:
#reset_config srst_only srst_nogate
# OR if you want to reset over the swd channel (much easier):
reset_config none separate

in another terminal, run:

telnet localhost 4444

now in the telnet session, run:

reset halt
sleep 100
poll
flash probe 0
flash write_image erase obj/cleanflight_NAZE.hex
sleep 200
poll
reset run

here are the flashing directions from cleanflight (these didnt work for me):

reset halt
wait_halt 
sleep 100
poll
flash probe 0
flash write_image erase obj/cleanflight_NAZE.hex 0x08000000
sleep 200
soft_reset_halt
wait_halt
poll
reset halt