Stm8s compiling or even just setting up to work VScode... ! Help!

I thought you wanted to do a stm8s003f3p6 board definition? If I change it to

        "mcu": "stm8s003f3p6",

and use the platformio.ini

[env:stm8s003f3]
platform = ststm8
board = stm8s003f3
framework = arduino

with the src\main.c code from platform-ststm8/examples/arduino-fade-all-pins/src/fade-all-pins.c at develop · platformio/platform-ststm8 · GitHub I get

Checking size .pio\build\stm8s003f3\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=         ]   7.3% (used 75 bytes from 1024 bytes)
Flash: [===       ]  34.3% (used 2813 bytes from 8192 bytes)
========================== [SUCCESS] Took 2.14 seconds ==========================

So that all works nicely.

Note: I’ve also pre-emptively replaced the toolchain in C:\Users\<user>\.platformio\packages\toolchain-sdcc with the v4.0 version, as noted in Error 309 - "arduino-fade-all-pins" for the platform "ST STM8" - #18 by vampir8.

Edit:

To program the chip for the first time, its flash needs to be unlocked – see post below

cd .platformio\packages\tool-stm8tools
stm8flash -c stlinkv2 -u -p stm8s003?3
3 Likes