HN
Today

Linux on ESP32

A determined hacker has squeezed Linux 6.12 with Sv32 virtual memory onto an ESP32-S31 microcontroller, pushing the boundaries of what's possible on resource-constrained hardware. This impressive low-level port sparks debate on its practicality, the quirks of the S31's MMU, and the increasingly prevalent 'vibe-coding' approach in open-source projects.

59
Score
25
Comments
#5
Highest Rank
7h
on Front Page
First Seen
Aug 1, 2:00 PM
Last Seen
Aug 1, 8:00 PM
Rank Over Time
2151311202317

The Lowdown

This project details a remarkable endeavor to port Linux 6.12, complete with Sv32 virtual memory, Supervisor mode, and an XIP (Execute In Place) kernel, to the Espressif ESP32-S31 microcontroller. Targeting the ESP32-S31-WROOM-3 E1H16R16V, this is an experimental hardware bring-up project, explicitly not intended for production.

  • The port includes a Buildroot rootfs, and stable support for reboot and poweroff, but many peripheral and connectivity drivers are currently "Untested," "WIP" (Work In Progress), or "Not Implemented."
  • Significant challenges involved implementing a custom CLIC driver due to the S31's non-standard interrupt controller, navigating its unique Supervisor mode, and modifying OpenSBI to use XIP for crucial PSRAM savings.
  • The author explicitly chose Linux 6.12 because newer mainline Linux kernels lack RISC-V XIP support, which is essential for this memory-constrained environment.
  • In the FAQ, the author explains why SMP (Symmetric Multiprocessing) is not planned, citing issues like closed-source radio firmware, heterogeneous cores, slow PSRAM, and the complexities of cache maintenance and IPC, preferring to treat the S31 as a single-core system for this specific port.

This project stands as a testament to deep technical curiosity and the art of low-level systems programming, demonstrating the surprising capabilities of microcontrollers when pushed to their limits, even if it's far from a polished, production-ready solution.

The Gossip

Vibe-Check or Viable Code?

Many commenters questioned the project's status, noting the extensive "Untested" or "WIP" tags in the README. This led to a discussion on "vibe-coding" – the idea that projects might be superficially presented or even AI-generated. While some found it an interesting proof-of-concept despite the lack of thorough documentation, others expressed frustration at the perceived lack of substance, though some defended the author's prior work and personal motivation.

MMU Muddle and Microcontroller Might

A central technical debate revolved around the ESP32-S31's Memory Management Unit (MMU). Initial questions arose about how Linux could run without an MMU, which was clarified by the fact the S31 *does* have one, unlike earlier ESP32-S3 models. However, further discussion questioned if it was a "true" Sv32 compliant MMU with full process isolation or a more limited peripheral, with later comments citing Espressif's datasheet confirming Sv32 compliance. The implications for running standard ELF binaries on an MMU-less system were also touched upon.

XIP's Existential Quandary

The project's reliance on Linux kernel 6.12 for its RISC-V Execute-In-Place (XIP) support sparked concern. Commenters noted that XIP support for RISC-V was removed from mainline Linux, raising questions about the long-term viability and "dead-end" nature of building on this specific, older kernel version.

Operating System Opticals

Some participants pondered whether Linux was the optimal choice for the ESP32-S31's constrained resources. Questions were raised if a lighter-weight operating system like NetBSD might be a better fit, and one commenter humorously inquired about the perennial "Can it run Doom?" challenge, highlighting the community's general fascination with pushing hardware limits.