HN
Today

Show HN: Esp32sim – Run ESP32 firmware in the browser

This project unveils esp32sim, an open-source emulator that allows developers to run real ESP32 firmware in the browser or locally without physical hardware. It meticulously emulates multiple ESP32 SoCs, enabling rapid development and testing in a convenient, hardware-free environment. Its robust accuracy and browser-based accessibility make it a compelling tool for the embedded and web development communities.

12
Score
0
Comments
#10
Highest Rank
7h
on Front Page
First Seen
Oct 17, 3:00 PM
Last Seen
Oct 17, 9:00 PM
Rank Over Time
10101415232722

The Lowdown

Mikroverk introduces esp32sim, an ambitious open-source project designed to emulate various ESP32 System-on-Chips (SoCs) directly on a local machine or within a web browser. This emulator stands out by faithfully replicating the hardware environment, allowing developers to run unmodified, real firmware, including the mask ROM and bootloader, across both Xtensa (ESP32, S3) and RISC-V (C3, C6) architectures.

  • Comprehensive Emulation: esp32sim provides instruction-level emulation for ESP32, S3, C3, and C6 chips, supporting their respective CPU architectures (Xtensa LX6/LX7 and RISC-V RV32IMC/IMAC).
  • Authentic Firmware Execution: It boots real mask ROMs, 2nd-stage bootloaders, and unmodified application images, ensuring high fidelity to actual hardware behavior without requiring patched firmware or stubs.
  • Hardware-Free Development: The tool eliminates the need for physical ESP32 boards, cloud services, or subscriptions, offering a completely self-contained development and testing environment.
  • Browser Accessibility: Utilizing WebAssembly, esp32sim can run directly in a web browser, complete with interactive board UIs and pre-loaded demos, making it incredibly accessible for quick tests and demonstrations.
  • Extensive Peripheral Modeling: It models a wide array of SoC peripherals, including GPIO, UART, timers, SPI flash, and advanced features like virtual WiFi access points with WPA2, DHCP, and NAT to the host's network, enabling full-stack application testing.
  • Accuracy through Differential Testing: The emulator's accuracy is rigorously validated through differential testing against real silicon, comparing console outputs and even performing JTAG lock-step comparisons for the ESP32-S3 to identify and rectify subtle behavioral discrepancies.
  • Performance Optimization: For speed, it employs a block interpreter with an AArch64 JIT compiler (for Xtensa cores) and optimized scheduling, often running significantly faster than real-time for many workloads, though complex display redraws can still be a bottleneck.
  • Debugging and Scripting Tools: It includes robust debugging features like instruction tracing, breakpoints, watchpoints, and peripheral logging, alongside a scripting interface to simulate host actions at emulated times.

esp32sim offers a powerful and flexible solution for embedded systems developers, enabling more efficient and accessible development, debugging, and testing workflows for ESP32-based projects. Its commitment to open-source principles and high-fidelity emulation positions it as a valuable asset for the community.