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.
Continue reading “Arduino Code? On My 8051? It’s More Likely Than You Think”








