Philipp Krause

The missing piece for a fully free toolchain: ST-LINK firmware

Discussion created by Philipp Krause on Oct 23, 2017
Latest reply on Apr 16, 2018 by de_vaal.ruud.001

By now, most of the bits for a fully free development environment for the STM8 are in place. Some might need a bit more polish, or a few more features, but work is progressing. Not everything has been relased, or made easy to use, but that will happen with time; most of the necessary hard work is done. Of course, there is still room for hard work in further improvements (e.g. make SDCC handle floating-point more efficiently on the STM8, or further optimizations), but the basic functionality is there.


We have free OSes, such as GNU/Linux to run our tools on. There is SDCC for the compiler (and assembler, linker, simulator). OpenOCD and GDB allow on-target debugging. Those who prefer an IDE over a text editor can find support for SDCC in Code::Blocks, but other free IDEs such as Eclipse and Anjuta can be used as well.


At some point the software has to be loaded onto the target device. This is done either through a bootloader usign a tool such as stm8gal, or via SWIM using a tool such as stm8flash. While those tools themselves are free, there is till some non-free software involved:


stm8gal uses (for some but not all target devices) some relatively small binary blobs.

stm8flash uses an ST-LINK, which contains non-free firmware.


The STM32 community has a free alternative in the Black Magic Probe. But for the STM8, this last bit of non-free software remains. So how could this problem be fixed? I see a few options:


1) ST releases ST-LINK firmware as free software.

Essentialy, ST is a hardware vendor. For years, there have been cheap Chinese ST-LINK clones on the market, probably violating ST's copyright. AFAIK, ST is doing nothing to stop them (after all, the availability of these clones makes their STM8 µCs more attractive and is thus helping ST's business). ST has nothing to gain from keeping the firmware non-free, but they would profit from making the firmware free.


2) Free alternatives to ST firmware for ST-LINK are written (e.g.  the Black Magic Probe firmware works on the ST-LINK for the STM32, but does not support the STM8).


3) Free alternatives to the blobs used in stm8gal are written. That would work for the STM8 devices that have a bootloader.


4) A free alternative to the ST-LINK is created. The easy way would probably to add support for SWIM in the Black Magic Probe.


What do you think about getting this last missing piece in the free toolchain for STM8 into place? Did I miss any important points?