I installed the toolchain and began to learn homebrew several days ago. I've read the tutorials here and had some question.
http://www.scriptscribbler.com/psp/
For small homebrew programs, these questions may be insignificant. But I always like to get the bottom level software mechanism cleared before programming. I also plan to write program that need efficient usage of hardware.
Here is some of my questions.
1) The software architecture when psp is running a homebrew program? (for instance: homebrew code invokes runtime library of the toolchain, toolchain function invokes psp os function and the os invokes the bios?)
2) Does the psp mmu performs memory paging or segmenting? I saw code in the tutorial program like this : 'a = (void*) 0x00008000;'
3) I heard psp os does not support multi-process but support multi-thread.
So when a homebrew program is loaded, The XMB process dies and reloaded when homebrew exits?
4) I saw some firmware file were different on different version of psp. But there seems no difference to program for these psp versions. Were some firmware copies in the memory substituted?
5) What does the toolchain runtime library do before the user thread starts? Are there os threads or toolchain runtime library threads when user threads runs?
With these questions, I've read 'yet another PlayStationPortable Documentation' from Hitmen (By the way, where's the 'first' psp documentation? Anyone here can give a link? Thanks), but most question still remains.
What should I do to get such questions clear?
Some generic questions on homebrew
1) Really too large a question to any in a short space of time. In a nutshell the homebrew code has a number of imports linked into the code, the kernel then fixes those up to the correct addresses when it starts. Some of the functions will map to system calls (which allow user apps to talk to kernel libraries), and some will be direct jumps. You don't really need to worry about it too much.
2) The psp doesn't have an mmu, at least in classical sense. What it seems to have is some sort of segmented protection which is of a very limited nature.
3) Well it all depends on what you consider a process and what you consider a thread. The PSP OS is multithreaded, there are no processes in the unix sense. The reason the XMB goes away when you load homebrew is the PSP resets the system and doesn't load up the XMB code, however all the system threads are still there, there is no reason you cannot load the XMB modules up (which creates threads) and run your own threads at the same time.
4) The kernel abstracts the interfaces between modules so even though the underlying libraries are different the interface stays the same. Sometimes new features will be added to new firmware (e.g. the extra save code in 2.0+ firmware) but I would expect Sony to make some effort to maintain a level of backwards compatibility for the old games.
5) Read crt0.c or crt0_prx.c in the pspsdk, all it does it setup the libc, parses the args and creates the initial thread.
2) The psp doesn't have an mmu, at least in classical sense. What it seems to have is some sort of segmented protection which is of a very limited nature.
3) Well it all depends on what you consider a process and what you consider a thread. The PSP OS is multithreaded, there are no processes in the unix sense. The reason the XMB goes away when you load homebrew is the PSP resets the system and doesn't load up the XMB code, however all the system threads are still there, there is no reason you cannot load the XMB modules up (which creates threads) and run your own threads at the same time.
4) The kernel abstracts the interfaces between modules so even though the underlying libraries are different the interface stays the same. Sometimes new features will be added to new firmware (e.g. the extra save code in 2.0+ firmware) but I would expect Sony to make some effort to maintain a level of backwards compatibility for the old games.
5) Read crt0.c or crt0_prx.c in the pspsdk, all it does it setup the libc, parses the args and creates the initial thread.