GP2X Starting Gp2x Development On Mac Os X


AnimalMachine

Still Fresh
Joined
Jan 8, 2007
Messages
6
I've been trying for days now to get a setup that will successfully compile and run on my gp2x from my Mac and have been defeated at every turn. I'm hoping someone else here will have a suggestion or two to point me in the right direction.

My last attempt involved installing arm-elf-gcc (4.1.1) from darwine ports and just trying to run a simple c program such as:

Code:
#include <stdio.h>
#include <stdlib.h>

int main (int argc, char* argv[])
{
		FILE* my_file = NULL;

		my_file = fopen ("mytest.txt", "w");
		fputs ("This line managed to execute!\n", my_file);
		fflush (my_file);
		fclose (my_file);

		return (0);
}

Which compiles & works fine under macosx native tools. Under arm-elf-gcc, it will compile and static link fine:

Code:
file filetest.gpe
filetest.gpe: ELF 32-bit LSB executable, ARM, version 1 (ARM), statically linked, not stripped

If I copy it over to the gp2x and run it from the std interface, I get the black screen and have to restart the device. If I set up usb networking and start via telnet, I get "Segmentation error", or fault, or whatever. My other sdl 'test' program that draws random rectangles does the same thing.

I've tried other toolchains as well such as devkitGP2X on macosx to no avail. I've set up parallels to run ubuntu and have tried the official sdk, and open2x chains to no avail.

Am I just screwing something up on the command line? With my simple example above I comple with this:

Code:
arm-elf-gcc-4.1.1 -o filetest.gpe file.c -O2 -mcpu=arm940t

With, or without the -mcpu parameter it has the same segmentation fault issue.

I've been pretty frustrated with this, so I'm hoping someone out here has tread this path on Mac OS X before and can let me know what I'm doing wrong.

TIA
 
You should be able to use pretty much any of the methods of building a toolchain listed on setting up a dev environment for Linux (link)

I wouldn't try to use any generic arm-elf compiler, you'll have much better luck building your own using devkitgp2x script or open2x.
 
You should be able to use pretty much any of the methods of building a toolchain listed on setting up a dev environment for Linux (link)

I wouldn't try to use any generic arm-elf compiler, you'll have much better luck building your own using devkitgp2x script or open2x.

Well the open2x toolchain will not build for me. I can't checkout a full copy of trunk/toolchain because of what I guess is filesystem limitations. Even if I skip the linux-headers svn folder and just unroll my own from the official linux kernel source, it still failed to compile. (I didn't keep track of where ... I was losing patience by this point). I didn't mention it in my original post, but I did try the downloads suggested for mac os development on the wiki. They didn't work for me either.

However, the good news is that I did manage to get a working open2x toolchain & library setup under ubuntu (with parallels)! So while it's a bit inconvenient, I do have a working setup that will handle what I need it to do for now.

When I get the itch to figure it out, I'll take a closer look and see what was goin' on with open2x under mac os...
 
Last edited by a moderator:
Check that my_file is not NULL after trying to open it.

That was just a super quick example hacked together just to see if anything would happen without having to link SDL libraries.

Even basic SDL examples I had that just SDL_Init and SDL_Quit would segfault.

*shrug*

It's all good now (with my ubuntu 'chain).
 
Last edited by a moderator:
Back
Top