Pandora My windows dev setup for the Pandora


namco

Member
Joined
Mar 22, 2006
Messages
410
Age
41
Location
Manchester, UK
Website
www.stupendous-stuff.com
Rather than spam the boards unnecessarily I'm combining 2 posts in one.

Firstly hi (it's been a while - and I made a post on the old gp32x boards but that's pretty dead nowadays).

Secondly I wanted to show off my dev setup that I got working by cobbling pieces together and using some of my old gp2x setup.

I started with this thread: http://www.gp32x.de/board/index.php?/topic/55711-getting-cross-compiling-up-and-running-on-windows/

and I followed:
 

Step 1 (with the exception of installing it to C:/ and not the program files folder - this was just personal preference).

Step 2 was partially followed - mostly by editing the old gp2x makefile. I'm still using the GP2X definitions because I'm too lazy to update! 
tongue.png



PROJECT = test

# ---

ifdef GP2X
SYSTEM = gp2x
#EXT = gpe
else
SYSTEM = win32
EXT = exe
endif

BIN = $(PROJECT).$(EXT)
OBJS = $(patsubst _src/%.cpp, build/$(SYSTEM)/%.o, $(wildcard _src/*.cpp))

CFLAGS = -Wall
LDFLAGS = -Wl,--whole-archive -Wl,--no-whole-archive -Wl,--no-undefined -g -lstdc++ -lrt -Wl,-rpath=libs -lts -lSDLmain -lSDL -mwindows

ifdef GP2X
CFLAGS += -fsigned-char -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -Wno-deprecated -Wno-psabi

LIBDIRS = -L"C:/pandora-sdk/lib"
INCDIRS = -I"C:/pandora-sdk/include" -I"C:/pandora-sdk/include/SDL"

CXX = C:/CodeSourcery/"Sourcery G++ Lite"/bin/arm-none-linux-gnueabi-g++.exe
STRIP = C:/CodeSourcery/"Sourcery G++ Lite"/bin/arm-none-linux-gnueabi-strip
else
LIBDIRS = -L"C:/MinGW/lib" -L"C:/SDL-1.2.13/lib" -L"C:/SDL_ttf-2.0.9/lib"
INCDIRS = -I"C:/MinGW/include" -I"C:/SDL-1.2.13/include/SDL" -I"C:/SDL_ttf-2.0.9/"

CXX = C:/MinGW/bin/g++
STRIP = C:/MinGW/bin/strip
endif

ifdef DEBUG
CFLAGS += -D_DEBUG
else
CFLAGS += -fomit-frame-pointer -O3
endif

# ---

all : $(BIN)

$(BIN): $(OBJS)
$(CXX) -o $@ $^ $(LIBDIRS) $(LDFLAGS)

ifndef DEBUG
$(STRIP) $(BIN)
endif

build/$(SYSTEM)/%.o : _src/%.cpp
$(CXX) -o $@ $< $(INCDIRS) -c $(CFLAGS)

.PHONY clean:
@rm -rfv build/$(SYSTEM)/*
@rm -fv $(BIN)

Step 3 was followed but during a test compile it whinged about not finding libc.so.6 so I opened libc.so and amended as so:


/* GNU ld script
Use the shared library, but some functions are only in
the static library, so try that secondarily. */
OUTPUT_FORMAT(elf32-littlearm)
GROUP ( ./lib/libc.so.6 ./libc_nonshared.a AS_NEEDED ( ./lib/ld-linux.so.3 ) )

and added the lib folder from \20100611-i686-linux-armv7a-linux-gnueabi-toolchain-openpandora\usr\local\angstrom\arm\arm-angstrom-linux-gnueabi\lib to the pandora-sdk\lib file.

After that I think it compiled quite nicely! 
smile.png


Oh and btw when I set up the pnd with PNDTools and uploaded it to the menu folder on the SD card, the menu doesn't display any of the other applications. Running the .pnd via run_pnd.sh works fine though. Any suggestions?

PXML file here:


<?xml version="1.0" encoding="UTF-8"?>
<PXML xmlns="http://openpandora.org/namespaces/PXML">
<package id="parallaxscrollingtest.jamesdunn">
<author name="James Dunn"/>
<version major="1" minor="0" release="0" build="0"/>
<titles>
<title lang="en_US">Parallax Scrolling Test</title>
</titles>
<descriptions>
<description lang="en_US"></description>
</descriptions>
<icon src="./assets/icon.png"/>
</package>
<application id="parallaxscrollingtest.jamesdunn">
<exec command="./test"/>
<author name="James Dunn"/>
<version major="1" minor="0" release="0" build="0"/>
<titles>
<title lang="en_US">Parallax Scrolling Test</title>
</titles>
<descriptions>
<description lang="en_US"></description>
</descriptions>
<!--Extra block for compatibility with OS versions before HF6-->
<title lang="en_US">Parallax Scrolling Test</title>
<description lang="en_US"></description>
<!--END Extra block-->
<icon src="./assets/icon.png"/>
<licenses>
<license name="none"/>
</licenses>
<icon src="./assets/icon.png"/>
<previewpics>
<pic src="./assets/parallax1.png"/>
</previewpics>
<categories>
<category name="Game">
<subcategory name="ActionGame"/>
</category>
</categories>
</application>
<!--Created with the PXMLCreator of PNDTools v.0.7.1-->
</PXML>

[edit]: Just editing this to show the file structure for the above makefile:


|-/_src
|-/build
| |
| - /gp2x
| - /win32
|- Makefile

I hope the above is self explanatory but essentially it's:

Project Folder -> _src [folder] (the underscore needs to be there)

Project Folder -> build [folder]

Project Folder -> build -> gp2x [folder]

Project Folder -> build -> win32 [folder]

Project Folder -> Makefile
 
Last edited by a moderator:
Looks like a straightforward enough cross-compiling env.  Nice work.  I might suggest that a few things might have been updated since five years ago though, so you might want some updated libs there.  Not sure the best place to get them from (other than the /usr/lib folder on your Pandora I guess).

As for your PXML problem, I can't see anything immediately wrong there.  Looks well formed, might conceivably be valid.  So you're saying that when you add it to /pandora/menu on SD, all the other applications that were in your menu disappear?  Including the built-in stuff like Settings?  If so it's spat out some crazy .desktop file.
 
What's the best way to extract from the Pandora?

As for your PXML problem, I can't see anything immediately wrong there.  Looks well formed, might conceivably be valid.  So you're saying that when you add it to /pandora/menu on SD, all the other applications that were in your menu disappear?  Including the built-in stuff like Settings?  If so it's spat out some crazy .desktop file.

Yup, all disappear - it's as if I don't have the SD card inserted (dunno about the settings).
 
As a beginner programmer who can program happily, but can't set anything up... I have a feeling this thread will be really useful.

So thanks for that :D

*Now I just gatta work out what it all means.
 
PXML problems:

1) description must not be empty (all 3 of them)

2) remove the last icon element (after licenses)

