Can I program all kinds of SWD-programmable chips (ARM-MCUs) with ST-Link?
To add to the existing answer; some chips are known not to work properly with ST-LINK and OpenOCD.
In particular, if your target is from the Atmel SAMD21 family of MCUs, you are likely to run into weird issues, where the processor is detected, but any attempts to erase flash sectors fail with an error.
The reason is rather involved, to quote:
AFAIK the problem is in half word (16-bit) write to NVMCTRL->CTRLA register. STLink does not implement half word memory access and OpenOCD emulates is as two byte operations. Unfortunately CTRLA register comprises from key and command an have to be written atomically. If STLink writes two bytes, NVM controller sets PROGE bit in STATUS: "An invalid command and/or a bad keyword was/were written in the NVM Command register"
The workaround involves recompiling OpenOCD with code patches. Not fun.
However, if you don't mind flashing your ST-Link (through another ST-Link), you can convert it to a CMSIS-DAP adapter, which works just fine with the SAMD and should also work with STM32 and other Cortex-M chips.
Yes I believe this is possible, although I haven't tried it. You would likely be in breach of the ST Licence agreement, if you tried programming devices other than those from ST
As an example Segger (One of the market leaders in debuggers and programmers) supports converting your ST-Link to J-link (essentially overwriting the ST-Link chip with the Segger code). This is also reversible, so if you want to restore your ST-link device back to its original form you can.
There are several version of ST-Link, however. Take a look at the following links which provide further info and a guide on how to do this.
I've done both. The Blue Pill has the advantage that the usb-rs232 bridge the BMP exports is easily available.
The BMP supports a range of chips to include but not limited to:
ST Microelectronics STM32F0, STM32F1, STM32F3, STM32F2, STM32F4, STM32F7, STM32L0, STM32L1, STM32L4
Atmel SAM3N, SAM3X, SAM3S, SAM3U, SAM4S, SAM4L, SAM D20, D21
Nordic nRF51, nRF52 (These are why I use the BMP)
The BMP is open source, can be used for commercial programming and the hardware can be cheap(The "real" BMP costs around $60, a blue pill 5 pack from amazon was less than $20 shipped).