If you experience any difficulty in accessing content on our website, please contact us at 1-866-333-8917 or email us at support@chicagovps.net and we will make every effort to assist you.

By
March 4, 2024

Achieving RISC-V Emulation: Introducing Linux to CH32V003

 

Do you enjoy using Linux on devices with low power? The ultimate experience might just be provided by the linux-ch32v003 project brought to you by [tvlad1234]. This is something you could actually build yourself as it hardly needs any extra components.

An 8 MB PSRAM chip is used for RAM supplementation, and an SD card, coupled with a bit of trimming on the Linux .config parameters, makes it possible to operate Linux on a chip never initially meant to handle this much power. The five-minute boot-up time is all part of the adventure.

And of course, there’s a twist in every [tvlad1234] project! This time, it’s the possibility of running Linux on this chip courtesy of the mini-rv32ima project by [chlohr], a RISC-V emulator. An emulator provides the means to map the PSRAM chip into RAM, as the MCU cannot do so on its own. And after applying a substantial amount of work, [tvlad1234] shares the buildroot and mainline Linux kernel configs that you can compile yourself, plus a GitHub KiCad board project ready for a single layer. Yup, you can literally etch a PCB for this straight from a piece of single-sided copper-clad FR4 using a little FeCl3.

While the CH32V003 might be a more attractive platform for Linux, the RP2040 Linux project might be more feasible if you already have the majority of components on hand. Not until we begin appreciating the CH32V003 for all of its amazing capabilities!

“It’s possible you might be able to create a PCB for this project…”

One could question whether this Linux system could be hooked up to a larger display, KiCAD installed on it, this board designed within KiCAD, then using software on this Linux system to convert KiCAD into gerbers and then into Gcode for this board’s routing, and finally, using another one of these Linux systems to control the CNC machine that is completing the routing?

Probably not, considering the limited system resources (up to 8 MB RAM) and the low performance as I suspect the chip only operates at 48 MHz and it utilizes an emulator.

Interesting, but what’s the reason behind it? I always believed that the primary objective of Linux was to serve as an aggregation of affordable device drivers.

That’s the reason why Android uses Linux as its foundation, after all.

Windows 9x followed a similar path with DOS, in essence.

The DOS that was integrally shifted into its own virtual machine served the purpose of maintaining the functionality of old device drivers (CD-ROM, specialized network stacks and so on).

Why? Because you can. And it may be the cheapest MCU to run Linux on.

That said, much more powerful is ESP32 with FabGL, which can emulate: CP/M, MS-DOS, FreeDOS, Windows 3.1 and Linux ELKS.

yeah it’s an amusing experiment, I certainly enjoyed seeing it work enough to write an article about it ^^^

As a tech demo, it’s indeed impressive, I think. 😎

Indeed, your points make sense for all the operating systems you discussed, with the exception of Linux.

Linux operates under the principle of anti-binary compatibility, subscribing to the belief that assembler code and processor dependency are undesirable.

Instead, Linux emphasizes the use of C++. Rust and C# may also feature, eventually.

x86 Linux could be considered an exception, owing to the commercial products (binaries) that have actually been developed for it.

Such products necessitate the presence of pre-compiled packages, which, in turn, requires maintaining compatibility.

If not for this, Linux’s relevance would diminish. Alternatives like BSD could be employed just as effectively. As it stands, Linux’s main function is to offer a vast array of free drivers, courtesy of volunteers.

But who requires those drivers in a simulated setting?

The scarce emulation can’t supply anything substantial that would warrant the need for those Linux drivers, kernel modules, daemons etc.

Moreover, there are tons of drivers produced by commercially paid corporations for Linux, operating concurrently with volunteers.

I’m curious as to why uClinux wasn’t used in this scenario… It seems like a series of alterations to facilitate non-MMU systems to operate with Linux.

https://en.wikipedia.org/wiki/%CE%9CClinux

FireFox has approximately 39 million lines of code, as recognized during an installation on a Banana Pi M4 zero. Actually, this was an installation across three devices.

https://openhub.net/p/firefox/analyses/latest/languages_summary

The experiment was a success.

In future, can we expect FireFox to see a port to RISC-V platforms?


ChicagoVPS is your gateway to unparalleled hosting solutions. Our state-of-the-art datacenters and powerful network ensures lightning-fast speeds and uninterrupted connectivity for your websites and applications. Whether you’re a startup looking for scalable resources or an enterprise in need of enterprise-grade hosting, our range of plans and customizable solutions guarantee a perfect fit. Trust in ChicagoVPS to deliver excellence, combining unmatched reliability and top-tier support.

For Inquiries or to receive a personalized quote, please reach out to us through our contact form here or email us at sales@chicagovps.net.

Subscribe Email

Top