qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [GSoC/Outreachy] Arduino complete setup visualization and emulation


From: Stefan Hajnoczi
Subject: Re: [GSoC/Outreachy] Arduino complete setup visualization and emulation
Date: Tue, 11 Feb 2020 10:51:19 +0000

On Mon, Feb 10, 2020 at 08:58:28PM +0100, Philippe Mathieu-Daudé wrote:

Cool, thanks for proposing this idea!

> [*] 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.

Out of curiosity, how does this compare to existing Arduino simulators?

> [*] Prerequisite:
> 
> - AVR port and Arduino machines merged upstream
> - AVR flash device working (for firmware upload via IDE)

How likely is it that these dependencies will be merged by May 18th
(start of the coding period)?  If they are not merged then the intern
will not be able to get their own patches into qemu.git.

> This works applies to a specific circuit configuration represented as
> a netlist.
> 
> [*] Deliverables
> 
> - IDE Integration
>   Configure QEMU with the Arduino IDE (using chardev UART0).

This (https://www.arduino.cc/en/Main/Software) Java program?  Please add
links to relevant code bases, hardware specs, file formats, etc so that
someone considering the project idea can research it.

I also see Python mentioned in this project idea.  Does the intern need
to be fluent in C, Python, and Java?  Please include skill/language
requirements in the text.

>   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."

The tasks above could already take 12 weeks.  Especially the new QMP
commands and the UI code could be non-trivial.

I think newcomers will have a hard time designing QMP commands.  It
would help to provide the QMP command documentation so the intern
doesn't need to make design decisions in a space they are unfamiliar
with.

When Steffen Görtz experimented with similar things using the micro:bit
emulation I remember emulation timing issues were a little tricky.
Emitting LED/PWM output and displaying it without timing glitches is
non-trivial since QEMU is not very precise and guest software might be
bit banging.

> - 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.

The scope of the project seems large for 12 weeks.  It could scare off
applicants or be unrealistic for an intern without lots of experience.
You could remove some tasks from the project idea and if the intern is
really quick then you can always give them additional tasks later.

> Co-mentor: Philippe Mathieu-Daudé <address@hidden>
> Co-mentor: Joaquín De Andres <address@hidden>
> 
> 
> 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              |
>      +--------------------------------------+

"Arduino IDE" and "QEMU" are clear.  Is the "Arduino board" component
the Python UI application?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]