Development In Linux?


Frontier

Still Fresh
Joined
Oct 8, 2007
Messages
3
i wasent sure if to post this in the homebrew or i need help forum.

im trying to get into development for the gp2x but im having some trouble.
i have some coding experience in c++ / c#. however i did that in windows, with visual studio, which was pretty simple, just install visual studio, type in code and hit compile. anyway right now im using linux (debian test/lenny to be precise) and im trying to get a compiler and the nessesary stuff sat up to compile programs for the gp2x, but im completely lost.

http://wiki.gp2x.org/wiki/Installing_the_Open2x_toolchain i did as this wiki article said.
and i now have the toolchain and the libraries extracted into /opt/open2x .... but then what??

i have the code file with this sample program http://wiki.gp2x.org/wiki/Writing_an_SDL_Hello_World . but how do i compile it?
the article says to run "gcc sdltest.c -I /usr/include/SDL -lSDL -o sdltest" and that does produce a compiled file, however i dont believe this compiles it for the gp2x? rather for a normal pc.
what command do i use to compile the sourcecode with the open2x toolchain? so it produces a .gpe file for the gp2x?
after some more digging i found this : http://wiki.open2x.org/open2x/wiki/index.php?title=Toolchain in the bottom it says:
QUOTE

You can use the tools by adding /opt/open2x/ + TOOLCHAINNAME + /bin to your OS path or just point directly to the tools in your makefile/scripts.

i.e. CPP = /opt/open2x/gcc-4.1.1-glibc-2.3.6/bin/arm-open2x-linux-g++

