

This demonstrates setting up and using the UART for serial I/O. We present a simple Demo that repeatedly outputs "Hello World!" on UART2 (the only UART the STM8S105 has). In case there are any errors, such as header files not found, check that pkg-config and development files for libusb are installed. using unzip stm8flash-master.zip) change into the directory stm8flash-master and type make.

To compile it, a C compiler, such as gcc, pkg-config and libusb need to be installed. The stm8flash source can be found at its GitHub location, where there is also a download link for a zip archive of the sources. SDCC binaries or a source tarball can be downloaded from its website. In particular, SDCC 3.4.0 has an issue with the library search path this can be worked around by explicitly specifying the path to the standard library when linking. While SDCC 3.4.0 should be sufficient for this tutorial, you might want to try a newer version in case you encounter any bugs. We used a USB-to-serial converter and gtkterm.ĭepending on your operating system there might be an easy way to install SDCC 3.5.0 or newer using a package system or similar (e.g. On the other end the serial cable is attached to an RS232 port on a computer running a terminal program configured for 9600 baud, no parity, 8 bits, 1 stop bit and no flow control.

We connect the RS232 board to power pins and for data to the I/O pins (TxIN to PC3, RxOUT to PC2) the serial cable is then attached to the RS232 board. The board does have an USB connector, which can be used to power it, but it should only be used when there is no ST-Link attached. To write our program to the board, we attach a an ST-Link/V2.
