feat: add MicroPython support for ESP32-C3 (RISC-V) boards

ESP32-C3 already uses the QEMU backend via Esp32Bridge, not browser-side
emulation. This adds MicroPython support by including C3 in the supported
set, adding the C3 firmware variant to the loader, and bundling the
fallback firmware binary.

Also fixes misleading type comments that said "browser emulation" for C3
boards — they actually use QEMU backend.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
feature/micropython-rp2040
David Montero Crespo 2026-03-29 23:40:05 -03:00
parent 7c9fd0bf2b
commit 0bc4c031d1
3 changed files with 16 additions and 4 deletions

Binary file not shown.

View File

@ -26,13 +26,21 @@ const FIRMWARE_MAP: Record<string, FirmwareConfig> = {
cacheKey: 'micropython-esp32s3-v1.20.0', cacheKey: 'micropython-esp32s3-v1.20.0',
fallback: '/firmware/micropython-esp32s3.bin', fallback: '/firmware/micropython-esp32s3.bin',
}, },
'esp32-c3': {
remote: 'https://micropython.org/resources/firmware/ESP32_GENERIC_C3-20230426-v1.20.0.bin',
cacheKey: 'micropython-esp32c3-v1.20.0',
fallback: '/firmware/micropython-esp32c3.bin',
},
}; };
/** Map any ESP32-family board kind to firmware variant key */ /** Map any ESP32-family board kind to firmware variant key */
function toFirmwareVariant(boardKind: BoardKind): 'esp32' | 'esp32-s3' { function toFirmwareVariant(boardKind: BoardKind): 'esp32' | 'esp32-s3' | 'esp32-c3' {
if (boardKind === 'esp32-s3' || boardKind === 'xiao-esp32-s3' || boardKind === 'arduino-nano-esp32') { if (boardKind === 'esp32-s3' || boardKind === 'xiao-esp32-s3' || boardKind === 'arduino-nano-esp32') {
return 'esp32-s3'; return 'esp32-s3';
} }
if (boardKind === 'esp32-c3' || boardKind === 'xiao-esp32-c3' || boardKind === 'aitewinrobot-esp32c3-supermini') {
return 'esp32-c3';
}
return 'esp32'; return 'esp32';
} }

View File

@ -12,9 +12,9 @@ export type BoardKind =
| 'esp32-s3' // Xtensa LX7, QEMU backend | 'esp32-s3' // Xtensa LX7, QEMU backend
| 'xiao-esp32-s3' // Seeed XIAO ESP32-S3, QEMU (esp32-s3) | 'xiao-esp32-s3' // Seeed XIAO ESP32-S3, QEMU (esp32-s3)
| 'arduino-nano-esp32' // Arduino Nano ESP32 (S3), QEMU (esp32-s3) | 'arduino-nano-esp32' // Arduino Nano ESP32 (S3), QEMU (esp32-s3)
| 'esp32-c3' // RISC-V RV32IMC, browser emulation (Esp32C3Simulator) | 'esp32-c3' // RISC-V RV32IMC, QEMU backend
| 'xiao-esp32-c3' // Seeed XIAO ESP32-C3, browser emulation (Esp32C3Simulator) | 'xiao-esp32-c3' // Seeed XIAO ESP32-C3, QEMU backend
| 'aitewinrobot-esp32c3-supermini' // ESP32-C3 SuperMini, browser emulation (Esp32C3Simulator) | 'aitewinrobot-esp32c3-supermini' // ESP32-C3 SuperMini, QEMU backend
| 'attiny85'; // AVR ATtiny85, browser emulation (avr8js) | 'attiny85'; // AVR ATtiny85, browser emulation (avr8js)
export type LanguageMode = 'arduino' | 'micropython'; export type LanguageMode = 'arduino' | 'micropython';
@ -31,6 +31,10 @@ export const BOARD_SUPPORTS_MICROPYTHON = new Set<BoardKind>([
'esp32-s3', 'esp32-s3',
'xiao-esp32-s3', 'xiao-esp32-s3',
'arduino-nano-esp32', 'arduino-nano-esp32',
// ESP32-C3 RISC-V (QEMU bridge)
'esp32-c3',
'xiao-esp32-c3',
'aitewinrobot-esp32c3-supermini',
]); ]);
export interface BoardInstance { export interface BoardInstance {