Caanoo / WIZ Simple Openwiz Toolchain Tutorial?


IAmCorbin

Still Fresh
Joined
Jan 4, 2010
Messages
14
Age
40
Location
Traverse City, Michigan
Hello everyone,

I just received a Wiz as a present and have spent a lot of my time over the past couple months learning SDL and OpenGL on Ubuntu Linux. I would love to start developing for the Wiz but I am having trouble getting started.

I was wondering if someone who is already up and running and has a better handle on all this stuff than I do could put together a simple "OpenWiz Toolchain: Getting Started" tutorial. This would show how to properly download, setup, and use the toolchain to link and compile a very simple SDL program. I think this would not only help me but other's out there who want to get started with Wiz development as well.

Thanks

~Corbin
 
IAmCorbin said:
Hello everyone,

I just received a Wiz as a present and have spent a lot of my time over the past couple months learning SDL and OpenGL on Ubuntu Linux. I would love to start developing for the Wiz but I am having trouble getting started.

I was wondering if someone who is already up and running and has a better handle on all this stuff than I do could put together a simple "OpenWiz Toolchain: Getting Started" tutorial. This would show how to properly download, setup, and use the toolchain to link and compile a very simple SDL program. I think this would not only help me but other's out there who want to get started with Wiz development as well.

Thanks

~Corbin

Openwiz is the archives and i sure it has prebuilt libs in it, or theres another package that does. Look at the gp2x wiki stuff i think theres info there. If you have a basic makefile it pretty much having the cross compiler path in the makefile or in your $PATH
 
Last edited by a moderator:
IAmCorbin said:
Well then could you give an example of a basic makefile for use with the toolchain?

here's my Makefile from Brikx for WIZ:

Code:
# Project: Brikx                                                                                                                                                                      
# Makefile for building WIZ binary     
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
ARMDIR    = /toolchain/arm-openwiz-linux-gnu                                                                                                                                          
CPP       = $(ARMDIR)/bin/arm-openwiz-linux-gnu-c++                                                                                                                                   
OBJ       = main.o brikx.o button.o                                                                                                                                                   
LIBS      = -L$(ARMDIR)/lib -Wl,-rpath,$(ARMDIR)/lib -lSDL -lSDL_ttf -lSDL_mixer -lm -lz -lpng -lSDL_image -liconv -lfreetype -lmad -lvorbisidec                                      
INCS      = -I$(ARMDIR)/include/ -I$(ARMDIR)/include/SDL                                                                                                                              
BIN       = brikx-wiz.gpe                                                                                                                                                             
DEFINES   = -DWIZ                                                                                                                                                                     
CXXFLAGS  = $(INCS) $(DEFINES) -fno-rtti -fno-exceptions -fno-pcc-struct-return -fstrict-aliasing -O2                                                                                 
                                                                                                                                                                                      
all: $(OBJ)                                                                                                                                                                           
        $(CPP) $(CXXFLAGS) main.cpp brikx.cpp button.cpp -o $(BIN) $(LIBS)
 
Last edited by a moderator:
I guess I'm confused on how to compile into the .gpe file, is this as simple as adding the .gpe extention to the output file? (eg.. -o testSDL.gpe)
 
IAmCorbin said:
I guess I'm confused on how to compile into the .gpe file, is this as simple as adding the .gpe extention to the output file? (eg.. -o testSDL.gpe)

its nothing special in the build, just the name of the file. By adding the ext frontends can pick up on the ext and know its a file that can be executed.
 
Last edited by a moderator:
Thanks for the help everyone,

I setup a Makefile and compiled the "Hello World in SDL" program here - http://wiki.gp2x.org/wiki/Writing_an_SDL_Hello_World

It compiles but when I try and run it on the wiz all I get is the loading screen and I have to reset it.
 
run it from terminal (like Termula) so you will see the error message (i guess it will be a missing library)
 
This is what I get running in Termula

Code:
./testSDL.gpe: error while loading shared libraries: 
libiconv.so.2: cannot open shared object file: No such file or directory


I see libiconv.so.2 in the toolchain files, How do I go about correcting this error? Would this be a problem with my Makefile linking?

Here is the Makefile I'm using:
Code:
# Project: TestSDL
# Makefile for building WIZ binary

ARMDIR    = /opt/arm-openwiz-linux-gnu
CPP       = $(ARMDIR)/bin/arm-openwiz-linux-gnu-c++
OBJ       = testSDL.cpp
LIBS      = -L$(ARMDIR)/lib -Wl,-rpath,$(ARMDIR)/lib -lSDL -lSDL_ttf -lSDL_mixer -lm -lz -lpng -lSDL_image -liconv -lfreetype -lmad -lvorbisidec
INCS      = -I$(ARMDIR)/include/ -I$(ARMDIR)/include/SDL
BIN       = testSDL.gpe
DEFINES   = -DWIZ
CXXFLAGS  = $(INCS) $(DEFINES) -fno-rtti -fno-exceptions -fno-pcc-struct-return -fstrict-aliasing -O2

