Running Linux on an ESP32-S3

Clem Mayer's Raspberry Pi Compute Module 4-inspired project is a combination ESP32-S3, RP2040, and more — all on a single, compact PCB.

Evan Rust
7 months agoInternet of Things

Why use an OS on the ESP32?

In the maker world, most projects take either one of two paths: use a bare-metal board such as an Arduino Uno, or go with a more fully-featured board such as the the Raspberry Pi 4B. The former is a great option for performing a single task quickly, but the limited resources and flexibility of bare metal leave a lot to be desired. Otherwise, going with a full Linux operating system can handle a lot more simultaneously while also introducing additional overhead and unnecessary complexity.

On mid-tier system-on-chips (SoCs), including the ESP32 lineup, PSoC6, and other similar devices, developers have the choice of using FreeRTOS which is a lightweight, real-time operating system for handling multiple tasks, peripherals, file access, and more, yet it lacks many of the amenities of a typical Linux distribution. To element14 Presents host Clem Mayer, there had to be a better way, so he set out to create his own Linux-powered compute module integrating the ESP32-S3.

Designing the first prototype

Mayer started his endeavor by creating a schematic template based on the Compute Module 4 so that he could maintain parity with the PCB's pinouts for use in existing carrier boards. From here, he connected the ESP32-S3 SoC to power management circuitry, a USB-C port, and dual headers for interfacing with external boards. After receiving the 4-layer PCB, he assembled the components onto each side, albeit with a bit of trouble thanks to difficulty aligning the headers in parallel.

Booting up

With the requisite precompiled binary files in-hand, Mayer made a short script that performs each step in order. First, a bootloader is flashed which allows for the operating system to start up. Next, the partition table is loaded to store the filesystem's structure and other metadata, and finally, the files for the OS are loaded. The terminal's output is automatically directed to the UART interface wherein the boot messages can be observed to ensure everything is working as intended.

Room for improvements

Taking note of how basic the first version was, Mayer went back to KiCad in order to include a few more improvements. Beyond a simple boot selection switch, he added an RP2040 microcontroller IC (the same one as the Raspberry Pi Pico) so that it could be used as either a video controller or even as the primary CPU in a typical non-Linux project. Due to the chip's Programmable IO subsystem, DVI signals could theoretically be generated from the ESP32 sending commands which, in turn, display graphical primitives and text on an external display.

What can the SudoSoM do?

Although Mayer was unable to complete the GPU portion for version 2 of his SudoSoM project, the existing functionality is still quite impressive. As usual, the file directory commands such as cd and ls are present, allowing him to view files. The only writeable directory so far is /etc, and it's in here where the WiFi configuration can be set to connect to a network and enable the use of wget, FTP, SSH, or other networking utilities. This project is a great showcase of running Linux on a relatively low-spec microcontroller, and Mayer's upcoming version aims to expand it capabilities even further. For more information, you can visit the write-up here on the element14 website or watch Mayer's video on YouTube.

Evan Rust
IoT, web, and embedded systems enthusiast. Contact me for product reviews or custom project requests.
Latest articles
Sponsored articles
Related articles
Latest articles
Read more
Related articles