Skip to content
This repository has been archived by the owner on Oct 12, 2020. It is now read-only.

Raspberry Pi

LGB edited this page Apr 25, 2016 · 10 revisions

Xep128 on Raspberry Pi

Xep128 is able to run on Raspberry Pi, though it's not a straightforward way to do so. Currently, no Makefile is created for cross-compiling, so you must compile Xep128 on the Raspberry Pi itself, which is quite slow. You must also compile SDL 2.0.4 as well. Other than these, Xep128 is able to run without any modification on the build process compared to the Linux way (hey, after all, Raspberry Pi also runs Linux ...). Of course the preparation work (Raspberry Pi, SDL related) is another story.

Note: SDL on raspberry uses full screen mode and does not require the "GUI" (X). Please start if from text mode! Also it's great, since not having X installed still allows to use SDL programs, wow :) Having X installed and starting Xep128 from there may even cause problems and/or slow downs! GUI sucks :)

Somewhat lame video showing Xep128 running on Raspberry Pi model 1 (it's a quite boring video, you may want to seek near the middle ...):

https://www.youtube.com/watch?v=n-qYMUGZaAs

Build Xep128 on Raspberry Pi

I used a good old model 1 B+. Personally I found SD card too slow and I also worried the intensive usage during my various test to "wear out" of the card. So I set up NFS mount from my PC and I used a chroot environment for my tests, but it doesn't matter too much.

Steps:

  • Have an up-to-date system: sudo apt-get update then sudo apt-get dist-upgrade
  • Update firmware: sudo rpi-update
  • It's recommended to have a reboot at this point, as maybe new kernel or other important system component is upgraded.
  • Raspberry specific packages: sudo apt-get install libraspberrypi0 libraspberrypi-bin libraspberrypi-dev
  • Components you need for SDL: sudo apt-get install build-essential libfreeimage-dev libopenal-dev libpango1.0-dev libsndfile-dev libudev-dev libasound2-dev libjpeg8-dev libtiff5-dev libwebp-dev automake
  • Download SDL source: wget https://www.libsdl.org/release/SDL2-2.0.4.tar.gz
  • Unpack: tar zxvf SDL2-2.0.4.tar.gz
  • Create a build directory, change there: cd SDL2-2.0.4 && mkdir build && cd build
  • Configure SDL before compiling: ../configure --host=armv7l-raspberry-linux-gnueabihf --disable-pulseaudio --disable-esd --disable-video-mir --disable-video-wayland --disable-video-x11 --disable-video-opengl
  • --host=armv7l-raspberry-linux-gnueabihf is for Raspberry Pi 2, leave that out on Raspberry 1
  • Start the build process: make
  • Install (the hopefully successfully) compiled SDL: sudo make install
  • Note: you may have need to have /usr/local/bin in your PATH for Xep128 compilation then ...
  • Install git: sudo apt-get install git
  • Download Xep128 source from gitub.com repository: git clone https://github.com/lgblgblgb/xep128.git
  • cd xep128
  • Compile Xep128: make
  • Download and construct ROM image: make combined.rom
  • Download SD card image: make sdcard.img
  • You're ready! You should/can however install it so you don't need the source directory: sudo make install

Xep128 emulation performance

It seems, Raspberry's default gcc makes a good job. I've tried some other (newer) gcc versions. also clang of LLVM. Still the default gcc (Debian 4.6.3-14+rpi1) 4.6.3 seems to be the best. Without extra options, it causes about 80% CPU load on Raspberry Pi 1 model B+ (I always check the CPU usage during the Enterprise logo). It seems two gcc options can help to lower to around 70% though: -falign-functions=16 -falign-loops=16. Since currently they are default Makefile options, not so much modification is needed.

Sound emulation sucks otherwise, but no wonder, there is no emulation delay code and sound buffer usage synchronization. Also, because it starts another thread, it must be slower.

More modern Raspberry PIs

Surely it helps to use more modern models. Later models has faster CPU, and more cores. It seems even the very cheap "Zero" model is faster than the original model 1. And kinda cheap! More cores on more advanced models can help on the sound problem as well.

Future works for Raspberry for Xep128

Still, many works left for Raspberry related projects:

  • Makefile for cross compiling
  • test on later models
  • debian (.deb) package for Raspbian OS, ready-to-be-used
  • the sound problem is a more generic Xep128 issue, it should be solved some time ...
  • always-fullscreen and always mouse grab mode, since it does not make sense to do otherwise on this platform
  • replace dialog box functions as they are not work on Raspberry/SDL so it makes impossible to use F9 for exit, for example (:XEP EXIT works though)
  • check the possibility of running other than console, X - or better Wayland - support ...

Conclusion

Raspberry model 1 is quite outdated from the the point view of performance. Modern smart phones has much more power and cores on at least the CPU level. That means, Android port wouldn't make too much problem for performance! At least I could run Xep128 on Raspberry Pi 1, with about 70% CPU usage, and that's a 600MHz ARM6 single core CPU. Not too bad ...