yet another PlayStationPortable Documentation

31  Appendix


index

31.1  GCC Quick How To


note: the instructions in this chapter are only for dyhards that want to bootstrap their own GCC from vanilla sources. For everyone else a toolchain containing allegrex specific patches is highly recommended. For short: you dont need this :)
index

31.1.1  compile ASM to object:


<GCCROOT>/bin/???-elf-as -c
-I <GCCROOT>/???-elf/include -I <additional includes>
testasm.s -o testasm.o
index

31.1.2  compile C to object:


<GCCROOT>/bin/???-elf-gcc -c
-I <GCCROOT>/???-elf/include -I <additional includes>
-nostdlib testc.c -o testc.o
index

31.1.3  compile C++ to object:


<GCCROOT>/bin/???-elf-g++ -c
-I <GCCROOT>/???-elf/include -I <additional includes>
-nostdlib -fno-exceptions testcpp.cpp -o testcpp.o
index

31.1.4  link objects


<GCCROOT>/bin/???-elf-ld -T mips-pspbin.x -o test.elf crt0.o
<GCCROOT>/lib/gcc-lib/???-elf/3.3/crtbegin.o
<GCCROOT>/lib/gcc-lib/???-elf/3.3/crtend.o
testasm.o testc.o testcpp.o -lg -lstdc++ -lm -lc -lnosys 
 
you only need to link against crtbegin.o/crtend.o if you are using c++, and you only need -lg,-lstdc++,-lc,-lm if you are actually using these libraries (of course:)). however if you do so, linking against -lnosys as well is essential.
index

31.1.5  remove unneeded sections (debug info etc) from object


<GCCROOT>/bin/???-elf-strip -s test.elf
index

31.1.6  convert object to plain binary


<GCCROOT>/bin/???-elf-objcopy -O binary test.elf test.bin
index

31.1.7  convert absolute address into filename/line number/function


compile with "-g" flag, then use

<GCCROOT>/bin/???-elf-addr2line -f -e test.elf <address>
index

31.1.8  Building a Crosscompiler


configure options:
--target=misel-elf
--with-cpu=r4000
--disable-threads
--enable-languages=c
--disable-shared
--disable-nls
--with-newlib 
 
note: a specialised 'allegrex' port is highly recommended. r4000 (or r5900) will work, but is suboptimal
index

31.1.9  Linker Script


to do
index

31.1.10  Startup Code


to do
index

31.2  Games


index

31.3  Developers



index