I'm going round and round in circles here! Certainly not a guru with this stuff, but no noob either (been knocking out GBA homebrew for a year or so using all sorts of stuff: devkitPro, VisualHAM/HAMLib, etc). I haven't actually ordered a GP2X, but it's under serious consideration as I don't think developing for my Nintendo DS is going to be as fun as it is for the GBA (all that RCA encryption and PassMe hacks).
If I can get this to work I am completely willing to write a detailed bullet-proof "How To" for the Wiki, so help, please (writing software documentation is one of the things I do for a living)!
So far I have:
1. Installed the complete devkitPro on WindowsXP Pro to c:\devkitPro using the installer (it's working e.g. I can compile the GBA examples).
2. Installed devkitGP2X to C:\devkitPro\devkitGP2X.
3. Setup devkitGP2X in a similar manner to "Manual Setup" instructions on
http://www.devkitpro.org/setup.shtml, including creating a System Environment Variable called "DEVKITGP2X" with a value of "/c/devkitPro/devkitGP2X".
4. Copied the contents of the opt\local\gp2x (\bin, \include, \info, \lib, \man, \share) folder from the gp2xlibs.tar.gz file downloaded from
http://gp2x.org/gp2x/libs/ to C:\devkitPro\devkitGP2X.
5. Edited the file C:\devkitPro\devkitGP2X\bin\arm-open2x-linux-sdl-config replacing "prefix=/opt/local/gp2x" on line number 3 with "prefix=C:/devkitPro/devkitGP2X".
6. Created a new project called "gp2x_001" in C:\devkitPro\examples\gp2x\gp2x_001 using Programmers Notepad that contains 2 files: Makefile and source\main.c.
Makefile
Slightly modified version of that given by
Guyfawkes, because of the setup folders for devkitPro and not renaming arm-open2x-linux-sdl-config file.
Code:
CROSS_COMPILE = C:/devkitPro/devkitGP2X/bin/arm-linux-
SDL_BASE = C:/devkitPro/devkitGP2X/bin/
LDFLAGS = -static
CC = $(CROSS_COMPILE)gcc
CXX = $(CROSS_COMPILE)g++
STRIP = $(CROSS_COMPILE)strip
CFLAGS = `$(SDL_BASE)arm-open2x-linux-sdl-config --cflags` -O2 -Wall -Werror
CXXFLAGS = `$(SDL_BASE)arm-open2x-linux-sdl-config --cflags` -O2 -Wall -Werror
LIBS = `$(SDL_BASE)arm-open2x-linux-sdl-config --libs`
SDLTEST_TARGET = sdltest.gpe
SDLTEST_OBJS = main.o
ALL_TARGETS = $(SDLTEST_TARGET)
all : $(ALL_TARGETS)
$(SDLTEST_TARGET) : $(SDLTEST_OBJS)
$(CXX) $(LDFLAGS) -o $(SDLTEST_TARGET) $(SDLTEST_OBJS) $(LIBS)
$(STRIP) $(SDLTEST_TARGET)
clean:
rm -f $(ALL_TARGETS) *.o *~
main.c
Kalakians
example code from earlier in this thread.
Code:
#include "SDL.h"
#define SCREEN_WIDTH 320
#define SCREEN_HEIGHT 240
#define SCREEN_DEPTH 8
int main(int argc, char *argv[]) {
SDL_Surface *screen;
Uint8 *p;
int x = 10; //x coordinate of our pixel
int y = 20; //y coordinate of our pixel
/* Initialize SDL */
SDL_Init(SDL_INIT_VIDEO);
/* Initialize the screen / window */
screen = SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_DEPTH, SDL_SWSURFACE);
for(int iy = 0; iy < 10; iy++)
{
for(int ix = 0; ix < 10; ix++)
{
/* Make p point to the place we want to draw the pixel */
p = (Uint8 *)screen->pixels + (y+iy) * screen->pitch + (x+ix) * screen->format->BytesPerPixel;
/* Draw the pixel! */
*p=0xff;
}
}
/* update the screen (aka double buffering) */
SDL_Flip(screen);
while(1);
}
Here's where the trouble starts. Here's the output from the compiler. Where and how is the required rule specified? What have I missed out in my setup?
Code:
> "make"
"make": *** No rule to make target `sdltest.gpe', needed by `all'. Stop.
> Process Exit Code: 2