[Ann] PSP Development Tutorial, modules
[Ann] PSP Development Tutorial, modules
All,
Please find (link below, PSP dev totorials section) a new PSP development tutorial concerning modules and PRXs, written by yours truly. There are a few rough edges and some parts are being fixed / completed / clarified. Many thanks to the reviewers for their insighful comments.
http://ps2dev.org/psp/Tutorials/PSP_Mod ... s.download
Comments, suggestions or fixes are welcome. I hope this can be helpful.
Thanks :o)
Ani.
Please find (link below, PSP dev totorials section) a new PSP development tutorial concerning modules and PRXs, written by yours truly. There are a few rough edges and some parts are being fixed / completed / clarified. Many thanks to the reviewers for their insighful comments.
http://ps2dev.org/psp/Tutorials/PSP_Mod ... s.download
Comments, suggestions or fixes are welcome. I hope this can be helpful.
Thanks :o)
Ani.
-
- Posts: 339
- Joined: Thu Sep 29, 2005 4:19 pm
Re: [Ann] PSP Development Tutorial, modules
it sounds very good but there is a common error about GPR usage :Anissian wrote:All,
Please find (link below, PSP dev totorials section) a new PSP development tutorial concerning modules and PRXs, written by yours truly. There are a few rough edges and some parts are being fixed / completed / clarified. Many thanks to the reviewers for their insighful comments.
http://ps2dev.org/psp/Tutorials/PSP_Mod ... s.download
Comments, suggestions or fixes are welcome. I hope this can be helpful.
Thanks :o)
Ani.
SONY uses t0-t3 as arguments registers, that is, a4-a7 or r4-r11. Even our gcc uses those registers as arguments registers (up to 8 max, not 4 !). I think this common error comes from when you try to disassemble with psp-objdump or prxtool which uses the old register naming by default.
Re: [Ann] PSP Development Tutorial, modules
Indeed. Thank you hlide, I will incorporate these remarks in the reviewed version. I used prxtool extensively, and a few docs about R4000. I will dobule check the text, and whether prxtool has a switch or option to show register usage as you state.hlide wrote: I think this common error comes from when you try to disassemble with psp-objdump or prxtool which uses the old register naming by default.
i don't think prxtool uses the new register naming but it can display registers as r0-r31 at last. Don't forget that prxtools was coded with no assumption about the right name on registers.
In fact, using $4-$11 or a0-a3,t0-t3 or a0-a7 or r4-r11 doesn't make any change. What is important is to know that there is trully up to 8 argument registers for a function.
In fact, using $4-$11 or a0-a3,t0-t3 or a0-a7 or r4-r11 doesn't make any change. What is important is to know that there is trully up to 8 argument registers for a function.
prxtool disasm was written to the register model I use which uses t0 to t3 mnemonics instead of a4 to a7 and realistically that is how the toolchain maps them and I dont think the PSP uses the _new_ ABI anyway ;)
Admittedly you can switch prxtool to disasm the registers in the format 'rN' if you cant stand arbitrary mnemonics :) ('--disopts r' if I recall).
Admittedly you can switch prxtool to disasm the registers in the format 'rN' if you cant stand arbitrary mnemonics :) ('--disopts r' if I recall).
yes i checked it : gcc maps them from $0 to $31 except for $sp, and can eventually accept them as additional register names with "$t0"-"$t3" instead of "$a3"-"$a7" even if you can have up to 8 registers.TyRaNiD wrote:prxtool disasm was written to the register model I use which uses t0 to t3 mnemonics instead of a4 to a7 and realistically that is how the toolchain maps them and I dont think the PSP uses the _new_ ABI anyway ;)
Admittedly you can switch prxtool to disasm the registers in the format 'rN' if you cant stand arbitrary mnemonics :) ('--disopts r' if I recall).
And sure, psp-gcc uses ABI_EABI which is not ABI_O32 or ABI_N32.
-
- Posts: 25
- Joined: Fri Jan 19, 2007 3:03 pm
Re: [Ann] PSP Development Tutorial, modules
nice work!Anissian wrote: http://ps2dev.org/psp/Tutorials/PSP_Mod ... s.download
Comments, suggestions or fixes are welcome. I hope this can be helpful.
Can you also create a Bookr "friendly" version? e.g. a DIN-A-5 format.
Bye,
Monsti
Monsti
Re: [Ann] PSP Development Tutorial, modules
With the latest updates, too...monsti wrote:nice work!Anissian wrote: http://ps2dev.org/psp/Tutorials/PSP_Mod ... s.download
Comments, suggestions or fixes are welcome. I hope this can be helpful.
Can you also create a Bookr "friendly" version? e.g. a DIN-A-5 format.
-
- Posts: 6
- Joined: Mon Jul 24, 2006 8:03 pm
Hi.
I have a one question.
In page 6 you give a small example. I try to compile it, but there is some error. btw. You don't give source code to makefile and exports.exp. So I add from makefile and exports from PSPSDK - \psp\sdk\samples\prx\testprx:
makefile
exports.exp
Log
Log2
Regards
Grizzly_cf
p.s. Sorry for my english. I know is terrible :/
I have a one question.
In page 6 you give a small example. I try to compile it, but there is some error. btw. You don't give source code to makefile and exports.exp. So I add from makefile and exports from PSPSDK - \psp\sdk\samples\prx\testprx:
makefile
and:TARGET = test
OBJS = main.o
# Define to build this as a prx (instead of a static elf)
BUILD_PRX=1
# Define the name of our custom exports (minus the .exp extension)
PRX_EXPORTS=exports.exp
USE_PSPSDK_LIBC = 1
INCDIR =
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
LIBDIR =
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
exports.exp
But I get some errors:# Define the exports for the prx
PSP_BEGIN_EXPORTS
# These four lines are mandatory (although you can add other functions like module_stop)
# syslib is a psynonym for the single mandatory export.
PSP_EXPORT_START(syslib, 0, 0x8000)
PSP_EXPORT_FUNC_HASH(module_start)
PSP_EXPORT_VAR_HASH(module_info)
PSP_EXPORT_END
# Export our function
PSP_EXPORT_START(MyLib, 0, 0x0001)
PSP_EXPORT_FUNC_HASH(getModuleInfo)
PSP_EXPORT_END
PSP_END_EXPORTS
Log
When I delete SP_O_CREAT I get:make.exe -f "Makefile" all
psp-gcc -IC:/pspdev/psp/sdk/include/libc -I. -IC:/pspdev/psp/sdk/include -O2 -G0 -Wall -c -o main.o main.c
main.c: In function 'plugin_dump_file':
main.c(15) : error: 'SP_O_CREAT' undeclared (first use in this function)
main.c(15) : error: (Each undeclared identifier is reported only once
main.c(15) : error: for each function it appears in.)
main.c: In function 'plugin_thread':
main.c(42) : warning: unused variable 'res'
make: *** [main.o] Error 1
Log2
Could You help(or/and give me some advices to compile exapmle) me with compile your exapmle, please?make.exe -f "Makefile" all
psp-gcc -IC:/pspdev/psp/sdk/include/libc -I. -IC:/pspdev/psp/sdk/include -O2 -G0 -Wall -c -o main.o main.c
main.c: In function 'plugin_thread':
main.c(42) : warning: unused variable 'res'
psp-build-exports -b exports.exp > exports.c
psp-gcc -IC:/pspdev/psp/sdk/include/libc -I. -IC:/pspdev/psp/sdk/include -O2 -G0 -Wall -c -o exports.o exports.c
psp-gcc -IC:/pspdev/psp/sdk/include/libc -I. -IC:/pspdev/psp/sdk/include -O2 -G0 -Wall -L. -LC:/pspdev/psp/sdk/lib -specs=C:/pspdev/psp/sdk/lib/prxspecs -Wl,-q,-TC:/pspdev/psp/sdk/lib/linkfile.prx main.o exports.o -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lpsplibc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -o test.elf
main.o: In function `module_start':
main.c:(.text+0x104): multiple definition of `module_start'
/cygdrive/c/pspdev/bin/../lib/gcc/psp/4.0.2/../../../../psp/lib/crt0_prx.o:/tmp/pspdev/pspsdk/src/startup/crt0_prx.c:109: first defined here
/cygdrive/c/pspdev/bin/../lib/gcc/psp/4.0.2/../../../../psp/lib/crt0_prx.o: In function `_main':
/tmp/pspdev/pspsdk/src/startup/crt0_prx.c:91: undefined reference to `main'
exports.o:(.rodata.sceResident+0x4): undefined reference to `getModuleInfo'
collect2: ld returned 1 exit status
make: *** [test.elf] Error 1
rm exports.c
Regards
Grizzly_cf
p.s. Sorry for my english. I know is terrible :/
thanks for your comments. I will provide the source for the examples in the fixed version. Unfortunately, several typos are present in the document, such as the SP_CREATE.Grizzly_cf wrote: You don't give source code to makefile and exports.exp.
Regarding the error yo get, that's because the example is supposed to be a pure export module with no main thread iirc, the missing Makefile should have the -mnostartfiles -mnocrt-thingie as described in the document.
Sorry for the inconveniences, but they'll be fixed.
Regards,
Ani.
some typos
page 13
... Assembler dump of the server.prx module
should be ...Assembler dump of the supervisor.prx module
page 08
... The following table shows the most common instruction mnemonics. It MIPS assembly, the result of
should be ...The following table shows the most common instruction mnemonics. In MIPS assembly, the result of
page 08 (Instruction table)
... lw rd offset(base) load the word at address into rd
... w rd load word at addr offset+base into rd
should be ...
... lw rd address load the word at address into rd
... w rd offset(base) load word at addr offset+base into rd
page 20
... you can use the sceKernelGetModuleIdList fuction,
should be ... you can use the sceKernelGetModuleIdList function,
page 27
... // offset to the "jla supervisor_0xB2C390CB", compute the
should be ... // offset to the "jal supervisor_0xB2C390CB", compute the
in all was decent read ...you must improve your grammatical skills
and use the comma (' , ') more properly :P as this is most common error
ex. Jack who loves to deny others of goods is one big asshole
is incorrect in grammar for the reason of improper comma usage
correct form is:
Jack, who loves to deny others of goods, is one big asshole
simple i know but you do this error many times ...i do not aspire to be a
grammatical cop, but if you, a aspiring writer, would def need to know
just exactly what can improve your writing
page 13
... Assembler dump of the server.prx module
should be ...Assembler dump of the supervisor.prx module
page 08
... The following table shows the most common instruction mnemonics. It MIPS assembly, the result of
should be ...The following table shows the most common instruction mnemonics. In MIPS assembly, the result of
page 08 (Instruction table)
... lw rd offset(base) load the word at address into rd
... w rd load word at addr offset+base into rd
should be ...
... lw rd address load the word at address into rd
... w rd offset(base) load word at addr offset+base into rd
page 20
... you can use the sceKernelGetModuleIdList fuction,
should be ... you can use the sceKernelGetModuleIdList function,
page 27
... // offset to the "jla supervisor_0xB2C390CB", compute the
should be ... // offset to the "jal supervisor_0xB2C390CB", compute the
in all was decent read ...you must improve your grammatical skills
and use the comma (' , ') more properly :P as this is most common error
ex. Jack who loves to deny others of goods is one big asshole
is incorrect in grammar for the reason of improper comma usage
correct form is:
Jack, who loves to deny others of goods, is one big asshole
simple i know but you do this error many times ...i do not aspire to be a
grammatical cop, but if you, a aspiring writer, would def need to know
just exactly what can improve your writing
10011011 00101010 11010111 10001001 10111010
Is working patching import stub?
I executed examples in your tutorial.
But patching import table method is not work in CF3.03 above.
Is it ture at CF 3.xx?
But patching import table method is not work in CF3.03 above.
Is it ture at CF 3.xx?
Re: Is working patching import stub?
Sorry, I solved it.fishdrop wrote:I executed examples in your tutorial.
But patching import table method is not work in CF3.03 above.
Is it ture at CF 3.xx?