Recently I came across a hacker news post about the Odroid-go, which is a tiny hand-held console, somewhat resembling a gameboy.
In terms of hardware this is powered by an ESP32 chip, which is something I'm familiar with due to my work on Arduino, ESP8266, and other simple hardware projects.
Anyway the Odroid device costs about $40, can be programmed via the Arduino-studio, and comes by default with a series of emulators for "retro" hardware:
- Game Boy (GB)
- Game Boy Color (GBC)
- Game Gear (GG)
- Nintendo Entertainment System (NES)
- Sega Master System (SMS)
I figured it was cheap, and because of its programmable nature it might be fun to experiment with. Though in all honesty my intentions were mostly to play NES games upon it. The fact that it is programmable means I can pretend I'm doing more interesting things than I probably would be!
Most of the documentation is available on this wiki:
The arduino setup describes how to install the libraries required to support the hardware, but then makes no mention of the board-support required to connect to an ESP32 device.
So to get a working setup you need to do two things:
- Install the libraries & sample-code.
- Install the board-support.
The first is documented, but here it is again:
git clone https://github.com/hardkernel/ODROID-GO.git \
~/Arduino/libraries/ODROID-GO
The second is not documented. In short you need to download the esp32 hardware support via this incantation:
mkdir -p ~/Arduino/hardware/espressif && \
cd ~/Arduino/hardware/espressif && \
git clone https://github.com/espressif/arduino-esp32.git esp32 && \
cd esp32 && \
git submodule update --init --recursive && \
cd tools && \
python2 get.py
(This assumes that you're using ~/Arduino
for your code, but since almost everybody does ..)
Anyway the upshot of this should be that you can:
- Choose "Tools | Boards | ODROID ESP32" to select the hardware to build for.
- Click "File | Examples |ODROID-Go | ...." to load a sample project.
- This can now be compiled and uploaded, but read on for the flashing-caveat.
Another gap in the instructions is that uploading projects fails. Even when you choose the correct port (Tools | Ports | ttyUSB0
). To correct this you need to put the device into flash-mode:
- Turn it off.
- Hold down "Volume"
- Turn it on.
- Click
Upload
in your Arduino IDE.
The end result is you'll have your own code running on the device, as per this video:
Enough said. Once you do this when you turn the device on you'll see the text scrolling around. So we've overwritten the flash with our program. Oops. No more emulation for us!
The process of getting the emulators running, or updated, is in two-parts:
- First of all the system firmware must be updated.
- Secondly you need to update the actual emulators.
Confusingly both of these updates are called "firmware" in various (mixed) documentation and references. The main bootloader which updates the system at boot-time is downloaded from here:
To be honest I expect you only need to do this part once, unless you're uploading your own code to it. The firmware pretty much just boots, and if it finds a magic file on the SD-card it'll copy it into flash. Then it'll either execute this new code, or execute the old/pre-existing code if no update was found.
Anyway get the tarball, extract it, and edit the two files if your serial device is not /dev/ttyUSB0
:
eraseflash.sh
flashall.sh
One you've done that run them both, in order:
$ ./eraseflash.sh
$ ./flashall.sh
NOTE: Here again I had to turn the device off, hold down the volume button, turn it on, and only then execute
./eraseflash.sh
. This puts the device into flashing-mode.NOTE: Here again I had to turn the device off, hold down the volume button, turn it on, and only then execute
./flashall.sh
. This puts the device into flashing-mode.
Anyway if that worked you'll see your blue LED flashing on the front of the device. It'll flash quickly to say "Hey there is no file on the SD-card". So we'll carry out the second step - Download and place firmware.bin
into the root of your SD-card. This comes from here:
(firmware.bin
contains the actual emulators.)
Insert the card. The contents of firmware.bin
will be sucked into flash, and you're ready to go. Turn off your toy, remove the SD-card, load it up with games, and reinsert it.
Power on your toy and enjoy your games. Again a simple demo:
Games are laid out in a simple structure:
├── firmware.bin
├── odroid
│ ├── data
│ └── firmware
└── roms
├── gb
│ └── Tetris (World).gb
├── gbc
├── gg
├── nes
│ ├── Lifeforce (U).nes
│ ├── SMB-3.nes
│ └── Super Bomberman 2 (E) [!].nes
└── sms
You can find a template here:
Tags: esp32, odroid, odroid-go 6 comments