Skip to content
gicking edited this page Dec 14, 2017 · 19 revisions

Welcome to the stm8gal Wiki!

License / Disclaimer

  • stm8gal and it's source code is distributed under the Apache License Version 2.0 (see License)

  • exception is some RAM code, which is required for flash programming. This code is available on the STM Homepage. All rights to this RAM code remain with STM.

Overview

stm8gal is an application for programming or reading out STM8 memory using the built-in ROM bootloader (BSL) via UART or SPI interface. It is compatible with Windows, MacOS X and Linux, including Raspbian. For a list of tested configurations see supported platforms.

Note: stm8gal replaces the STM8_serial_flasher. The latter was renamed after a proposal by Philipp Krause

Tools with similar functionality for the UART interface are:

Notes:

  • this tool has been tested only for a few STM8 devices (see supported platforms). Theoretically it should work for all STM8 devices with bootloader, especially since STM8AF, STLUX, STNRG and STM8SPLNB seem to be test variants of the STM8S, and STM8AL and STM8T seem to be test variants of the STM8L. But this has not been tested, so any feedback is highly appreciated!

  • the popular STM8S Discovery and STM8L Discovery boards connect to a standard PC via SWIM (=debug) interface, so a separate adapter is required to connect to the respective STM8 UART or SPI pins. For examples see hardware setup or this tutorial.

  • the Raspberry Pi, and other “embedded PCs“ with access to UART and SPI pins, allow a direct connection to the respective STM8 pins. For an example setup see page hardware setup.

  • when directly connecting GPIO pins, pay special attention to compatible voltage levels, e.g. never connect a 5V adapter to 3.3V STM8 pins ore vice versa!

  • the STM8 ROM bootloader (=BSL) must be enables for uploading new code

    • for virgin devices (i.e. flash erased) the BSL is automatically enabled

    • for other devices the BSL can be re-enabled

    • stm8gal by default activates the BSL after upload (see page usage)

  • the BSL can be entered only within 1s after reset. Reset can be triggered manually (reset button), via DTR (requires connection of DTR to STM8 RST pin), or via Raspberry Pi header pin 12 (see page hardware setup)

  • bootloader programming via UART, SPI or CAN is supported by most STM8 devices. However, not all devices support each interface. A full description of the bootloaders can be found in UM0560, including an overview of STM8 devices with respective bootloader mode:

STM8 BSL Modes

  • the UART "reply" mode supports single-wire interfaces like LIN or ISO9141. It requires a "Rx echo" for each sent byte. Reply mode with dual wires therefore requires stm8gal to echo each received byte individually, which results in very low upload speed.

  • the STM32 uses a very similar bootloader protocol, so adapting the flasher tool for STM32 should be straightforward. However, I have no board available, but please feel free to go ahead...

See other Wiki pages for instructions on building, hardware setup, and using the software. Have fun! :-)

Clone this wiki locally