Tuesday, January 10, 2006

Crosscompiling for GP2X

I was playing for some time with cross-compiling GNU utilities for my GP2X. I followed this interesting article on GP2X Wiki about preparing development environment based on OpenEmbedded. It is supposed to make it easier to compile packages for proper architectures of embedded devices called OpenEmbedded. It took some time to properly set it up (the project doesn't have `official' documentation, only a wiki), but I got it working properly, i.e. it produces packages (yet another packaging format - ipkg, `Itsy package') that can be installed and uninstalled easily. This means that various packages that can be found on `normal' (i.e. not embedded) systems, so now we can port... Emacs?! :-)

I have also managed to get terminal emulation via USB cable working, so that I can use minicom (or any other terminal emulation software, like Windoze's HyperTerm) to talk directly to a device present on GP2X. There is ready shell script that you need to run from GP2X, which creates (if it's not already there) proper device in /dev, loads USB Gadget kernel module and starts shell with stdin and stdout pointing to abovementioned device. Now, all you need to do on your workstation side is to load USB ACM modem module (which is called 'cdc-acm' on my system) unless hotplug subsystem didn't do it for you and start up properly configured minicom.

Here's 'USB shell start script' run from GP2X:


rm -f *.txt


mknod /dev/ttygs0 c 127 0

insmod /lib/modules/2.4.25/kernel/drivers/usb/gadget/net2272.o
insmod g_serial.o use_acm=1


sleep 3

/bin/bash --login --noprofile -i -s < /dev/ttygs0 > /dev/ttygs0 2>&1 &

cd /usr/gp2x

USB Gadget code is availabe here.

Saturday, January 07, 2006

staring devving for GP2X Linux based console

Since November 2005 I have a very nice device: GamePark's GP2X, Linux-based portable gaming device (if I'm quoting the official sources correctly). It is really cool device and although it is almost a prototype, it works great - because it can emulate lots of other gaming hardwares (SEGA Megadrive, ZX Spectrum or Commodore 64, to mention only couple of them). It is also great because it was created with homebrew developers in mind (no problems like those in PSP whatsoever).

Now I decided to do something more than just gaming and I'm thinking about developing for this console. So probably this writeup is the first installment in longer series :-).

I have decided that I should start with something easier than real development - with porting. I have built development environment using a very nice script from here that downloads, patches, compiles and installs necessary development environment.

Than I have decided that I want to have my favourite personal information manager, abook, on GP2X. Here's what I have used to get it configured correctly, using GNU's configure utility:

CC=/usr/local/devkitPro/devkitGP2X/bin/arm-linux-gcc LD=/usr/local/devkitPro/devkitGP2X/bin/arm-linux-ld AR=/usr/local/devkitPro/devkitGP2X/bin/arm-linux-ar ./configure --host=i686-pc-linux-gnu --target=arm-linux --prefix=/usr/local/devkitPro/devkitGP2X

Right now I don't have spare batteries to upload the application to GP2X and test it. I'll do it ASAP. There is other problem too: there is no terminal emulation software (ie. no "console" mode) on GP2X so I was planning to use the same "trick" that sterm, GP2X shell app is using: it is basically a wrapper based on SDL graphics library, together with simple keyboard emulation to interact with it.

UPDATE: after recompilation of sterm on my laptop (handy way to debug applications!) I tried to run abook to see how it works and I got error message, that the console is... too small to display abook: right now the window is 53x23 and the minimum is 70x20. This makes it more complicated... I have either to use smaller font (which is not too huge, 6x10) or to find different PIM program! :-(. The font file is in sterm generated from XFree's fonts and there is only one available that's smaller : 5x7 but I'm afraid it can be too tiny to read and still not small enough to fit 70 columns.