From c4860d4f23fec60bcfc4d49bab7084159208bd5b Mon Sep 17 00:00:00 2001 From: David Montero Crespo Date: Wed, 19 Aug 2026 04:42:24 +0200 Subject: [PATCH] feat(boards): widen esp32Family with p4/c5 - loud failure on the absent QEMU path The overlay's ESP32-P4 (and the coming C5) run ONLY on their in-browser engines: neither chip has a QEMU machine anywhere. toQemuBoardType now throws a clear error for those families instead of booting the wrong machine and wedging on the first register. --- frontend/src/lib/proBoardRegistry.ts | 2 +- frontend/src/simulation/Esp32Bridge.ts | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/frontend/src/lib/proBoardRegistry.ts b/frontend/src/lib/proBoardRegistry.ts index f8897411..81c63e4b 100644 --- a/frontend/src/lib/proBoardRegistry.ts +++ b/frontend/src/lib/proBoardRegistry.ts @@ -54,7 +54,7 @@ export interface ProBoardDef { /** ESP32 run-path routing: the base chip the board carries. Routes the run * through the ESP32 bridge path and picks the machine/engine type. Omit for * boards that provide createSimulator (RP2350 class) or AVR/RP2040. */ - esp32Family?: 'esp32' | 'esp32-s3' | 'esp32-c3' | 'esp32-c6'; + esp32Family?: 'esp32' | 'esp32-s3' | 'esp32-c3' | 'esp32-c6' | 'esp32-p4' | 'esp32-c5'; /** QEMU-Linux run-path routing: route this kind through the Raspberry Pi * bridge (backend qemu WebSocket, VFS panel, boot terminal). The overlay * must also register a matching backend profile for the kind. */ diff --git a/frontend/src/simulation/Esp32Bridge.ts b/frontend/src/simulation/Esp32Bridge.ts index ac95d40c..03465662 100644 --- a/frontend/src/simulation/Esp32Bridge.ts +++ b/frontend/src/simulation/Esp32Bridge.ts @@ -45,6 +45,15 @@ import { generateUUID } from '../utils/uuid'; export function toQemuBoardType(kind: BoardKind): 'esp32' | 'esp32-s3' | 'esp32-c3' | 'esp32-c6' { // Overlay-registered boards carry their base chip in the registry. const proFam = getProBoard(kind)?.esp32Family; + // Chips with NO QEMU machine anywhere (backend esp_qemu_manager knows + // esp32/s3/c3 only; c6 is at least mapped): reaching this bridge means the + // JS engine was skipped for a chip that has no other path — fail loudly + // instead of booting the wrong machine and wedging on the first register. + if (proFam === 'esp32-p4' || proFam === 'esp32-c5') { + throw new Error( + `${kind}: the ${proFam} has no QEMU machine - it runs only on its in-browser engine`, + ); + } if (proFam) return proFam; if (kind === 'esp32-s3' || kind === 'xiao-esp32-s3' || kind === 'arduino-nano-esp32') return 'esp32-s3';