| View previous topic :: View next topic |
| Author |
Message |
dandev
Joined: 24 Jun 2005 Posts: 7 Location: Canada
|
Posted: Sat Jun 25, 2005 11:48 am Post subject: psp-gcc instead of psp-ld |
|
|
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 |
|
 |
weak
Joined: 13 Jan 2005 Posts: 114 Location: Vienna, Austria
|
Posted: Sat Jun 25, 2005 1:17 pm Post subject: |
|
|
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 |
|
 |
mrbrown
Joined: 17 Jan 2004 Posts: 1536
|
Posted: Sat Jun 25, 2005 3:30 pm Post subject: |
|
|
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 |
|
 |
dandev
Joined: 24 Jun 2005 Posts: 7 Location: Canada
|
Posted: Sat Jun 25, 2005 7:50 pm Post subject: |
|
|
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 |
|
 |
mrbrown
Joined: 17 Jan 2004 Posts: 1536
|
Posted: Sat Jun 25, 2005 9:49 pm Post subject: |
|
|
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 |
|
 |
mrbrown
Joined: 17 Jan 2004 Posts: 1536
|
Posted: Sat Jun 25, 2005 9:50 pm Post subject: |
|
|
| Note also with the 20050625 toolchain that "-Wl,-Ttext -Wl,8900000" is no longer required. |
|
| Back to top |
|
 |
TommyBear
Joined: 24 Jun 2005 Posts: 50
|
Posted: Sun Jun 26, 2005 12:47 am Post subject: |
|
|
| 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 |
|
 |
|