All tools feature 'correct' canonical tool names (arm-open2x-linux-*) so you should have no problem using this tool-chain with autotools for cross-compiling (provided the scripts are cross-compiler aware of course.


i havent a clue what OS path is, or a makefile..
so how do i use the toolchain to compile for the gp2x?

it really seems impossible to find the information i need, all the articles and tutorials i can find on the internet assumes theese things are worked out, no one seems to include any help or explanation.

thanks in advance for any help.
 
Welcome and kudos for your efforts. First I would familiarize myself with the host system and master the tools native to the workstation. Once you've got gcc working and a graphic SDL hello world painting natively you'll find cross-compiling to a different host with another toolchain like open2x simple and fairly easy. From the prompt

$ man make
and
$ man gcc

would be a good place to start. Bit painful but think of it as a right of passage.
 
Sphinxter said:
Welcome and kudos for your efforts. First I would familiarize myself with the host system and master the tools native to the workstation. Once you've got gcc working and a graphic SDL hello world painting natively you'll find cross-compiling to a different host with another toolchain like open2x simple and fairly easy. From the prompt

$ man make
and
$ man gcc

would be a good place to start. Bit painful but think of it as a right of passage.
thank you for the welcome and reply.

i allready figured out to compile it and got a SDL hello world painted natively here.
gcc sdltest.c -I /usr/include/SDL -lSDL -o sdltest <---

from what i've been able to gather "mastering" theese things is a process that could take a long, long time, and while it will be nessesary and preferred eventually, right now all i want is a quick fix to get going.

as i understand all i need is a sample Makefile for open2x, and optionally a 2 or 3 line explanation of the most basic in it.
this is something anyone with experience with open2x and linux should be able to write out to me in less than a minute, so i dont think its too much to as.
 
Last edited by a moderator:
Didn't get the question, sorry. Still using gp2xdev here yet but similar, I use two make files, one native named, 'Makefile', that builds a dynamically linked 64 bit executable and another that builds statically linked arm executable and packages my gp2x program ready to go called as
$ make -f Makefile.gpe zip

Here is Makefile:
CODE

#
# $Id: Makefile,v 1.3 2007/07/25 04:01:43 linus Exp $

VER = 1.0
PROG = buzzy
PREFIX= tmp
CFLAGS += -g -Wall $(shell sdl-config --cflags)
LDFLAGS = -lSDL_mixer -lSDL_image $(shell sdl-config --libs) -lSDL_gfx
OBJET = bug.o garden.o draw.o text.o topten.o util.o racket.o
CCODE = $(shell ls *.c)
HEAD = $(shell ls *.h)

all: $(PROG)

$(PROG): $(OBJET)
gcc $(LDFLAGS) -o $@ $^

%.o: %.c $(HEAD)
gcc $(CFLAGS) -c -o $@ $<

clean:
rm -f *.o *~

cleantar: cleantmp
rm -f $(PREFIX)-$(VER).tar.gz

cleantmp:
rm -rf tmp



Here is Makefile.gpe

CODE

#
# $Id: Makefile.gpe,v 1.1 2007/07/25 04:01:01 linus Exp $
#

VER = 1.0
PROG = BuzzysBadDay.gpe
PREFIX = tmp
CFLAGS += -g -O2 -Wall $(shell ../bin/sdl-config --cflags) -DGP2X
#-DINTRO
LDFLAGS = -static \
-lSDLmain \
-lSDL_mixer \
-lSDL_svg \
-lSDL_ttf \
-lSDL_image \
-lSDL_gfx \
-ljpeg \
-lpng \
-lmikmod \
-lreadline \
-lsmpeg \
-logg \
-lvorbis \
-lvorbisidec \
-lvorbisenc \
-lvorbisfile \
-lxml2 \
$(shell ../bin/sdl-config --libs) \
-lz

OBJET = bug.o draw.o text.o topten.o util.o racket.o garden.o

CCODE = $(shell ls *.c)
HEAD = $(shell ls *.h)

all: $(PROG)

$(PROG): $(OBJET)
../bin/gp2x-g++ -o $@ $^ $(LDFLAGS)
../bin/gp2x-strip $@

%.o: %.c $(HEAD)
../bin/gp2x-gcc $(CFLAGS) -c -o $@ $<

clean:
rm -f *.o *~ $(PROG)

cleanzip: cleantmp
rm -f $(shell basename $(PROG) .gpe)-$(VER).zip

cleantmp:
rm -rf tmp

zip: all cleanzip cleantmp
mkdir -p $(PREFIX)/$(shell basename $(PROG) .gpe)/wav
mkdir -p $(PREFIX)/$(shell basename $(PROG) .gpe)/bmp
mkdir -p $(PREFIX)/$(shell basename $(PROG) .gpe)/doc
cp -a bmp/*.png $(PREFIX)/$(shell basename $(PROG) .gpe)/bmp
cp -a bmp/*.elf $(PREFIX)/$(shell basename $(PROG) .gpe)/bmp
cp -a wav/*.wav $(PREFIX)/$(shell basename $(PROG) .gpe)/wav
cp -a wav/racket.elf $(PREFIX)/$(shell basename $(PROG) .gpe)/wav
cp -a doc $(PREFIX)/$(shell basename $(PROG) .gpe)
cp -a $(PROG) $(PREFIX)/$(shell basename $(PROG) .gpe)
cp -a $(shell basename $(PROG) .gpe).png $(PREFIX)/$(shell basename $(PROG) .gpe)
mkdir -p $(PREFIX)/$(shell basename $(PROG) .gpe)/src
cp -a $(CCODE) $(HEAD) $(PREFIX)/$(shell basename $(PROG) .gpe)/src/
cp -a Makefile.gpe $(PREFIX)/$(shell basename $(PROG) .gpe)/src/Makefile
mkdir -p $(PREFIX)/$(shell basename $(PROG) .gpe)/src/wav
cp -a wav/racketmake.sh $(PREFIX)/$(shell basename $(PROG) .gpe)/src/wav
cp -a wav/noise.h $(PREFIX)/$(shell basename $(PROG) .gpe)/src/wav
cp -a wav/README $(PREFIX)/$(shell basename $(PROG) .gpe)/src/wav
cd $(PREFIX)/$(shell basename $(PROG) .gpe); cp doc/ebook README.txt
cd $(PREFIX)/$(shell basename $(PROG) .gpe); zip -r source.zip src doc
rm -rf $(PREFIX)/$(shell basename $(PROG) .gpe)/src $(PREFIX)/$(shell basename $(PROG) .gpe)/doc
cd $(PREFIX); zip -r ../$(shell basename $(PROG) .gpe)-$(VER).zip $(shell basename $(PROG) .gpe)



hope that helps.
 
Hi,

This is an example of a very simple Makefile for the open2x toolchain.

---> Start Makefile

CC = /opt/open2x/gcc-4.1.1-glibc-2.3.6/bin/arm-open2x-linux-g++
CFLAGS = -O2 -I/opt/open2x/gcc-4.1.1-glibc-2.3.6/include -static
LDFLAGS = -L/opt/open2x/gcc-4.1.1-glibc-2.3.6/lib

TYPE = .gpe
EXE = testprogram
FILES = test1.c test2.c

$(EXE): $(OBJS)
$(CC) -o $(EXE)$(TYPE) $(FILES) $(CFLAGS) $(LDFLAGS) -lSDL -ldl -lpthread -lSDL_gfx

---> End Makefile

Regards,
Henrik
 
Back
Top