Developing For The ODROID-GO

3 minute read

The ODROID-GO is advertised as a self-contained game console for which you can easily develop your own games and other programs. In the last two months I have written a clone of the classic Breakout for the ODROID-GO and have been working intensively with the developer tools. This article describes my experiences.

Arduino IDE

The manufacturer Hardkernel describes in the Wiki to the ODROID-GO in detail and with screenshots how to install and configure a development environment. At the end of the procedure there is a current version of the Arduino IDE on your machine, which can be configured for interaction with the ODROID-GO with just a few clicks.

The IDE starts quickly and directly displays a sketchbook that invites you to enter small programs. C and C++ are supported as programming languages. Using the File menu, the manufacturer’s demo projects can be loaded with just a few clicks. These are clearly arranged and well documented in the Wiki - and make it easier to get started.

Picture of an ODROID-GO showing text

The programs written in this way can be compiled with one click and transferred directly to the ODROID-GO. The program is executed automatically immediately afterwards, and from now on every time the console is started. A possibly installed game emulator will be overwritten when uploading the program.

The first steps with the IDE are relatively simple. If you work with the Arduino IDE for a while, you will quickly miss more features:

  • There is no debugger. If the program doesn’t run as expected, you can only examine the critical parts by printing debug output to the Serial console.
  • The IDE also does not support writing and executing unit tests. For large projects, refactoring the source code quickly becomes a source of errors.
  • The error messages of the compiler are relatively cryptic and do not always help to quickly identify the problem. But this may be simply because I was spoiled by the compilers for Java and Kotlin.

Working with Visual Studio

While the reduction to the essentials may be helpful for newcomers to programming, there are limits to more extensive projects. That’s why I looked around to see what alternatives there are for Arduino development under Windows. After a few hours of research and various attempts, I arrived at a solution that works very well for me and my project:

I develop my project with Visual C++ in Visual Studio and use the Arduino IDE only for the upload to the ODROID-GO. I leave the source code of my program in the project directory of the Arduino IDE. Additionally I import the source code files into a Visual Studio unit test project. Since the source code is usually C / C++, it can be compiled from there without any problems.

This setup offers several advantages over the exclusive use of the Arduino IDE:

  • The source code can be checked automatically via unit tests.
  • The unit tests can also be executed in the debugger. Critical parts of the code can thus be very easily examined at different input values.
  • Visual Studio spoils the developer with one of the best editors.

The following diagram shows the directory structure:

UML diagram showing the project structure

A solution is created in Visual Studio. This forms the outer frame. In the diagram, the directory of the solution is called Breakout. In this directory the Arduino-IDE project is created (or moved here). In my example the directory of the Arduino IDE project has the name Breakout-Go.

In Visual Studio you can now create the project Breakout-Win-Test and (optional) the project Breakout-Win. Breakout-Win-Test is a test project in which the unit tests are developed. The unit tests use the source code of the game, which is imported from the Breakout-Go directory.

Pitfalls

There are few problems using this setup. Only tests for functions that access the hardware of the ODROID-GO cannot be debugged well in the IDE. I solved the problem in my problem by encapsulating the access to the hardware in an abstract class Device. There is one implementation for tests and one for execution on the target platform.

The Breakout-GO project - including project setup for Arduino IDE and Visual Studio (2017) - is located on GitHub.

Updated: