A Cross-Model Dual-Agent Framework with Sequential Human-in-the-Loop Safety Interlocks for Zero-Config ESP32 Embedded Firmware Synthesis
Developing embedded firmware for microcontrollers such as the ESP32 usually requires prior knowledge of C++ programming, hardware pinouts, electrical constraints, and vendor-specific library rules. While Large Language Models (LLMs) can generate basic microcontroller code from natural language prompts, single-agent code generation frequently fails on real hardware due to silent pin conflicts, incompatible legacy libraries, and physical actuator violations. In this paper, we present a zero-config, dual-agent firmware synthesis framework that translates both English and code-mixed Hinglish voice or text commands into verified ESP32 C++ firmware without requiring manual configuration files. Our architecture separates firmware drafting (openai/gpt-oss-120b) from hardware safety auditing (qwen/qwen3.8-27b), enforces sequential Human-in-the-Loop (HITL) negotiation whenever dangerous silicon pins or physical limits are violated, automatically installs missing libraries via arduino-cli, and verifies execution using closed-loop UART serial acknowledgements (HW_EXECUTION_COMPLETE). Evaluated across 121 physical hardware-in-the-loop trials involving RGB LEDs, SG90 Servo Motors, and Active Buzzers, the framework achieved an 85.1% overall compilation rate (93.3% post-adaptation), an 89.4% closed-loop hardware confirmation rate, and 100.0% silicon safety enforcement across all 26/26 adversarial trap prompts (where 92.3% of raw single-agent drafts contained unsafe hardware violations).
Authors
- Shubh Kumar Srivastava
Publication Details
- Journal
- Zenodo (CERN European Organization for Nuclear Research)
- Published
- 2026-11-29
- DOI
- https://doi.org/10.5281/zenodo.24657207
- Primary Topic
- Embedded Systems Design Techniques
- Type
- preprint