The 8051 was an 8-bit Harvard-architecture microcontroller first put out by Intel in 1980. They’ve since discontinued that line, but it lives on in the low-cost STC8 family of chips, which is especially popular in Asia. They’re cheap as, well, chips — under 1$ — but lack compatibility with modern toolchains. If you’re happy with C, then you’re fine, but if you want to plus-plus it up and use all those handy-dandy shortcuts provided by the Arduino ecosystem, you’re out of luck. Or rather, you were, until [Bùi Trịnh Thế Viên] aka [thevien257] came up with a workaround.
The workaround is delightfully Hack-y. One could, conceivably, port a compiler for Arduino’s Wiring to the 8051, but that’s not what [Viên] did, probably because that would be a lot of work. There isn’t even a truly modern toolchain to put plain C on this chip. Instead, [Viên] started with rv51, a RISC-V emulator written in 8051 assembly language by [cryozap]. RISC-V is a lot easier to work with and, frankly, a more useful skill to build up.
Now emulation does come with a cost: 8kB of flash memory and a 100x to 1000x slowdown in the emulated application code. For that reason, anything timing critical, like interrupts, should probably be handled the old-fashioned way. He’s targeting the STC8H8K64U specifically, so if you happen to have other STC8-based dev boards lying around, you’ll have some extra work ahead of you.
Of course, you can get ultra-cheap microcontrollers that are natively RISC V already– and they’re good enough to act as microcomputers of the era the 8051 hails from, so this hack is likely going to stay fairly niche. Still, if you’re in that niche, teaching an 8051 to speak RISC might be a handy trick to have in your back pocket.