Fix QEMU version detection and remove unsupported ESP32-S2

Sort glob results when auto-detecting QEMU binaries to reliably
pick the newest version. Previously filesystem ordering could select
an older build (8.2.0 instead of 9.0.0), missing ESP32-S3 support.

Remove ESP32-S2 from CHIP_MACHINES — the Espressif QEMU fork has
no esp32s2 machine type.
This commit is contained in:
Ryan Malloy 2026-01-28 16:59:24 -07:00
parent cb4822a0a4
commit ff138c492e
3 changed files with 8 additions and 12 deletions

View File

@ -81,7 +81,7 @@ The server auto-detects QEMU binaries from `~/.espressif/tools/`. Once available
| Tool | Description |
|------|-------------|
| `esp_qemu_start` | Launch a virtual ESP device (supports esp32, esp32s2, esp32s3, esp32c3) |
| `esp_qemu_start` | Launch a virtual ESP device (supports esp32, esp32s3, esp32c3) |
| `esp_qemu_stop` | Stop a running instance |
| `esp_qemu_list` | List all running instances |
| `esp_qemu_status` | Detailed instance info |

View File

@ -28,6 +28,7 @@ logger = logging.getLogger(__name__)
# Chip type to QEMU machine/binary/efuse mapping.
# Derived from ESP-IDF's tools/idf_py_actions/qemu_ext.py.
# Note: ESP32-S2 is not supported by the Espressif QEMU fork (no machine type exists).
CHIP_MACHINES: dict[str, dict[str, Any]] = {
"esp32": {
"machine": "esp32",
@ -44,11 +45,6 @@ CHIP_MACHINES: dict[str, dict[str, Any]] = {
"00000000"
),
},
"esp32s2": {
"machine": "esp32s2",
"arch": "xtensa",
"memory": "4M",
},
"esp32s3": {
"machine": "esp32s3",
"arch": "xtensa",
@ -168,7 +164,7 @@ class QemuManager:
4. esp_qemu_start (normal mode, same flash image) -> boot firmware
Args:
chip_type: Target chip (esp32, esp32s2, esp32s3, esp32c3)
chip_type: Target chip (esp32, esp32s3, esp32c3)
flash_image: Path to existing flash image file. Creates a blank erased
flash (all 0xFF) if not specified.
flash_size_mb: Flash size in MB when creating blank images (default: 4)

View File

@ -145,17 +145,17 @@ class ESPToolServerConfig:
import glob
if not self.qemu_xtensa_path:
matches = glob.glob(
matches = sorted(glob.glob(
str(Path.home() / ".espressif/tools/qemu-xtensa/*/qemu/bin/qemu-system-xtensa")
)
))
if matches:
self.qemu_xtensa_path = matches[-1] # latest version
self.qemu_xtensa_path = matches[-1]
logger.info(f"Auto-detected QEMU Xtensa: {self.qemu_xtensa_path}")
if not self.qemu_riscv_path:
matches = glob.glob(
matches = sorted(glob.glob(
str(Path.home() / ".espressif/tools/qemu-riscv32/*/qemu/bin/qemu-system-riscv32")
)
))
if matches:
self.qemu_riscv_path = matches[-1]
logger.info(f"Auto-detected QEMU RISC-V: {self.qemu_riscv_path}")