Using STM32 Microcontrollers and the ST-Link Programmer in Linux

Introduction

STM32 is a series of ARM-based microcontrollers from STMicroelectronics. ST makes a USB-based programming and debugging adapter called the ST-Link, now available in its second version. The official software for using these programmers is only available for windows, but some third-party tools have been written for Linux

ST-Link v1 Complications

The ST-Link v1 uses a mass-storage-based USB protocol that emulates a 32MB storage device and uses special SCSI commands for controlling the device. This works under windows, but does not work properly under Linux since the kernel will send extra commands to it thinking it is a real mass storage device. The ST-Link v2 uses a protocol implemented directly on top of USB and can be accessed from userspace with libusb without these problems