all: $(OBJ)
	$(CPP) $(CXXFLAGS) testSDL.cpp -o $(BIN) $(LIBS)

clean:
	rm $(BIN)
 
IAmCorbin said:
This is what I get running in Termula

Code:
./testSDL.gpe: error while loading shared libraries: 
libiconv.so.2: cannot open shared object file: No such file or directory


I see libiconv.so.2 in the toolchain files, How do I go about correcting this error? Would this be a problem with my Makefile linking?

you put libiconv.so.2 either to the system's /lib directory (on the NAND) or to the application's own dir, but in this case you may need to tell the app the location of that file with:
Code:
LD_LIBRARY_PATH=.;$LD_LIBRARY_PATH  ./myapp.gpe
 
Last edited by a moderator:
glezmen said:
you put libiconv.so.2 either to the system's /lib directory (on the NAND) or to the application's own dir, but in this case you may need to tell the app the location of that file with:
Code:
LD_LIBRARY_PATH=.;$LD_LIBRARY_PATH  ./myapp.gpe

Sorry, I don't understand where I should put "LD_LIBRARY_PATH=.;$LD_LIBRARY_PATH ./myapp.gpe"
 
Last edited by a moderator:
You can create a game.gpu file to launch your game like this. This way loads the required libraries from the application directory. But I simply put required libs with the .gpe and works. If you don't use the libiconv, you can quit -liconv from Makefile too.

Code:
#!/bin/sh

LD_LIBRARY_PATH=.;$LD_LIBRARY_PATH
./myapp.gpe

sync
cd /usr/gp2x
exec /usr/gp2x/gp2xmenu
 
I removed -liconv from the Makefile and it now runs fine.

This is all I'm running
Code:
#include "SDL.h"

int main(int argc, char *argv[]) {
	fprintf(stdout,"Congratulations it works\n");
	return 0;
}

Why does this just sit on the loading screen when I run it? I just got a USB serial connection over kermit running and when I run the program through that connection it outputs the message and my Wiz never displays loading or locks up.

I did get the HelloWorld code from the link above compiled and running now though, so I'm on the right track. Thanks for all the help!!

~Corbin
 
You need to call the menu on exit of your program. I other case the program not returns to menu.

Code:
#ifdef GP2X
    chdir("/usr/gp2x");
    execl("/usr/gp2x/gp2xmenu", "/usr/gp2x/gp2xmenu", NULL);
#endif
 
Hardyx said:
You need to call the menu on exit of your program. I other case the program not returns to menu.

Code:
#ifdef GP2X
    chdir("/usr/gp2x");
    execl("/usr/gp2x/gp2xmenu", "/usr/gp2x/gp2xmenu", NULL);
#endif

Thanks, I just needed to also add another include line:
Code:
#include <unistd.h>

I got a simple SDL_Joystick test program running that displays button presses, and now it even exits back to the menu if I press 'L'

It's not much, but I'm excited to finally have some simple code compiling and running on my Wiz. This is the first time I've had my own code running on a handheld device before.

~Corbin
 
Last edited by a moderator:
Hi,

I have a problem with my "make".

If I start make I get the following error (I started also with root and sudo):

Code:
make: execvp: /opt/arm-openwiz-linux-gnu: Permission denied
make: *** [all] Fehler 127

This is my Makefile:

Code:
ARMDIR    = /opt/arm-openwiz-linux-gnu
CPP       = $(ARMDIR)/bin/arm-openwiz-linux-gnu-c++
OBJ       = hello.cpp
LIBS      = -L$(ARMDIR)/lib -Wl,-rpath,$(ARMDIR)/lib -lSDL -lSDL_ttf -lSDL_mixer -lm -lz -lpng -lSDL_image -liconv -lfreetype -lmad -lvorbisidec
INCS      = -I$(ARMDIR)/include/ -I$(ARMDIR)/include/SDL
BIN       = hello.gpe
DEFINES   = -DWIZ
CXXFLAGS  = $(INCS) $(DEFINES) -fno-rtti -fno-exceptions -fno-pcc-struct-return -fstrict-aliasing -O2

all: $(OBJ)
        $(CPP) $(CXXFLAGS) hello.cpp -o $(BIN) $(LIBS)

and this is in my opt folder:
Code:
drwxr-xr-x 10 root root     4096 2009-01-19 22:13 arm-openwiz-linux-gnu

I hope someone can help me.

Thanks
Rene
 
Try to use chown command to change the owner to your current user.

Code:
chown -R your_user /opt/arm-openwiz-linux-gnu
 
Back
Top