1 / 22

Vending Machine Example

Vending Machine Example. Acknowledgements. Original code is from Chapter Five of the Upcoming Book: Building Parallel, Embedded, and Real-Time Applications with Ada by John W. McCormick, Frank Singhoff , and Jerome Hugues. Get the Tutorial Files. Let’s get the necessary files

Download Presentation

Vending Machine Example

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Vending Machine Example

  2. Acknowledgements • Original code is from Chapter Five of the Upcoming Book: Building Parallel, Embedded, and Real-Time Applications with Ada byJohn W. McCormick, Frank Singhoff, and Jerome Hugues

  3. Get the Tutorial Files • Let’s get the necessary files • cd /home/liveuser • tar xvf /tutorial.tar.bz2

  4. Tutorial Directories

  5. Scripts • env.sh – set necessary environment variables for compiling/running • run-qemu – run RTEMS examples under Qemu • README-building-RTEMS-Ada.html – instructions • build_rtems – script for building RTEMS with GNAT Ada 2005 from source code under GNU/Linux • get_rtems – script to get RTEMS source code from RTEMS CVS repository • get_ada-examples – script to get RTEMS Ada example source code from the RTEMS CVS repository

  6. Vending Example Subdirectories • original – version from book (native) • shared – source shared across examples • random_native, random_rtems – random orders • web_native, web_rtems – embedded web server • shell_rtems – RTEMS command line • rootfs – root file system directory for web_rtems and shell_rtems

  7. Canonical Coffee Vending Machine selection drink User Interface Vending Machine Core Logic Dispenser reload Inventory report

  8. Original Version • Directory: original • Characteristics: • Single Ada file • No packages • Main has loop which makes random orders

  9. Enhancements • Refactored to have Vending_Machine package • Added Reload and Report subprograms • Added Dispenser package to interface to dispensing hardware • e.g. same specification file, different body for hardware • Added Inventory package • Source for all of the above is in shared/

  10. Time To Build Them • Let’s build the various vending variations • source /home/liveuser/scripts/env.sh • cd /home/liveuser/vending-example • make • When that works for everyone, we will look at the individual examples

  11. Shared Files

  12. Random Input Version • Directory: random_native and random_rtems • Characteristics: • Ada Main has loop which makes random orders • Main is based on Main in original version • Fixed set of add-ins requested (e.g. sugar, etc) • Similar in spirit to an automated system test

  13. Running the Random Input Version • Run it natively • cdrandom_native • ./random • Run it on RTEMS • cdrandom_rtems • /home/liveuser/scripts/run-qemu random.exe • Output will come to terminal on both • Should appear similar

  14. Web Interface Vending Machine selection drink Web Interface to Embedded Mongoose Web Server Vending Machine Core Logic Dispenser reload Inventory report

  15. Web Interface Version • Directory: web_native and web_rtems • Characteristics: • Includes Mongoose embedded web server • http://code.google.com/p/mongoose/ • User interface is provided by browser • User requests add-ins, reports, reload, etc.

  16. Web Interface Version (continued) • Mix of C webserver (Mongoose) with Ada application code • RTEMS version is simple but complete embedded application • Native URL: http://localhost:8080/ • RTEMS URL: http://10.0.2.5/

  17. Running the Web Interface Version • Run it natively • cdweb_native • ./web_vending • *** direct browser to http://localhost:8080/ • Run it on RTEMS • cdweb_rtems • su • source /home/liveuser/scripts/env.sh • /home/liveuser/scripts/run-qemu web_vending.exe • *** direct browser to http://10.0.2.5/ • Except for stack and cpu usage reporting, the versions should be identical to user

  18. Command Line Interface Vending Machine selection drink Command Line Interface to RTEMS Shell Vending Machine Core Logic Dispenser reload Inventory report

  19. RTEMS Shell Version • Directory: shell_rtems • Characteristics: • Provides command interface to vending machine • Typical of diagnostics interface • Both shell and web interfaces could coexist • Command interface could be available via telnet • Complete small embedded system

  20. Running the Command Line Interface Version • Run it on RTEMS • cdshell_rtems • su • source /home/liveuser/scripts/env.sh • /home/liveuser/scripts/run-qemu shell.exe • *** login as rtems • *** command is vend

  21. Your Turn • Modify web_rtems and/or shell_rtems • Allow the user to request multiple add ins (e.g. 2 sugars) • Allow the user to request a stronger beverage (e.g. a double shot of coffee) • Add a new beverage (e.g. decaffeinated coffee) • Add a payment interface • ???

More Related