

#define TIM1_PCNTRL (*(volatile uint8_t *)0x52c0) #define TIM1_PCNTRH (*(volatile uint8_t *)0x52bf) #define CLK_PCKENR2 (*(volatile uint8_t *)0x50c4) #define CLK_DIVR (*(volatile uint8_t *)0x50c0) #define PC_DDR (*(volatile uint8_t *)0x500c) #define PC_ODR (*(volatile uint8_t *)0x500a) This demonstrates setting up and using an accurate timer and doing basic I/O. We present a simple Demo that blinks two LEDS, one once per second, the other once every two seconds.

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.
Stm8 cosmic example code archive#
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.
Stm8 cosmic example code install#
Just the STM8L-DISCOVERY connected using a USB cable.ĭ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.

