[New Platform] STC Microcontrollers

Hi PlatformIO team,

I’d like to submit a new development platform for inclusion in the registry.

Platform

What it is

STC’s STC8 family of 8051 microcontrollers (e.g. STC8H8K64U-USB) ship with a built-in rv51 RISC-V soft-core. User C/C++ is compiled with riscv64-unknown-elf-gcc and runs on the rv51 pipeline; native 8051 ISRs handle USB CDC, timers and GPIO via ecall. This makes it the only 8051 part with practical, modern C++ support.

The build pipeline reuses the official Arduino-STC8 core’s tools/wrapper/sdcc.py wrapper, so behaviour is identical to the Arduino IDE flow.

Currently supported

  • Boards: stc8h8k64u (STC8H8K64U-USB, 64 KB Flash, 8 KB XRAM, USB-HID bootloader)

  • Frameworks: arduino (via thevien257/STC_Arduino_Core on GitHub)

  • Host OS: Windows x86_64 (Linux/macOS toolchain packages planned)

Checklist

  • Public Git repo with Apache-2.0 license

  • platform.json with all required fields (name, version, frameworks, packages)

  • Hosted package tarballs (framework + toolchain) on GitHub Releases — no file:// paths

  • Working examples/ directory: arduino-blink and arduino-multi-sensor

  • GitHub Actions CI building both examples on every push (see Actions tab in the repo)

  • README with quick-start, supported boards, clock-speed table, hardware notes

  • 77 of 80 popular Arduino libraries from the PIO Registry verified compatible (see tools/library_test_results.txt in the repo)

  • No proprietary blobs — toolchain is upstream RISC-V GCC 13.4.0; rv51 interpreter source is in the Arduino core repo

Verification


pio platform install https://github.com/thevien257/platform-stc8.git


[env:stc8h8k64u]

platform = https://github.com/thevien257/platform-stc8.git

board = stc8h8k64u

framework = arduino

Builds the blink example to 13075 bytes (5975 B rv51 interpreter + 7100 B user app) and flashes via the STC USB-HID bootloader.

Known incompatible libraries

  • fastled/FastLED — AVR-only static_assert in bitset.h

  • ncmreynolds/ld2410 — needs FreeRTOS (pdMS_TO_TICKS, vTaskDelay)

  • felias-fogg/SoftI2CMaster — hard #error "Not an AVR MCU!" from upstream

These are upstream-author choices, not platform bugs.

Happy to address any feedback. Thanks!

@thevien257

What an interesting core and concept that is, with rv51!

That is actually done via pio pkg publish on the PIO commandline. A platform is a type of package in that sense. Please review the AI output more carefully and critically next time.

A thing you should also do before publishing the platforms is to first publish the toolchain packages to the PIO registry (same pio pkg publish) so that you can reference your toolchain by just its name and version in the platform.json, without needing Python code to switch the package.

1 Like

Hi @maxgerhardt,

Thanks so much for the feedback and for pointing me in the right direction!

I appreciate the correction on using pio pkg publish. I’ll definitely follow your advice to publish the toolchain packages to the registry first so I can clean up the platform.json and drop that extra Python code.

Thanks again for your help!