There is a specific pin called vcap in stm8s mcu. I recommend this pin connects to a 1uF capacitor which has a low ESR and a low ESL. The power supply which powered for MCU kernel needs the capacitor.
If the capacitor is too low,maybe the mcu can't be downloaded the code.