If it doesn't help, then try removing dots (or replacing them) in package id and application id.
 
Okay a few notes from my end:

I had a Windows toolchain working for a while now, people asked me to write a guide on it, I never did and now I feel bad. So, thanks for the updated information.

I will try to add what else I know and maybe eventually we can cleanly package all this information in a wiki page or something.

I will follow namco's steps and add my comments.

Step 1: Downloading the toolchain.

You can definitely use a newer version than the 2010q1.

There is list of all versions here: https://docs.google.com/document/d/1xAaPRafox5XPy_TtXdYwPb9_ocMyOrKGmsq4eXRWAsc/edit?usp=sharing

As noted in the document, I had trouble getting the newer versions of the toolchain to run on the Pandora, probably because of outdated libs. I am successfully using the 2011.09-07 build, which includes GCC 4.6.1. This is still ancient, yet much better than the 2010 release though.

As you can see though the document was last updated in 2013 and the Pandora's kernel and libs have been updated since then, so this might not be a problem any more. This document really needs an update anyway.

Some guides say to install directly on C:/ or a path with no spaces. I have not done that and it works fine.

Step 2: Compiler flags

This boils down mostly to personal preference really.

Most of the defines in the original GP32x post are very project/code specific and you probably don't need them.

The cflags are good though.

In general I think the makefile posted by namco looks pretty good.

I use CodeBlocks on Windows to build everything, which works fine as well.

For reference here are my compiler flags for Greyout (my other projects look similar):


Disable exceptions and RTTI, since I don't need it (10% performance gain in Greyout):
-fno-exceptions
-fno-rtti

Arch-specific flags:
-mcpu=cortex-a8
-march=armv7-a
-mfpu=neon
-mfloat-abi=softfp

I have made a few speed comparisons of my SDL apps and have found -O3 to be always faster than -Os.
This might not always be the case, but it has been for me. -Os usually gives better results than -O2 though. (Try it yourself!):
-O3

Math optimisations (I have not profiled these specifically, everybody just seems to use them):
-ftree-vectorize
-ffast-math
-fsingle-precision-constant

Linker flags:


Since the 2011-toolchain I need this flag or the binary would not run on the Pandora (probably due to a change in the ABI).
This will just link libstdc statically (makes the binary a bit bigger in size). You might not need this nowadays due to updated libs on the Pandora:
-static-libstdc++

TTF fonts:
-lfreetype

OGG music:
-lvorbisidec

Mp3 music:
-lmad

Touchscreen:
-lts

PNG-Images:
-lpng
-lz

SDL libs (pick which your application needs):
-lSDL_image
-lSDL_mixer
-lSDL_ttf
-lSDL_gfx
-lSDL

Step 3: The lib package

This is the tricky step, really. (which says a lot about how easy this process actually is)

I rely on pre-packaged libs, very much like the ones linked in the gp32x post. Only my package was provided by PokeParadox with love.

You can get it here: http://foxblock.pirategames.co.uk/dropbox/Pandora_libraries.zip

I never had problems, like the one namco described, but that does not mean my package is better. It's probably worse.

You should really just copy the libs off your Pandora!

Step 4: The PXML file

PNDTools should work fine here. I am investigating whether the problems namco described were caused by PNDTools and/or can be prevented by it.

Note: You don't need to package your application as a PND to be able to run it on the Pandora, if you just want to test it. You can just copy your whole app and execute the binary manually from the console or file manager. (you might need to call chmod +x on the binary beforehand though)

And that is it, really.

If I can think of anything else, I will add it.
 
Last edited by a moderator:
@namco, The problems you had with your PXML file were indeed related to a bug in PNDTools (multiple icon nodes) and a missing warning/check (empty description tags).

Needless to say, I have fixed these bugs and will upload a new build tomorrow when I tested the changes a bit.
 
Back
Top