esp32sim README

项目的 README,来自 github.com/mikroverk/esp32sim。合并为一个 markdown 文件:README.md。

esp32sim logo: a smiling chip in an emulator window

esp32sim

esp32sim is an ESP32 emulator written in Rust. It runs real ESP32 firmware on your computer or in a browser tab, without the hardware.

It boots the chip's own mask ROM, the real second-stage bootloader and your unmodified application. It also models the board around the chip: displays, touch, LEDs, buttons, audio, camera and WiFi.

Try it in your browser, nothing to install: https://mikroverk.github.io/esp32sim/

--chip esp32 --board ai-thinker-cam --cam-image image.ppm supplies the AI-Thinker ESP32-CAM's OV2640 with a BMP/PPM still image. Capture supports raw RGB565/YUV422 into internal DRAM at a fixed approximate 10 FPS; the usual JPEG+PSRAM CameraWebServer path is unsupported. See the camera scope and example.

Supported chips

Chip CPU Status Boards
ESP32-S3 2 x Xtensa LX7 mature Atech 14-port kit, Waveshare Touch-LCD-4B, Touch-AMOLED-1.8, ESP32-S3-CAM
ESP32-C3 RISC-V RV32IMC draft console only
ESP32-C6 RISC-V RV32IMAC draft Waveshare ESP32-C6-LCD-1.47 (with the 802.15.4 radio), Seeed XIAO ESP32-C6
ESP32 (classic) 2 x Xtensa LX6 early LilyGO TTGO T-Display, ESP32-2432S028 "Cheap Yellow Display", AI-Thinker ESP32-CAM (raw capture), Ulanzi TC001
ESP32-P4 (rev < 3 and rev ≥ 3) 2 x RISC-V RV32IMAFC draft Waveshare ESP32-P4-WIFI6-Touch-LCD-3.5 (rev ≥ 3); WiFi through an emulated ESP32-C6 co-processor on SDIO (ESP-Hosted)
ESP32-S31 2 x RISC-V RV32IMAFC draft Espressif ESP-Mosaico (display, touch, WiFi, audio, IMU, keys); IDF v6.1

Features

Demos

These run on the demo site:

You can also load your own firmware for any of the chips.

Quick start

No Rust needed: the releases carry prebuilt binaries for macOS and Linux, and docs/quick-start.md takes your own build from the tarball to a run in three steps. From a checkout:

cargo build --release
tools/fetch-demo-assets.sh --no-linux       # downloads the mask ROMs, which are not in the repo

FW=web/wasm/fw/public                       # demo firmware included in the repo
./target/release/esp32sim --boot rom --rom web/wasm/fw/esp32s3_rev0_rom.elf \
    --bootloader $FW/atech-bootloader.bin --ptable $FW/atech-ptable.bin --app $FW/atech-firmware.bin \
    --script $FW/atech-script1.txt --wav out.wav --tft-png tft.png --max-seconds 5

This boots the Atech synth firmware, plays a short script, and saves the audio to out.wav and the display to tft.png. Use esp32sim-c3, esp32sim-c6, esp32sim-p4, esp32sim-s31 or --chip esp32 for the other chips.

Getting started covers the rest: your own ESP-IDF builds, each chip, WiFi, scripts, the browser build and debugging.

Documentation

Contributing

Bug fixes, peripherals, boards and new chips are welcome. CONTRIBUTING.md lists what a pull request needs; these are the same checks CI runs. Security problems go through SECURITY.md, not the public issue tracker.

Credits and license

esp32sim is released under the MIT License.

Authors: Joakim Eriksson, RISE (@joakimeriksson), Alice (@aliceisjustplaying) and Mattia Fiumara, Schematik (@mfiumara), together with other contributors.

The emulator was written from the ESP-IDF register headers, the Xtensa core configuration that ships with ESP-IDF, the RISC-V specification, the chips' technical reference manuals and observed firmware behaviour. QEMU was consulted only to confirm instruction semantics; no code was copied.

esp32sim is unofficial and not affiliated with Espressif Systems.

Third-party code, data and demo files keep their own licenses:

esp32sim (mikroverk/esp32sim)

正在搜索数据库…

这是什么?esp32sim 是一个开源的指令级模拟器,支持四款 ESP32 芯片(经典 ESP32、S3、C3、C6)。它能启动真实的掩膜 ROM、引导程序和未经修改的应用镜像,无需打补丁的固件,也不需要任何硬件。
这是命令行工具,还是可以在浏览器里运行的程序?两者兼有:它既是原生命令行模拟器(esp32sim、esp32sim-c3、esp32sim-c6),也可以把同一个模拟器编译为 WebAssembly,从而无需安装,直接在浏览器中运行。
我怎样让固件在里面运行?可以打开托管的浏览器演示版并点击 Boot 快速体验;也可以运行对应的命令行命令,从磁盘加载你自己的固件镜像,并选择所需的开发板或芯片(esp32c3 / esp32c6)。
我需要真实的 ESP32 开发板或 Espressif 账号才能使用吗?不需要。它完全通过软件启动真实的 ROM 和引导程序镜像,无需云账户、无需订阅,也不需要任何物理硬件。
C3 和 C6 模拟器有 S3 那么成熟吗?没有。经典 ESP32 和 S3 的支持已经比较成熟,但 C3 和 C6 的 RISC-V 模拟器仍标记为“草稿”(draft),目前运行在普通解释器上,而不是 JIT。
快速的 JIT 必须依赖 Apple Silicon 吗?其他平台也能用吗?S3 的速度来自将热点指令块编译为原生 AArch64 代码。在其他 CPU 架构上,你可以传入 --no-jit 回退到普通解释器,其结果保证完全一致。
整个项目都是 MIT 许可证吗,包括它附带的演示固件?esp32sim 本身采用 MIT 许可证,但它会获取或打包第三方固件和数据(例如 Linux 内核镜像)。这些内容保留各自的许可证,有时并不相同,比如 GPL-3.0。
ESP32-S3 能模拟哪些开发板和外设?S3 可以模拟 ST7735 等显示屏、分辨率为 480x480 的触摸屏 ST7701S、WS2812 LED、摄像头和音频,并支持 LilyGO TTGO T-Display 和 Touch-LCD-4B 面板等开发板。
这个模拟器与真实硬件相比有多准确?每款芯片都与实体开发板进行了差分测试:S3 在 JTAG 逐步同步模式下运行数千步,PC 零偏差;C3 和 C6 分别在 208 行中的 205 行、204 行中的 203 行上,与采集到的真实硬件控制台输出一致。
模拟器的运行速度与实时相比如何?S3 结合了块解释器和 AArch64 JIT,每秒可执行约 1.5–2.4 亿条指令,足以实时运行真实固件(例如合成器应用)。只有在屏幕重绘最繁重时会短暂卡顿,随后恢复。
固件在模拟器中运行时,我能调试吗?可以。--trace、--break ADDR、--watch ADDR、--peek 和 --profile 等参数可以让你逐步跟踪执行过程并检查内存;另外还可以通过环境变量记录 SPI、WiFi、AES 和 SHA 等外设的活动。
作者
mikroverk
大小
73.8 MB
星标
1.2K
时长
2个月
提交 · 90 天