Programming On The PSP
Programming On The PSP
Programming On The PSP
The PSP is in a unique situation in that it is a device funded by a gaming industry. This provides a very low price point for
the hardware, which in effect makes it possible for it to become a mass production item similar to televisions, microwaves,
etc. There will be more Sony PSP sold in a year’s time than all the Sony CLIE PDA's ever sold in its lifetime (which are not
sold any more). This provides a very unique situation in that the PSP (with its CPU core more powerful than the Sony
CLIE) can actually replace the CLIE and act like a PDA. But it is on par with a notebook because the feature set of the PSP
is way higher than that of a PDA. There is only one functionality that is needed to make the full transition to a computer,
and that is support for large monitors (via USB most likely). A hard drive would also be nice, and was included in the PSP
Go. However, since flash memory is now increasing in capacity at exponential rate, 64GB M2 cards is becoming adequate.
PSP programming is going to be a hot industry, but Sony would have to provide free or very low cost development kits for
the average person, and not only to large game companies. Something like a personal version for those that wish to develop
programs to run off of the memory stick only, as this would catapult the Sony PSP from a niche product to a common
household item. There will be software or shareware programs for anything under the sun. It may even eclipse the PC as the
standard computing device because everything is becoming mobile (look at how notebooks sell more than desktops these
days).
The PSP Slim allows a higher resolution output via the TV-Out socket. This would answer need for programming on the
PSP itself and outputting the code on a large display. Can the PSP be used to program PSP games? With the release of the
PSP Slim, this has become a reality (with its extra 32MB main memory). The only missing piece is a nice official keyboard
or a touch screen add-on for the PSP display. With the PSP Go supporting Bluetooth, this may finally become a possibility
(assuming keyboard Bluetooth is supported).
Programming on the PSP is similar to programming on Linux with a MIPS CPU. The only major "feature" of the MIPS
CPU is that it has a special absolute memory map addressing that allows segments of the absolute memory to be uncached
versions of the same data in main memory. In particular, 1024MB of user space over 0x40000000 are the uncached versions
of your data in lower address space. So let’s say you are reading and writing data at address 0x00012345 that may reside in
the cache. If you want to bypass the cache, simply add (by doing a logical OR) 0x40000000, so 0x40012345 would point
directly to the data in main memory.
Memory Map
The following is the memory map of the PSP. Note that since the PSP only has 32MB or 64MB of main memory, the virtual
addresses below all map to the physical addresses located within that small area of main memory. Expect a lot of duplicate
virtual addresses pointing to the same location in main memory.
Start End Size Description
0x00010000 0x00013fff 16KB Scratchpad
0x04000000 0x041fffff 2MB VRAM / Framebuffer
0x08000000 0x09ffffff 32MB Main Memory
0x08800000 0x09ffffff 24MB User Memory
0x1fc00000 0x1fcfffff 1MB Hardware Exception Vectors
0x1fd00000 0x1fffffff 3MB Hardware I/O
0x40000000 0x7fffffff 1GB Uncached version of above
0x88000000 0x887fffff 8MB Kernel Memory
0xbfc00000 0xbfcfffff 1MB Hardware Exception Vectors
File systems: - In addition to main memory, you can access various other storage devices through code via normal file
system extensions.
fatms0: Memory Stick
umd0: UMD
flash0: First block of NAND Flash
flash1: Second block of NAND Flash
The PSP uses ELF (Executable and Linking Format) as the executable format. These are packaged into a EBOOT.PBP
along with other files for easy distribution and loading. When loaded, the MIPS CPU can run the code in kernel or user
mode. Most of the XMB and drivers for the hardware boot in kernel mode. Most of the kernel code and device drivers for
the PSP are coded in a reloadable executable format with the extension .prx. This format is a proprietary format made by
Sony. Note that .prx format code need not run in kernel mode, but a vast majority of them are because Sony provided them
to control the PSP hardware.
The EBOOT.PBP is an archive format to store many different files filled with data inside one larger file. Below is a
breakdown of the different files that are known to exist inside a PSP EBOOT.PBP...
The minimum required files needed to exist inside a EBOOT.PBP so that it can run from firmware 1.0 or 1.5 is
PARAM.SFO and UNKNOWN.PSP
The PARAM.SFO (from the EBOOT.PBP above) is a variable length file containing information on the program. It has
many optional labels that can be set as a parameter for the program. Below is a listing of a majority of them and common
values for a typical update PBP that you place in /PSP/GAME/UPDATE on the memory stick...
Label Value
BOOTABLE Integer: 1
CATEGORY String: MG
DISC_ID String: MSTKUPDATE
DISC_VERSION String: 1.00
PARENTAL_LEVEL Integer: 1
REGION Integer: 32768
TITLE String: PSP Update ver. 3.71
TITLE_0 String: (Japanese title)
TITLE_2 String: (French title)
TITLE_3 String: (Spanish title)
TITLE_4 String: (German title)
TITLE_5 String: (Italian title)
TITLE_6 String: (Dutch title)
TITLE_7 String: (Portuguese title)
TITLE_8 String: (Russian title)
TITLE_9 String: (Korean title)
TITLE_10 String: (Traditional Chinese title)
TITLE_11 String: (Simplified Chinese title)
UPDATER_VER String: 3.71
Label Value
BOOTABLE Integer: 1
CATEGORY String: MG
DISC_ID String: UCJS10000
DISC_VERSION String: 1.00
PARENTAL_LEVEL Integer: 1
PSP_SYSTEM_VER String: 1.00
REGION Integer: 32768
TITLE String: My Homebrew Program