PSP broken elf problem

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
User avatar
turkeyman
Posts: 75
Joined: Wed Oct 20, 2004 7:38 pm
Location: Brisbane, Australia
Contact:

PSP broken elf problem

Post by turkeyman »

hello people..

can anyone here help me out with some ideas why i'm producing a broken elf? ... is there anything i need to do specifically after linking to make the elf work on the PSP?

i'm compiling a bare app:
void main()
{
sceKernelExitGame();
return 0;
}

which i expect to quit immediately.. but it just crashes the PSP when it attempts to run it.. i'm fairly confident it never enters main..

my game used to build and run fine with an old PSPSDK.. but at some point, i updated, and i every elf i produced since then was broken..
strange thing is, the samples still build and run just fine..

so i'm trying to work out what could possibly be different between when i attempt to build, and the sample apps.. the only thing i can think is that the sample apps use make, and my stuff uses my own build tools which invoke psp-gcc directly.

can anyone think of anything at all that i could have done that would cause the elf to be broken, or to crash before it even enters main?

i try running with the 1.5 exploit, or through psplink.. both ways, it just crashes with the same behaviour and the power light go's off ;)
so i think i can rule out the boot method. (and like i said, it used to work fine with the same kxploit and stuff, and i havent changed anything)

so yeah, the only thing i can think that may affect it is that i'm calling psp-gcc directly (which used to work fine).. i'm not using make... is there anything make does implicitly that i might be missing by not using it?

also worth noting, when i try and compile a sample app by invoking gcc directly rather than using its make file, it compiles and links without error, but it crashes similar to my program at bootup.. but instad of crashing the system and the power light switching off, the launcher catches it and prints a "failed to launch app" error message instead..

i'm well out of ideas..

thanks guys! :)
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

It is probably quite simple, based on what you said on irc about using psp-gcc directly I am guessing you are not calling psp-fixup-imports on your elf. This was a change way back when which is called by default in the build scripts of the samples but unless you call it all your import tables are junk and the elf will not work.

I pressed for forcing people to use default makefiles but noone ever listens to me :)
jimparis
Posts: 1145
Joined: Fri Jun 10, 2005 4:21 am
Location: Boston

Post by jimparis »

You also need PSP_MODULE_INFO.
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

I argued for making that mandatory as well, sigh :P
User avatar
turkeyman
Posts: 75
Joined: Wed Oct 20, 2004 7:38 pm
Location: Brisbane, Australia
Contact:

Post by turkeyman »

sorry, my paste above neglected the include and the PSP_MODULE_INFO..
i most definately have that there..

ahhhh! psp-fixup-imports! that sounds exactly likely! :)
i'll try that tonight when i get home.. THANKS!!

just for reference, i couldnt find mention to it anywhere in the makefile...
is it somehow implicit behaviour, or am i blind?
i scoured the makefiles [what i thought was] very thoroughly. :/

i was trying to make my command line as close to what i could see in the makefile as possible, but the makefiles for the samples seem extremely overcomplicated (for what they do, build an elf from one source file) that makes it hard to follow..
and yes, i'm sure thats only because i'm a make spastic... but for example, when i have to start tracing make includes around, and i have to try and understand variables that are various concatenations of other variables. and theres about 3 different cases for linking a CRT (i have no idea which path it takes, which is confusing), theres also numerous cases for linking an elf or a prx or a lib, i dont know how to use any of that, but its all in the makefile.. which makes it a little overwhelming..

if you wanna force people to use the default makefiles, i would recommend making them EXTREMELY simple makefiles.. based on the notion that many users are not comfortable with make, and if it doesnt appear simple to them at a glance, they will search for other build environments.. additionally, i firmly believe the makefile for a sample ap should be as simple as the sample ap its self, one file, no external links, as minimal as possible.. that said, i'm probably not the target audience, since i'm one of the people that will probably look at it, freak out at the complexity and build my own script/environment.. (for example i've made a very thorough visual studio integration)

anyway, doesnt matter.. just sharing a point of view..
thanks heaps for your thoughts! i expect that will be the problem :P

if it works, i'll release a little demo of my game soon.
http://www.dotblip.com/caelestis/screenshots.html
User avatar
turkeyman
Posts: 75
Joined: Wed Oct 20, 2004 7:38 pm
Location: Brisbane, Australia
Contact:

Post by turkeyman »

worked like a charm.

thanks TyRaNiD! :P
Post Reply