ECE497 Project GameSystem

Jump to: navigation, search

thumb‎ Embedded Linux Class by Mark A. Yoder

Team members: David Savrda Ian Kowalski

GitHub link:

Grading Template

I'm using the following template to grade. Each slot is 10 points. 0 = Missing, 5=OK, 10=Wow!

09 Executive Summary - Good summary of what happen. Too bad you couldn't make it work.
08 Installation Instructions - Some details are missing (like cd'ing to buttonwrapper).
08 User Instructions - more details would help
08 Highlights - Text is too small on one video
10 Theory of Operation - Nice use of xtools
10 Work Breakdown
09 Future Work
08 Conclusions - Good conclusion, but many typos
10 Demo
10 Late (NOT)
Comments: Too bad you couldn't get the emulator to work.  Nice recovery with the Snake program.

Score:  90/100

Executive Summary

This goal of project is to make the beagleboard into a functional mobile gaming system. The idea is to use emulators, controllers, and a lcd screen to allow the user to play games from multiple systems.

We currently have a working wrapper to interpret gpio button presses and analog inputs as keypresses, and were able to hook up a lcd7cape to the bone successfully. We were additionally able to get an emulator for the sega master system running, but were not able to send inputs to it successfully. To test the wrapper, we have a simple snake game implemented in c using the shell, and it along with the wrapper are available from our github. The emulators we used are available from:

As such, we were unable to get any emulators fully running, and were unable to hook up an xbox 360 controller to the beagle bone black. For more information on our tests, please read the history section below.

Overall we feel that this project should have been doable, given a different distro of linux, as there are projects out there where people have succeeded before us. Overall, we would recommended using a full version of linux as opposed angstrom, specifically gentoo (used by bear24rw as far as we can tell) or ubuntu (has plenty of tested emulators).


As of Oct 26 we have gotten the LCD cape to work perfectly fine with the bone. However there is one important thing to note. Because the cape is an A2, the beaglebone must have a SD card that it can boot off of. This is not a huge issue but it is important to note.

It must be noted that there is no current Angstrom support for the xbox controller, and our attempts to download and install drivers for it have proved unsuccessful. We attempted to download and install xboxdrv-linux-0.8.5, but were unable to get the necessary files on angstrom to run it. As such the current state of the project must be examined. There are 2 paths that are currently open to us the first is to attempt to write a driver for the xbox360 controller to allow us to read from the controller. This path would probably take the remainder of the time allocated for the project, as neither of us know how to do that, and it will probably be quite complicated. The other path is the abandon controlling the emulator with the controller, and focus on getting the emulator up and running, and using a different control scheme. We currently discussing these potential items, and will decide shortly.

Based off of the above, we have decided to stick with our original goal of running emulators on the beagle bone. As such, we will set up our own controller to generate keypresses based off of gpio buttons. Unfortunately, this means we cannot use the lcd cape as it removes our access to gpio buttons. For now we are trying to compile and run bear24w's gamingcape emulators, as they have been installed and run on the beaglebone and run before.

Our attempts to crosscompile the gameboy emulator provided by bear24w have proven unsuccessful, as our versions of linux either will not compile (64 bit does not compile 32 bit easily and our 32 bit is encountering issues with compilers). While we were eventually able to resolve the issues with the compilers allowing us to run the ./configure file. However, during our attempts to make the file we encountered syntax errors meaning the compilers we tried to use were most likely wrong, or libraries were out of date. When attempting to use the provided binary on the beaglebone, we encountered errors with a missing library. Attempts to manually install the library failed, and we were unable to get the emulator running.

The wrapper is currently the most function item on the project. It watches the gpio ports and creates key events when a gpio port receives a signal. The SNES emulator works but requires a joystick to function and will not take input from other sources. The Sega Master system emulator runs but like stated above it does not handle key event correctly rendering the games unplayable.

So after trying 3 different emulators we finally found an emulator that works, but it still has some issue that needs to be overcome. We are currently using a SEGA master system emulator, which as successfully been run. We are currently able to run Phantasy Star, and Ultima IV. However the problem lies in the fact that the emulator does not seem to be processing input events correctly. As of current the emulator can take input from the mouse. Attempts to read the mouse input were successful, however attempting to apply these instructions to keyboard proved unsuccessful.

Unfortunately was have not managed to get any emulators working properly on the Angstrom distributions. As a result we are attempting to set up a Debian flash which according to our research should have better results then the Angstrom distro. The current goal is just to try and get some game/emulator running on the BeagleBone.

Unfortunately our attempts at using another distro have failed, so instead we have set up a simple game of snake in a shell that relies on keyboard inputs, with the gpio wrapper can be used with.

Installation Instructions

Download our repository:

GPIO_Analog wrapper: This is a simple wrapper designed to read multiple gpio and analog pins, and generate keypresses based off of them. It requires the xdotools library, which you should be able to get with "opkg install xdotool". Before running please ensure analog inputs are enabled, by following these instructions:

beagle$ SLOTS=/sys/devices/bone_capemgr.*/slots
beagle$ PINS=/sys/kernel/debug/pinctrl/44e10800.pinmux/pins
beagle$ echo cape-bone-iio > $SLOTS

The wrapper can then be run, and will interpret inputs from the gpio pins listed inside, along with ain0 and ain1. Should you choose to edit the wrapper it can be recompiled with the included make file. All files for the Wrapper are contained in the buttonwrapper folder, as such call cd ./buttonwrapper before trying to run either the makefile or the wrapper. The program is run with ./Wrapper. Keypresses will be sent to the currently selected window.

Warning!: Since this uses gpio polling, it will interfere with other programs using gpio polling when buttons are pressed

Hardware: 10 PushButtons and 2 variable potentiometers. This may be run with less hardware, and the pins are specified in the .c file. (along with pullup or pulldown, although we make no guarantees as to accuracy)

Exact wiring may vary depending on hardware, but buttons typically require inserting a wire from the pin header to the button, and another wire to ground or high, based on if it is pullup/down. Analog inputs should be powered using the analog voltage source and analog ground to ensure a minimum of noise, and a wire should go from the (typically center) output pin to analogin0 or 1.

Snake: In order to demonstrate our wrapper we set up a simple game of snake. It can be run by calling ./snake in the top level directory, or remade by calling make in the top level directory (GameSystem by default). It is controlled by keyboard inputs, and requires enter to be pressed after each button press. This is dealt with automatically in the wrapper. WASD are used for directional controls, and p is pause. CTRL C is used to quit the game.

Hardware: Some means of generating keypresses, be it via our wrapper or a keyboard. Screen for output (note that it can be run properly through ssh)

User Instructions

To run our programs, call them from the shell. Wrapper is called with ./Wrapper in the buttonwrapper folder. As noted above, it requires for analog inputs to be active to run properly. If they are not active, it will continually post errors, but should otherwise function and receive inputs from buttons. Lastly, if you edit the make file to call on Wrapper.c instead of Wrapper_ain.c it will no longer require analog inputs to be turned on. Editing the keypresses sent is relatively simple, and can be done by editing the xdotool calls in the bottom of the .c files. A list of keys is available here: . Snake is called with ./snake in the top level of the repository.


Controller Setup[1] (Too small to read text.)

Snake Example [2]

Theory of Operation

Our wrapper works by polling gpio inputs and analog inputs, and using the values there to generate keypresses by using the xtools extension for x11. This can be used to generate almost any combination of keypresses. In order to make analog inputs a feasible means of input we very rapidly poll the pins. Then, based on a deadband we decide whether or not to send an output signal. The deadband is hardcoded.

Give a high level overview of the structure of your software. Are you using GStreamer? Show a diagram of the pipeline. Are you running multiple tasks? Show what they do and how they interact.

Work Breakdown

Emulator Research - 5 hours - David

Wrapper Research - 5 hours - Ian

VisualBoy Setup - 8 hours - David/Ian

SNES Setup - 2 hours - David

Sega Master System Setup - 8 hours David/Ian

Doom Emulator Setup - 6 hours David/Ian

Wrapper - 2 hours Ian

Distro Attempts - 6 hours Ian/David

Snake - 2 hours Ian

No emulator is running and receiving inputs properly.

Future Work

This project is feasible as there are already successful versions of it out there. It may be feasible for some to try continuing this using a different operating system. Alternately, for the game boy emulator it may be possible to install the missing file using a program similar to alien and manually installing it, as attempts to manually install zlib (which contains minizip) proved unsuccessful. For the sega master system, while the emulator ran we were unable to get it to properly receive inputs, and someone else may be able to track down the bug. Additionally focusing on trying to get different distributions working on the bone may provide a more effective platform for this project.


Overall this project should be feasible, and many of our problems stemmed from our use of Angstrom as an operating system. If we were to use a stripped down version of Ubuntu or Gentoo as our operating system, this project would be significantly easier. This is because many of the libraries would be easier to download and install, in addition to many emulators having been already been tested on the operating system. From our research we were able to find out that most of these emulators where specifically designed for specific distros. This means that tracking down bugs will often be easier.

thumb‎ Embedded Linux Class by Mark A. Yoder