Update: Handheld console project

Using Yocto I was able to build an image for the Raspberry Pi. I followed the instructions in a blog post on Jumpnow Technologies blog. This got me started on making progress.

The instructions include adding a layer to your Yocto project, found here on GitHub: https://github.com/jumpnow/meta-rpi

Working with this layer gave me insight into the Yocto system and allowed me to gain a deeper understanding of the build process. It was a solid starting block for the project, which now has these steps completed:

Getting started

I built the basic console image as per instructions. It boots into the console and sets up the PiTFT 2.8″ display. The display is available as non-accelerated framebuffer on /dev/fb1, and fb0 remains as the main HDMI display. There is a blog post detailing how to get accelerated content on the PiTFT display here. Graphics acceleration ended up not being a requirement, however.

Add an emulator of your choice

I added snes9x-rpi from meta-game-emulators into the project. I patched the source code with the help of the Yocto devtool to make it compile correctly. The emulator uses the SDL library and runs games smoothly on the Raspberry Pi 3 (I upgraded).

Define video modes

The snes9x-rpi emulator, when ran, complained about “No video mode large enough for 320×240”. I found this strange as my main display on the HDMI connector was 1600×1200 and displayed the console correctly. The PiTFT also has a resolution of 320×240. The solution was to add a .bbappend file for fbset-modes recipe to include the proper video mode definitions. To get the video mode definitions, run fbset -i -fb /dev/fb* where * is the number of the frame buffer you want to query. Append the output into /etc/fb.modes file. The file is left empty on purpose in the original recipe.

fbset-modes.bbappend

# Replace concents of fb.modes with appropriate configuration

FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
# Intentionally overwrites the SRC_URI variable!
SRC_URI = "file://fb.modes"

fb.modes

mode "320x240"
    geometry 320 240 320 240 32
    timings 0 0 0 0 0 0 0
    rgba 8/16,8/8,8/0,8/24
endmode

The only purpose of fbset-modes recipe is to include this file. That is why I thought it appropriate to replace the variable contents.

Enabling audio

This was surprisingly easy. Add the following line to your config.txt on the boot partition:

dtparam=audio=on

…and add alsa to the DISTRO_FEATURES variable in your local.conf or your image recipe.

Be sure to include alsa-utils package to your image. It contains all the useful tools to control audio on your device.

Running a game

To run a game on the PiTFT display instead of the default HDMI display, define the environment variable SDL_FBDEV:

SDL_FBDEV=/dev/fb1 snes9x-rpi <romname>

Next steps

Now the basics are under control, I can move on to making the system truly mobile. There are some housekeeping related items coming up, such as removing dependencies to the Jumpnow Technologies layer, and defining my own image recipe for the build. I want only the essential packages running in the system. Another goal is to make the root file system read-only. Other goals include:

  • Connect a USB SNES controller to the system
  • Connect a battery management circuit and read battery status of the device
  • Connect a set of tiny speakers to the system for audio
  • Tie it all together with a simple launcher software that starts on boot
  • Customize the boot screens for a professional, polished look
Posted in embeddedlinux, raspberrypi | Comments Off on Update: Handheld console project

A handheld console project for Raspberry Pi

So I had a stray Raspberry Pi Model A hanging around in the cupboard which I stumbled upon just recently. Having dabbled with embedded Linux more and more recently, I figured this would be the perfect opportunity to start developing something interesting for it and put it to good use.

I have always enjoyed gaming a lot, but I never got into portable gaming. Mobile games don’t really cut it, either. It has to be something like a GameBoy, but less bulkier. Like a Nintendo DS, but more versatile. Preferably the whole system would be under my control. And a ton of battery life… Like, a TON. As much as I can comfortably hold in my hands. I hate charging devices.

I read about the topic for a while and came to the conclusion that it is very much possible to emulate older consoles on this hardware, and that software for that purpose has already existed for a long time. There are complete packages for Raspberry Pi that achieve this purpose, namely Retropie. Including this in the distro or adapting parts of it should be no problem. More of this later.

To make it extra retro, it needs a proper display. Something low-powered and already with a fitting resolution, such as 320 x 240. A crisp TFT display was found, called PiTFT. This uses the SPI bus to communicate with the Raspberry Pi. There are solutions to make the display support OpenGL accelerated sources, but that is beyond the scope of this post.

It looks awesome. Perfect for some low-res gameplay.

Other components of the system will feature small speakers, power management and distribution, and custom distribution for the Raspberry Pi. The controls will be modified later from an SNES USB controller. I’ll write a post regarding that later.

Wanting full control of the software, nothing less than a completely custom embedded Linux distribution will suffice. This will be achieved with The Yocto Project. This will enable me to build a system fully configured to my specific needs, and it’s perfect practice for bigger projects in professional environments.

I’ll update the blog with baby steps as I go figure the whole thing out.

Posted in embeddedlinux, raspberrypi | Comments Off on A handheld console project for Raspberry Pi

A Kickoff Post

I suppose I have to start somewhere, might as well do it now.

The site has really been empty for a long while now and I’m looking into changing that soon.

I have a few personal projects in mind and I was thinking I’d post some progress updates here as they go forward.

Might also involve random programming related posts.

Stay tuned!

Posted in Uncategorized | Comments Off on A Kickoff Post