// risc-v
ESP32-C3 DevKit
Seeed XIAO ESP32-C3
ESP32-C3 SuperMini
RISC-V Emulation (ESP32-C3)
ESP32-C3, XIAO ESP32-C3, and C3 SuperMini boards run on the RISC-V RV32IMC architecture at 160 MHz. Eidolon emulates them through the same QEMU-based backend as the Xtensa ESP32 family, using libqemu-riscv32 with the esp32c3-picsimlab machine target. A separate TypeScript ISA implementation lives in the repo for unit-testing RV32IMC instruction decoding, but it is not the production emulation path.
Supported Boards
| Board | CPU | Flash | RAM |
|---|---|---|---|
| ESP32-C3 | RV32IMC @ 160 MHz | 4 MB | 384 KB DRAM |
| XIAO ESP32-C3 | RV32IMC @ 160 MHz | 4 MB | 384 KB DRAM |
| C3 SuperMini | RV32IMC @ 160 MHz | 4 MB | 384 KB DRAM |
Memory Map
| Region | Base Address | Size | Description |
|---|---|---|---|
| IROM (Flash) | 0x42000000 | 4 MB | Code stored in flash |
| DROM (Flash R/O) | 0x3C000000 | 4 MB | Read-only data in flash |
| DRAM | 0x3FC80000 | 384 KB | Data RAM (stack + heap) |
| IRAM | 0x4037C000 | 384 KB | Instruction RAM (copied from flash) |
| UART0 | 0x60000000 | 1 KB | Serial port 0 (GPIO 20/21) |
| GPIO | 0x60004000 | 512 B | GPIO output / input / enable |
ISA Support
- RV32I: Full base integer instruction set (ALU, load/store, branches, JAL/JALR)
- RV32M: Multiply/divide: MUL, MULH, MULHSU, MULHU, DIV, DIVU, REM, REMU
- RV32C: 16-bit compressed instructions: C.LI, C.ADDI, C.LUI, C.J, C.JAL, C.BEQZ, C.BNEZ, C.MV, C.ADD, C.JR, C.JALR, C.LW, C.SW, C.LWSP, C.SWSP, C.SLLI, C.ADDI4SPN
Compilation Flow
When you click Compile + Run for an ESP32-C3 board:
- The backend compiles your sketch with
arduino-cliusing theesp32:esp32core. - The resulting binary is a merged 4 MB flash image: bootloader at
0x1000, partition table at0x8000, application at0x10000. - The frontend's
esp32ImageParser.tsfinds the app at offset0x10000, reads the 24-byte ESP32 image header (magic0xE9), and extracts all segments (load address + data). - Each segment is written into the correct memory region (IROM, DROM, DRAM, or IRAM) of the
Esp32C3Simulator. - The CPU starts executing from the entry point specified in the image header.
GPIO Registers
| Register | Offset | Description |
|---|---|---|
GPIO_OUT_REG | +0x04 | Current output value |
GPIO_OUT_W1TS | +0x08 | Set bits (write 1 to set) |
GPIO_OUT_W1TC | +0x0C | Clear bits (write 1 to clear) |
GPIO_ENABLE_REG | +0x20 | Output enable |
GPIO_IN_REG | +0x3C | Input pin states |
UART0
Writing a byte to 0x60000000 (UART0 FIFO) triggers the onSerialData callback, which streams characters to the Serial Monitor. Reading from the same address pops from the receive FIFO (used by Serial.read()). The UART status register always returns 0 (TX ready).
Key Source Files
| File | Role |
|---|---|
simulation/RiscVCore.ts | RV32IMC interpreter (step, MMIO hooks) |
simulation/Esp32C3Simulator.ts | ESP32-C3 peripherals, memory map, lifecycle |
utils/esp32ImageParser.ts | Parses merged flash image, extracts segments |
Full details: docs/RISCV_EMULATION.md in the repository.