STM8S003K3(instead of STM8S003F

Hi PIO community:
I changed it stm8s003f3.json in /.platformio/platforms/ststm8/boards to stm8s003k3.json

{
  "build": {
    "core": "sduino",
    "extra_flags": "-DSTM8S_003 -DSTM8S003",
    "f_cpu": "16000000L",
    "cpu": "stm8",
    "mcu": "stm8s003k3t6",
    "variant": "standard"
  },
  "debug": {
    "svd_path": "STM8S003K3.svd",
    "openocd_target": "stm8s003"
  },
  "frameworks": [
    "arduino",
    "spl"
  ],
  "upload": {
    "maximum_ram_size": 1024,
    "maximum_size": 8192,
    "protocol": "stlinkv2",
    "protocols": [
      "serial",
      "stlinkv2"
    ]
  },
  "name": "ST STM8S003K3 chip",
  "url": "https://www.st.com/resource/en/datasheet/stm8s003k3.pdf",
  "vendor": "ST"
}

An error occurred while creating the project: Unknown board ID stm8003k3.
What should I do? I have referred to MSP430F5521 (instead of MSP4.F5529), but did not change it

But you named the file stm8s003k3.json, so you have to reference board = stm8s003k3. You are missing the s.

I missed it when i typed it in .
Here are the errors given by the ide.
PIO Core Call Error: “The current working directory /home/jack-chen/develop/stm8/pio/emiu will be used for the project.\n\nThe next files/directories have been created in /home/jack-chen/develop/stm8/pio/emiu\ninclude - Put project header files here\nlib - Put here project specific (private) libraries\nsrc - Put project source files here\nplatformio.ini - Project Configuration File\nResolving stm8s003k3 dependencies…\nAlready up-to-date.\nUpdating metadata for the vscode IDE…\n\n\nError: Processing stm8s003k3 (platform: ststm8; board: stm8s003k3; framework: spl)\n--------------------------------------------------------------------------------\nVerbose mode can be enabled via -v, --verbose option\nError: Unknown board ID ‘stm8s003k3’\n========================== [FAILED] Took 0.54 seconds ==========================”

Unable to reproduce your error. I create my C:\Users\Max\.platformio\platforms\ststm8\boards\stm8s003k3.json with the contents you posted and do

>pio init -b stm8s003k3 --ide=vscode

The current working directory C:\Users\Max\temp\8s003k3 will be used for the project.

The next files/directories have been created in C:\Users\Max\temp\8s003k3
include - Put project header files here
lib - Put here project specific (private) libraries
src - Put project source files here
platformio.ini - Project Configuration File
Resolving stm8s003k3 dependencies...
Already up-to-date.
Updating metadata for the vscode IDE...

Project has been successfully initialized! Useful commands:
`pio run` - process/build project from the current directory
`pio run --target upload` or `pio run -t upload` - upload firmware to a target
`pio run --target clean` - clean project (remove compiled files)
`pio run --help` - additional information

and it works with initializating.

Make sure you have an up-to-date PlatformIO core (CLIpio upgrade --dev) and make sure that you don’t have other stm8@... folders in your ~/.platformio/platforms folder that the core might be looking at.

If there are any other places to set up, and how to make sure the environment is fully installed.

One thing you can do is open a CLI, then

cd /home/jack-chen/develop/stm8/pio/emiu
mkdir boards
cp /home/jack-chen/.platatformio/platforms/ststm8/boards/stm8s003k3.json boards/.
rm platformio.ini
pio init -b stm8s003k3 --ide=vscode

i.e., have the board definition inside the project itself.

When I run this command
pio init -b stm8s003k3 --ide=vscode
Command ‘pio’ not found, but there are 17 similar ones.

And that is inside that CLI I linked to?

Usage: pio init [OPTIONS]
Try ‘pio init -h’ for help.

Error: Invalid value for ‘-b’ / ‘–board’: stm8s003k3. Please search for board ID using platformio boards command

I can find stm8s003k3 on the stm8 platform, but there is also stm8s003k3 on the stm32 platform

That one shouldn’t be there, try deleting it.

used platformio boards command ,I can find stm8s003k3 on the stm32 platform.
But I’m in/home/jack - Chen /. Platformio/platforms/ststm32 / boards did not find in it.Searching for stm32 platform in PIO Home->Boards also did not find stm8s003k3

So the only stm8s003k3.json file exists in ~/.platformio/platforms/ststm8/boards now?

yes.I only created this stm8s003k3.json in this directory

I try to. Platformio/platforms/ststm8 / boards/stm8s003f3 json content in replacing the original stm8003k3. The contents of the json.The project can be created successfully.But project/.Pio/build/stm8s003f3/idedata.json content is not correct.The following

{“env_name”: “stm8s003f3”, “libsource_dirs”: ["/home/jack-chen/develop/stm8/pio/emiu/lib", “/home/jack-chen/develop/stm8/pio/emiu/.pio/libdeps/stm8s003f3”, “/home/jack-chen/.platformio/lib”], “defines”: [“F_CPU=16000000L”, “PLATFORMIO=60104”, “STM8S_003”, “STM8S003K3”, “USE_STDPERIPH_DRIVER”, “USE_STDINT”], “includes”: {“build”: ["/home/jack-chen/develop/stm8/pio/emiu/include", “/home/jack-chen/develop/stm8/pio/emiu/src”, “/home/jack-chen/develop/stm8/pio/emiu/include”, “/home/jack-chen/develop/stm8/pio/emiu/src”, “/home/jack-chen/.platformio/packages/framework-ststm8spl/Libraries/STM8S_StdPeriph_Driver/inc”, “/home/jack-chen/develop/stm8/pio/emiu/src”], “compatlib”: [], “toolchain”: []}, “cc_flags”: “-mstm8 --opt-code-size”, “cxx_flags”: “”, “cc_path”: “/home/jack-chen/.platformio/packages/toolchain-sdcc/bin/sdcc”, “cxx_path”: “/usr/bin/c++”, “gdb_path”: “/home/jack-chen/.platformio/packages/tool-stm8binutils/bin/stm8-gdb”, “prog_path”: “/home/jack-chen/develop/stm8/pio/emiu/.pio/build/stm8s003f3/firmware.elf”, “svd_path”: “/home/jack-chen/.platformio/platforms/ststm8/misc/svd/STM8S003K3.svd”, “compiler_type”: null, “targets”: [{“name”: “upload”, “group”: “Platform”, “title”: “Upload”}], “extra”: {“flash_images”: []}}

Which version of STSTM8 to download,Or which version you use.

“ST STM8 (2.1.0)” is the version of the platform I use.

Let’s make this easy. I’ve created the repository GitHub - maxgerhardt/pio-stm8s003k3.

Remove all previous stm8s003k3.json files on your computer. Then, show the output of

git clone https://github.com/maxgerhardt/pio-stm8s003k3.git
cd pio-stm8s003k3
pio run

I developed with firmware libraries, not arduino. I can just change platformio.ini, right

Yes. This is just a test. So the test project does compile for you?

Project to create a success, but how to put the. Platformio/packages/framework - ststm8spl/Libraries/STM8S_StdPeriph_Driver/the library file link to the project, or said I am going to put library copy into the lib folder.Also, how do you create this project, what are the steps.