

It’s important that you understand what’s going on here, since we’re going to use this mechanism for accessing hardware registers later on. The only difference is that in the first example we know exactly which address in memory we are going to use. bashrc file (replacing username with your user name): I prefer to keep flasher with compiler for convenience. Now extract stm8flash, build it with make and copy stm8flash binary to ~/local/sdcc/bin. The first step is to download all the necessary tools:Įxtract SDCC under ~/local/sdcc. To program the microcontroller we’ll be using stm8flash. SDCC is being actively developed, so I suggest trying the latest snapshot build instead of the stable version. Luckily, SDCC supports STM8 and that’s what we’re going to use. Some of these compilers have free versions with code size limit, but none of them are available for linux. There are 3 commercial compilers available for these processors: Raisonance, Cosmic and IAR. The biggest downside is that STM8 processors are not supported by GCC. Note: a 1uF capacitor on VCAP pin is required for the processor to operate. STM8S003F3 comes in a handy TSSOP20 package which is very easy to solder. All you need is an ST-Link v2, STM8S003F3 and a breakout board. Instead, I’ll opt for the minimalist approach. The easiest one is to get a Discovery board, although I wouldn’t recommend it, since STM8 Discovery boards aren’t that good and the on-board ST-Link v1 firmware just sucks. There is a number of ways to start working with STM8. Even though writing peripheral drivers from scratch might seem like reinventing the wheel, in many cases it is easier and faster to implement the functionality that you need for a specific task, instead of relying on vendor-supplied libraries that try to do everything at once (and fail). The main goal of this article is to demonstrate that ‘bare metal’ programming is not a difficult task and to give you an overview of STM8’s architecture and peripherals. Some applications just don’t require that amount of flexibility and performance. Utilizing an ARM Cortex core to switch some lights on and off seems like an overkill. Despite having various ARM Cortex-M0 devices available on the market for quite attractive prices, AVRs have one advantage - simplicity. Initially I came across this part while searching for a simple microcontroller as a replacement for AVRs. STM8 is a cheap 8-bit microcontroller aimed towards low-cost mass-market devices. This article will cover developing for STM8 series of microcontrolles completely from scratch, without using any vendor-supplied libraries.
