Hi Paul,
The SWD protocol is more easily simulated with the SPI interface on the Kinetis devices, in particular the K20 devices are convenient because they allow variable-length transactions. You can refer to the source for USBDM firmware for example code.
The programming of the Flash is described in the Device Manual and has nothing to do with the SWD protocol. You should also consider using the EZPORT protocol which does not require target code execution. This is also described in the Device manual.
bye
Message was edited by: Peter O Donoghue
As has been pointed out by Paul - The KL series devices don't have EZPORT.
bye