// HACKER NEWS — CYBERSECURITY
The newest ESP32 can run Linux and it's getting close to a Raspberry Pi
Espressif has a new ESP32, the ESP32-S31, and that ESP32 comes with a gigabit Ethernet MAC, a USB 2.0 High-Speed host controller, an SD card interface with two slots, and a camera input. It's a pretty standard set of features for a Linux single-board computer, but a rather strange list of things to find on a microcontroller.
I've spent a lot of time with microcontrollers, and it's typical to find a couple of cores, a small amount of RAM, GPIO pins, and maybe Wi-Fi on one. Something more advanced typically uses a Raspberry Pi, yet the ESP32-S31 comes with a whole lot more than your typical microcontroller setup. Espressif has also made a big change to the CPU that makes it more like an SBC than ever.
The biggest news about the ESP32-S31 is its networking capabilities, packing a 1000 Mbps Ethernet MAC and a big jump over the slower 100 Mbps found on the ESP32-P4. It uses an 8P8C connector (commonly referred to as RJ45) and has a PHY that utilizes the chip's RGMII interface. RGMII is specifically what enables gigabit; otherwise, it would use standard RMII.
On top of that, then, there's USB, but it's not "standard" USB. The S31 has a USB 2.0 High-Speed OTG controller, and it's a full-size Type-A socket that can supply 500 mA in host OTG mode. Alongside that sits an SDIO host controller with two slots, a DVP camera interface taking 8 to 16 bits, and a parallel LCD controller that supports up to 24-bit RGB as well as I8080 and MOTO6800 panels. There are two I2S controllers with hardware Bluetooth audio sync, fourteen capacitive touch channels, a CAN FD controller, and four MCPWM units.
Just from that list alone, it's clear that this is a new type of ESP32, and not one that we've really seen before. Wired networking? A USB host? Camera, display, audio? Everything here is more akin to an SBC than a microcontroller, but that's still not all.
On the CPU side, there are two 32-bit RISC-V cores running at up to 320 MHz and a floating point unit on each, a 128-bit SIMD data path for one of them, and a separate 40 MHz low-power core, too. Each core gets 32KB of L1 instruction cache and they share 64KB of data cache. Memory gets even more interesting: the S31 supports up to 64 MB of PSRAM over a 250 MHz 8-bit DDR interface, and supports up to 256MB of flash, too. On the ESP32-S3 the PSRAM interface was shared with flash, making this a rather big step-up.
Espressif has been using the term "MMU" for quite a long time, including on the ESP32-S3 and the ESP32-P4. However, the MMU in that case was a block that maps external flash and PSRAM to address space, nowhere near the complexity of a modern MMU that can also do things like process isolation and page tables. As a result, when Espressif said the S31 has MMU support, it appeared to be more of the same.
However, there's a big difference this time around. In the S31's datasheet, Espressif says that the cores do "Sv32 two-level page-table address translation" and implement "Machine, Supervisor and User privilege modes." Sv32 is the actual RISC-V paging scheme, and having all three privilege modes is what enables a regular kernel to run in supervisor mode with firmware underneath it in machine mode. And this is how RISC-V-based Linux machines work.
Unlike previous hacky attempts at getting Linux running on past ESP32 microcontrollers, the S31 has a lot more out of the box to natively support it. For starters, Espressif already published a Linux BSP back in August, built on Buildroot and U-Boot, and it includes a kernel, device tree, and root file system. Espressif says that it's "not yet recommended for production use," but the point is that it works.
That also hasn't stopped the community from iterating fast. One port sees Linux 6.18 running in supervisor mode, complete with working drivers for practically all of the hardware. There's another, based on Linux 7.1, that supports an 800x480 LCD panel connected, capable of showing a console. Being able to plug in a display, use wired