Arduino-style development on STM8
Identify the STM8 Arduino core used by an old sketch and select the matching compiler, board package and programmer.
Identify the core and language
The archived Spark Logic index introduced this section during discussion of an early STM8 Arduino port. Later projects include ST's Arduino_Core_STM8, which used Cosmic C++, and Michael Mayer's Sduino, which uses SDCC and provides an Arduino-style API in C.
Read the original sketch's package requirements before selecting a core. Sduino's C API cannot compile arbitrary C++ libraries unchanged. STM8 also has a different architecture from STM32, so libraries that assume STM32 registers or a particular memory layout need separate support.
Build for the exact part
Start from a board supported by the selected package. Confirm the MCU marking and pin assignment. Build the package's Blink example and upload using its documented SWIM programmer or supported serial bootloader. ST marked its STM8 Arduino core repository as archived, so use its documentation when reproducing an old setup.
Connect an STM8 auto-wakeup interrupt
Find the AWU interrupt number in the datasheet for your STM8. The compiler's interrupt declaration and the core's startup vector table must agree. An SDCC ISR normally uses __interrupt with the device IRQ number, while projects using the ST peripheral library can declare the handler through INTERRUPT_HANDLER.
Check the generated map or disassembly to confirm the AWU vector points to the handler. Configure AWU from the device's low-speed clock and clear its wake flag with the register sequence in RM0016. Follow the chosen core's convention if it already installs an AWU handler.
