forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

psp-gcc instead of psp-ld

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
dandev



Joined: 24 Jun 2005
Posts: 7
Location: Canada

PostPosted: Sat Jun 25, 2005 11:48 am    Post subject: psp-gcc instead of psp-ld Reply with quote

Hi,
I've been using psp-ld to link my code for the last couple of days, but I then found out that I need to use psp-gcc instead, and it also complains less when linking libc.

Anyways, when I was using psp-ld, my own Hello World program had produced a EBOOT.PBP that runs on my PSP fine, but when I try linking with psp-gcc instead, the program says in my PSP, "The game could not be started. (800200D9)"

Here is what I do to compile:

rm *.o
psp-gcc -g -c controller.c
psp-gcc -g -c hellopsp.c
psp-gcc -g -c pg.c
psp-gcc -g -c -xassembler -O -o startup.o startup.S


psp-gcc startup.o hellopsp.o pg.o controller.o -Wl,-Ttext -Wl,8900000 -o out -lc

(Was: psp-ld -O0 -G0 startup.o hellopsp.o pg.o controller.o -M -Ttext 8900000 -q -o out -lc > hellopsp.map --> worked)

g++ outpatch.cpp -o outpatch
./outpatch out

elf2pbp outp

===

Any idea what I need to do to psp-gcc so that I get a working EBOOT.PBP?
Back to top
View user's profile Send private message
weak



Joined: 13 Jan 2005
Posts: 114
Location: Vienna, Austria

PostPosted: Sat Jun 25, 2005 1:17 pm    Post subject: Reply with quote

psp-gcc startup.o hellopsp.o pg.o controller.o -Wl,-Ttext -Wl,8900000 -nostartfiles -o out -lc

should do the trick
Back to top
View user's profile Send private message
mrbrown



Joined: 17 Jan 2004
Posts: 1536

PostPosted: Sat Jun 25, 2005 3:30 pm    Post subject: Reply with quote

Also note that you can skip the outpatch step entirely, thanks to the astute observations of Warren.

Take out the -q in the linker step (seems you already have). Make sure .xodata.sceModuleInfo in startup.s is called .rodata.sceModuleInfo instead.

If you do this then you won't have to run outpatch over the final ELF.
Back to top
View user's profile Send private message
dandev



Joined: 24 Jun 2005
Posts: 7
Location: Canada

PostPosted: Sat Jun 25, 2005 7:50 pm    Post subject: Reply with quote

Alright, thanks. It works now.

What I had to do was one change:

psp-gcc startup.o hellopsp.o pg.o controller.o -Wl,-Ttext -Wl,8900000 -nostartfiles -o out -lc


However, if I take out the outpatch lines and do an elf2pbp on just "out" (instead of outp), the PSP crashes the program. And, If I changed to: .section .rodata.sceModuleInfo, "a", @progbits, the compiler complains it cannot find "scemoduleinfo".
Back to top
View user's profile Send private message
mrbrown



Joined: 17 Jan 2004
Posts: 1536

PostPosted: Sat Jun 25, 2005 9:49 pm    Post subject: Reply with quote

Yeah, sorry about that, it seems you have to have a custom linker script that declares the .rodata.sceModuleInfo section before the .rodata section. This is because the PSP bootloader specifically looks for the .rodata.sceModuleInfo section to locate the module info structure.

I've just finished support for that custom linker script within the linker itself. It's in Subversion awaiting release from ooPo. If you see a 20050625 on his site that's the one :).
Back to top
View user's profile Send private message
mrbrown



Joined: 17 Jan 2004
Posts: 1536

PostPosted: Sat Jun 25, 2005 9:50 pm    Post subject: Reply with quote

Note also with the 20050625 toolchain that "-Wl,-Ttext -Wl,8900000" is no longer required.
Back to top
View user's profile Send private message
TommyBear



Joined: 24 Jun 2005
Posts: 50

PostPosted: Sun Jun 26, 2005 12:47 am    Post subject: Reply with quote

mrbrown wrote:
Note also with the 20050625 toolchain that "-Wl,-Ttext -Wl,8900000" is no longer required.


Is this the version in SVN? If so do we have access to the SVN repository for updates?

Tommy.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group