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.
This commit is contained in:
David Montero Crespo 2026-08-19 04:42:24 +02:00
parent 149fbee1e9
commit c4860d4f23
2 changed files with 10 additions and 1 deletions

View File

@ -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. */

View File

@ -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';