The 8051 is a 40-year-old 8-bit architecture that has never had modern C++ compiler support — until now. This project brings full C++ to the STC8H8K64U, a modern 8051 chip that costs less than $1, by running a RISC-V emulator (rv51) on it. Your sketch compiles with GCC 13.4.0, and uploads directly over USB — no programmer or serial adapter needed.
Source code and full documentation available here: https://github.com/thevien257/STC_Arduino_Core
How It WorksA lightweight RISC-V emulator runs on the 8051, allowing the chip to execute RISC-V binaries compiled by GCC 13.4.0. Timing-critical code such as ISRs still runs as native 8051 at full 24 MHz speed.
The result is full C++ support — classes, templates, String — on hardware that previously only supported C or assembly.
Quick InstallAdd this URL to Arduino IDE → Preferences → Additional Boards Manager URLs:
https://raw.githubusercontent.com/thevien257/STC_Arduino_Core/main/package_stc8051_index.json
Then install STC Boards from Boards Manager, and run:
pip install hidapiExample — Blink + Serial
void setup() {
pinMode(P3_4, OUTPUT);
Serial.begin(9600);
Serial.println("Hello from STC8H!");
}
void loop() {
digitalWrite(P3_4, HIGH);
Serial.println("LED ON");
delay(1000);
digitalWrite(P3_4, LOW);
Serial.println("LED OFF");
delay(1000);
} Features- Full C++ via RISC-V GCC 13.4.0
- USB upload — no programmer, no serial adapter
- Full Arduino IDE integration
- Serial (USB CDC + 2 UARTs), Wire, SPI, EEPROM, SoftwareSerial
- FreeRTOS support
- Most standard Arduino libraries work out of the box
- Timing-critical ISRs run natively at 24 MHz
- Cross-platform: Linux & Windows
Emulated code runs approximately 100–1000× slower than native 8051. This is fine for most Arduino-style tasks such as reading sensors, driving displays, and communicating over serial. macOS is not yet supported.





Comments