GP2X Some Beginner Dev Questions


Jaguarandine

Member
Joined
Jun 14, 2006
Messages
245
I'd like to begin GP2X programming, but I'm not sure how to start exactly. Here's the situation

Currently I have a BoB, with the GP2X (F100 MK2) connected to my computer (Ubuntu 9.10) via serial and parallel port cables. I want to be able to access the gp2x's command line remotely from my computer, because that would be the easiest way to debug programs, right? So, I tried to do so with Minicom. For some reason, Minicom seems to be trapping all keyboard commands sent to the gp2x, including CRTL-C needed to get past the initial boot-up display. Now admittedly, I am a bash and linux noob, but I followed all the instructions listed on the GP2X wiki website. PuTTY didn't work either, and actually reset my serial port permissions every time I used it. I even tried to mess with my serial port's permissions and stty settings, to no avail.

With that failure, I am confused on how to continue. USB serial?..telnet?..try serial again?..termula2x?..switch the SD card over and over? Which one is the best? I am quite lost. :(
 
What is best is simply which is less hassle for you and not hindering your productivity.
For instance I just copy to SD at last minute usually for GP2X apps. and the majority of the time if it's working fine on the PC, it will work fine on the GP2X.
The GP2X can do some things differently with SDL at time, however...
You could try the USB serial, although I suspect you'd get similar results so I'm not sure.
If it's wasting too much of your time just use cout or sprintf console output around suspect areas and log it to a file.
 
I also rarely debug on the GP2X itself - I think I did it once, and that was for a weird GP2X-only crash that was caused by a buggy glibc library on the GP2X (memset an area of memory with a huge negative value - it doesn't do what it should). Other than that, if it compiles and runs on the PC and you can compile it statically for the GP2X, chances are it will "just work" unless you do something silly.

I have a USB debugging method (I don't have a breakout board for my F-100) which is basically the "g_ether" module fix posted to the forums and then accessing the GP2X and a remote terminal (either VNC or telnet). But, like I say, I've only really used it seriously once. With proper structure to your program, once you get it compiled properly, it's easy to tell what the problems are and/or reproduce them on PC. And I'm the sort of person who writes code in notepad/nano and compiles it on Cygwin, so I'm normally a glutton for punishment... :)
 
By far, the easiest way to program for the GP2X F100 is through USB ethernet. The serial connection through the BOB is unreliable compared to telneting through the USB networking interface. It will randomly drop out or mess up, whereas I never ever have problems through USB networking. Furthermore, when using USB networking you can have multiple telnet windows talking to your GP2X, as many as you like. It is useful sometimes.

The other reason you want to be using USB networking is so you can mount a SMB share on your PC and run your program from it instead of inserting SD cards constantly. It can speed up your debugging significantly, almost by an order of magnitude I'd say. The GP2X wiki contains everything you need to know about getting all of this up and running. If for some reason you cannot find it there, I recommend doing searches of the forums here, but use Google to do it because it is more accurate and comprehensive than the forums' built-in search feature. Simply add "site:gp32x.de" to your google search terms to limit it to just this website. I ported about a dozen games and never, ever once had to make a single forum post with questions, they literally have all already been asked and answered and now you are tasked with sorting through it all :) I am not saying this to brag, I am illustrating a point.

You need to pour over the gp2x wiki because it and these forums contain everything you will ever need to know in your quest, I can assure you.

As for debugging on the GP2X, which is something you will inevitably have to do, you have two choices: Both involve using GDB. In the openhandhelds.org file archive, you will find two versions of GDB for the GP2X. One of them runs directly on the GP2X and you watch its output through your telnet window. The other version is a special version of GDB that uses what is called remote debugging and it requires you to run two halves of the gdb program, one on the GP2X and the other on your PC and they communicate with each other over your USB networking connection. If you do a search on the GP2X wiki for remote debugging you will find a page about it.

Good luck, ask more questions if you hit stumbling blocks but since you are a beginner you need to have LOTS and LOTS of perseverance, I have spent thousands of hours working out problems on my own, banging my head against walls. Noone here can hold your hand through the process, you need to be inquisitive and hard-working to work your way up and I know you can.

By the way, you mentioned having the parallel part of your BOB attatched but the only time you ever need to use that is if you have a failed firmware upgrade that bricked your unit. You really don't need the BOB at all to program for the GP2X, the most useful thing is your USB cable and a DC adapter for the GP2X.
 
Last edited by a moderator:
You're right, I should be coding and getting some experience under my belt rather than focusing on these minor issues. I'll probably start using USB ethernet as well. Thanks for the advice and encouragement guys.
 
Back
Top