Charles Lohr's Linux-Capable Really Tiny RISC-V Emulator Exists in a Single 400-Line C Header File
Electrical engineer Charles Lohr has built a 32-bit RISC-V emulator with a difference: it exists as a single C header file, of around 400 lines of code — yet is capable of running Linux, despite a lack of memory management unit (MMU).
"I've been working really hard over the last few weeks on this little tiny RISC-V emulator. The really tiny part about is is that it doesn't have an MMU which is something that virtually all desktop modern processors have," Lohr explains. "The reason I wanted to do this was I wanted to see if I could run Linux on it. Something that was close to but not as simple as an ESP32-C3. And well the answer was. Yes. In fact I was able to write a really tiny RISC-V emulator. The actual emulator part all exists in this one function in this header file and it was only around 350, 400 lines of code. And it's able to run Linux and I'm able to have executables and whatever on it."