Skip to content

Getting Started

Adan edited this page Jul 5, 2020 · 6 revisions

Prerequisites

Preparing GP2X to run o2x executables

The normal output when building an application with Orcus is an o2x file. These are not supported by the Linux-based firmware which has historically been used on the GP2X. In order to run o2x binaries you'll need to install the Open2x bootloader, which can run them directly off SD, and can also receive them over UART using XMODEM which may be useful if you have a serial cable (I'd generally recommend using JTAG for development, it is faster and supports debugging).

Installing the toolchain and libraries

Have a look at the devkitPro pacman documentation, and install the gp2x-dev group of packages. This will give you everything you need to compile bare metal executables, as well some examples showing how to use Orcus.

First project

As a first project, I'd recommend you take a simple example like framebuffer from gp2x-examples and copy it.

If you look at the top of the Makefile, you'll see the following:

#---------------------------------------------------------------------------------
TITLE := Framebuffer Example
MKO2X_PARAMS := --icon icon.bin
#---------------------------------------------------------------------------------

This is probably the only bit you'll need to customise for most projects. You can change the title, and icon.bmp, then type make. If all is well, you should end up with an o2x file, which you can now run on a GP2X. Change source/main.c, and add your own source/include files (in include/) to write your own application.

Running via JTAG/debugging

If you look in the scripts/ directory of the Orcus code, you'll find a template openocd config file for use with the GP2X. You may need to tweak this depending on which interface you use (I have Segger J-Link which works well, but have also had success with an FTDI-based interface from Olimex). For those without a breakout board, you can find some schematics for a board which can be built cheaply here. Note that on some units, the JTAG connection seems unreliable.

sudo openocd -f gp2x-openocd.cfg

$DEVKITARM/bin/arm-none-eabi-gdb
exec-file YOUR.elf
target remote localhost:3333
add-symbol-file YOUR.elf
load

Enter cont when you want to start running your code.

Clone this wiki locally