Run Linux By Emulating RISC-V On A RISC-V Microcontroller

For years it was a given that it was impossible to run a Linux based operating system on a less powerful computer whose architecture lacked a memory management unit. There were projects such as uCLinux which sought to provide some tidbits to low computing power Linux users, but ultimately they came to naught. It is achievable after a fashion though, by using the limited architecture to emulate a more powerful one. It’s been done on AVR chips emulating ARM, on ARM chips, and now someone’s done it on an ESP32-C3 microcontroller, a RISC-V part running a RISC-V emulator. What’s going on?

RISC-V is an architecture specification that can be implemented at many levels from a simple microcontroller or even a pile of 74 logic to a full-fat application processor. The ESP32-C3 lies towards the less complicated end of this curve, though that’s not the whole reason for the emulation. The PSRAM storage is used by the C3 as data storage and can’t be used to run software, so to access all that memory capacity an emulator is required that in turn can use the PSRAM as its program memory. It’s a necessary trick for Espressif’s implementation of the architecture.

Surprisingly it’s not as slow as might be expected, with a boot-up time under two minutes. It’s not what we’d expect from our desktop powerhouses, but it’s not so long ago that certain lower-power full-fat processors could be just as lethargic. For past glories, see the AVR running Linux, and the RP2040.

7 thoughts on “Run Linux By Emulating RISC-V On A RISC-V Microcontroller

  1. Clever solution to unmappable SPI-based RAM. Similar troubles existing in Harvard Archtectures…
    Also, another interesting finding, having gone down this rabbit hole: apparently uClinux did not come to naught, as “NOMMU” seems to be a thing, now, and since some years.

  2. he mentions ESP32S3 can actually run code from PSRAM, is that right? doesn’t it make it much easier? what can be actually be done in Linux with a 240mhz mcu with 8MB PSRAM? they are about 6$ on aliexpress

    1. Main reason is to get easy access to a large amount of software that’s already written. For example, you get a mature network stack, filesystems and security protocols.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.