Hardware Flashing & Serial Monitor
The Web Serial Bridge (webSerialHardware.js)
OpenHW Studio uses the browser's navigator.serial API to talk directly to physical boards.
- Vendor Filtering: The
DEFAULT_SERIAL_USB_FILTERSarray isolates relevant microcontrollers by filtering USB Vendor IDs (e.g., Arduino0x2341, Espressif0x303A, Raspberry Pi0x2E8A). - Stream Management: Implements read/write loops using
TextEncoderandTextDecoderstreams to pipe data into the frontendSimulationConsole.
Firmware Flashing (useHardwareFlashing.js)
When a user wants to push their code to a physical board:
- The frontend hits the Compiler Backend to get the compiled Hex/UF2 binary.
- The
flashFirmwarehook takes over, opening the serial port at the correcthardwareBaudRate. - It applies the necessary
hardwareResetMethod(e.g., toggling DTR/RTS for ESP32/Arduino) to push the board into bootloader mode before streaming the binary.
