#oggstreamer – STM8 UART Flasher for Linux

I just completed a rough Version 0.3 of stm8flash – a handy little tool that allows you to programm a STM8 over a serial uart interface (using the STM8 internal bootloader)

The software is based upon stm32flash written by Geoffrey McRae – many thanks to you that way. STM is using a similar Bootloader-Protocol for the STM32s and STM8s which made porting the flashertool not so difficult.

The stm8flash can be downloaded via sourceforge. It works as desired for my 32K STM8S105 device. But it is only designed to work with 32K devices so far. Also it is currently using the so-called “Reply” Mode, which is available on STM8A-128K, STM8S-32K, STM8S-128K and STM8L-64K. If you want to use this tool in non reply mode, then take a look at stm8.c and search for “REPLY” – it should be fairly easy to adapted to the other devices as well.

stm8flash also introduces a new flag “-d”, which stands for using the DTR-Line to trigger a device reset. (Arduino-Style 😉 )

Maybe in future somebody could try to merge stm32flash and stm8flash as the share a lot of common code.
What was really helpful for debugging the code and get the thing running, was a SALEAE Logic-Analyzer (with Software RS-232 decode functionality). It is definitely a powerful tool for such tasks.

Further this step just marks the first Milestone for the ongoing NetIdee-Project. 🙂

5 responses to “#oggstreamer – STM8 UART Flasher for Linux

  1. Hi,
    Great Work 😉

    I am one of the guys that have the SM8s Discovery board…but i work on linux too…

    Can you please describe how can we use the flasher…

    For what I understood, this flasher works with the bootloader, and we don’t need the ST Link SWIM to flash right?

    But this means that we need a micro that already have a bootloader flashed :S…
    I Don’t know if the STM8S105C6T6 have one inside :S ?

    Please can you describe the method to flash the micro.

    Thanks in advance


    • hi lmx,

      the STM8S105 has a internal Bootloader which is enabled two ways afaik.

      1.) Empty device -> STM8 stays in Bootloader mode
      2.) Optionbit for Bootloader enabled -> STM8 stays for 1 sec. after reset in Bootloader

      you can use stm8flasher together with the option “-l” which enables the bootloader bit

      anyhow you will have to connect the STM8 UART RX/TX-Lines to your PC via a FTDI-Chip for example.
      You will also have to trigger the Reset just in time bye using for example the DTR Line. stm8flash supports triggering Reset via DTR – check the usage info.

      feel free to write questions to my email (can be found in the about section)

      best wishes, Georg

      • Hi Georg

        thanks a lot for the explanation 🙂
        I was trying to send you an email….but I can’t find yours :S
        I was trying to compile the flasher code…
        but it have a makefile to crosscompiling for lantronix, and I want to compile for x86/x86_64 :S

        I don know where to start.Isaw the readme file inside, but it doesn’t have any hint on how to compile it :S
        for what I understand there are:
        main.c utils.c stm8.c e_w_routines.c serial_common.c serial_platform.c to be compiled, but in this process you use lib_parsers :S

        sorry to reply here, if you want, feel free to do not publish my comment.

        thanks in advance

        best wishes, tux

  2. Yoni Davidson

    Great work ,
    Unfortunately I am getting no ack when trying to use this loader.
    Is there something that I am missing ?
    I already have a working code on it , used ART ide to load it, Is there something that i should do before ?



    • Hi Yoni,
      sorry for the late response – some of the STM8 Bootloaders work in “reply mode” – which basically need, that the bootloader need reply each byte in order that the STM8 sends the next byte. I added an option flag for this – maybe that is the issue …

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s