Getting started with GP2X development

From wiki.gp2x.org

Contents

Introduction

The GP2X is a handheld device with a variety of interesting hardware. It runs a customized version of Linux, which is hidden behind an SDL-based menu system.

Three memory devices are available for use in the GP2X, 64MB RAM; 64MB built-in NAND flash memory which is used for the operating system and boot loader; and a removable SD card, normally used to store applications and data files.

Developing programs is almost exclusively carried out on a more generic desktop computer. A variety of languages are supported on the GP2X, ranging from compiled languages such as C to interpreted ones like Python and Fenix. Of course, it is possible to write using ARM assembly also.

Common types of development

Emulators

Emulation is the running of software designed for a different machine. It is often used to play older video games where the original hardware and games are difficult to obtain, but can be used for development, testing your applications without having to repeatedly copy files to the target device.

Games/Homebrew

The term 'homebrew' is generally associated with games written by developers at home as a hobby rather than a professional software company. These 'homebrew' developers are one set of people the GP2X is targeted towards due to the small number of commercial games (those that are sold).

Ports

Porting is the modification of source code for existing applications so they can be compiled and run on another system. Porting is popular on the GP2X due to the large number of open source applications which are pre-written for other platforms (normally desktop Linux distributions, but also other systems such as the PSP or GP32). Porting can be as simple of remapping controls to suit the GP2X, or as complex as rewriting major parts of the application to replace hardware-specific code.

The operating system, SDL, and many other pieces of software on the GP2X are ports of software originally written for another platform.

Utilities

Utilities are applications which are designed to perform a useful task. Such applications can be designed to assist in a task the GP2X already performs (such as replacement launchers/menus) or to do something entirely different. Examples of utility applications would be PDA systems, music and video players and text readers.

Getting a development environment

A popular choice for GP2X development is C/C++. The following articles offer several solutions for installing the required toolchain on your development hardware for Linux, OS X and Windows.

Testing applications

There are several ways of testing your applications on the GP2X hardware other than simply copying the resources and executable onto an SD card for each build. Below is a number of solutions which will help to speed up the development process.

Libraries

The following are libraries which have been ported or written for the GP2X. Which one you use, is purely down to preference but SDL and Allegro are common choices where the application must be easily portable, and Rlyeh's Minimal Library SDK, SDK2x or GP2X Hardware Library when performance and GP2X-specific features are needed.

Alternative languages

Along with the standard C toolchain and a library set up, one can also make use of several other languages on the GP2X. These often are simpler to use than C and so can result in faster development, and are more accessible to beginner programmers. Fenix and Python are popular choices for this type of language.

Using the hardware directly

On top of the above libraries and languages, it is possible to use the hardware directly by placing values into memory-mapped registers. These can control everything from what is displayed on the screen, to toggling the battery LED and can indicate the states of various pieces of hardware such as button presses.

Since this is not really a beginner topic, more information can be found on the Direct use of hardware page.

Personal tools