[*] Goal: Be able to use a visual virtual arduino board, and program it with the Arduino IDE. The result should be easily usable by newcomers to the Arduino world.
[*] Prerequisite: - AVR port and Arduino machines merged upstream - AVR flash device working (for firmware upload via IDE) This works applies to a specific circuit configuration represented as a netlist. [*] Deliverables - IDE Integration Configure QEMU with the Arduino IDE (using chardev UART0). Compile program and upload via serial. - UI: Python: Connect UART1 (via QMP or chardev), display as textbox (input is not important at this point). - QEMU: GPIO Produce script to extract GPIO devices used from the netlist. Configure QEMU devices to use the previous names/values. Publish GPIO events (name, tension as float) via a QMP socket (JSON form?). Write test which runs FreeRTOS test to generates a stable output. - UI interface (Python) Connect to the QMP socket and display the GPIO events. Now GPIOs are connected to LEDs. Represent graphical LEDS as ON/OFF. Add an oscilloscope representation (matplotlib widget). Each GPIO can be plugged into the oscilloscope channels. Add Switch and PushButton to the UI, generating QMP events which trigger GPIO input. Add push button for arduino reset (already on board) signaling the core, and switch for general power (for QEMU shutdown and start). - Test with the arduino examples Basic: "Blink: Turn an LED on and off." - QEMU: PWM Modify script to extract PWM devices used from the netlist. Configure QEMU devices to use the previous names/values. Use QEMU sound API to generate a stream of PWM values (as a wav). Add a QMP command to lookup the PWM wav stream. Write a FreeRTOS test producing a sinusoidal via PWM, verify the wav form. - UI interface (Python) Lookup wav stream via QMP socket, connect to it, display to oscilloscope view. Add graphical representation of the LED intensity to the LED. - Test with the arduino examples Analog: "Fading: Use an analog output (PWM pin) to fade an LED." - QEMU: ADC Modify script to extract ADC devices used from the netlist. Similarly to the PWM, use sound wav stream to read ADC samples. - UI: Python Add a textbox to set the ambient temperature (A thermometer is connected to some ADC pin). Use slider to set the tension sampled by the ADC (as a potentiometer) - Test with the arduino examples Analog: "Analog Input: Use a potentiometer to control the blinking of an LED." - QEMU: Other communication protocols Modify script to extract RTC (via I2C) and SD card (via SPI) from the netlist. - Propose examples to Arduino IDE for these use cases. - QEMU: Match physical electrical characteristics (extra) Use imprecise VOL/VOH output Check input within VIL/VIH range Mark input dead when out of range - Extra (fun): Connect 2 QEMU Arduino interacting with each other - UI: Python (extra++): Add Seven-Segment Display Add SSD1306 128×32 display controller or Nokia 5110 Graphic LCD Propose examples to Arduino IDE for these use cases. Co-mentor: Philippe Mathieu-Daudé <[email protected]> Co-mentor: Joaquín De Andres <[email protected]> Reference Schema: +-----+---------------------+ | | | | | | | | | | | Arduino IDE | | | | | | | | +---------------------+ | | | | | | +-----+------------------+--+ | |console +------------------+ |chardev | | | | <--+ | QEMU | PWM stream | | +-------------+ AVR core | | | | | +---+ <------+ | | | | |JSON | JSON | +------------------+ |event | event| | I/O | I/O | | | | | | +----v-----------------------------+---+ | | LED LED LED LED DIPSW | | | +---+ +---+ | | | |osc| +-----------------+ |osc| | | | +---+ | | +---+ | | | +---+ | | +---+ | | | |osc| | Arduino board | |osc| | | | +---+ | | +---+ | | | +---+ | | +---+ | | | |osc| +-----------------+ |osc| | +----> +---+ +---+ | | POT POT 7LED PWM PWM PWM | +--------------------------------------+ | | | Serial console | +--------------------------------------+ D-Bus can be considered too: +-----+---------------------+ | | | | | | | | | | | Arduino IDE | | | | | | | | +---------------------+ | | | | | | +-----+-------------+-------+ | | +-----------------+ | | <-------+ | | | QEMU +---------------+ | | | | AVR core | +-----v------+ | +---------> | | | | | | <---------+ DBUS | +-----------------+ | | | | +--+----^----+ | | +----v-------------------------v----+--+ | LED LED LED LED DIPSW | | +---+ +---+ | | |osc| +-----------------+ |osc| | | +---+ | | +---+ | | +---+ | | +---+ | | |osc| | Arduino board | |osc| | | +---+ | | +---+ | | +---+ | | +---+ | | |osc| +-----------------+ |osc| | > +---+ +---+ | | POT POT 7LED PWM PWM PWM | +--------------------------------------+ | | | Serial console | +--------------------------------------+
