How pspdev/pspsdk works
Purpose and Deliverables
PSPSDK is a native C/assembly SDK for Sony PSP software. It installs PSP OS headers, import/stub libraries, runtime code, graphics/audio helpers, build templates, and host-side packaging/link tools. Consumer entry points are the installed headers and Make/CMake integration rather than a single application executable. Core build roots: configure.ac, src/Makefile.am, tools/Makefile.am.
Build and Installation Pipeline
GNU Autotools generates the build; bootstrap prepares configure support, then configure selects the PSPDEV toolchain and install prefix. Recursive Automake targets compile and install SDK libraries and host utilities. build-and-install.sh is a convenience entry point. PSP cross-compilation depends on the external PSPDEV Allegrex toolchain; zlib is a build dependency. Container and CI integration live in Dockerfile, .github/workflows/compilation.yml, and .github/workflows/docker.yml.
ABI, Startup, and PSP OS Boundary
The SDK’s central boundary is PSP application/module code versus PSP firmware APIs. Public headers declare the API, while assembly stubs bind calls to firmware exports. User-mode and kernel-mode APIs are deliberately separated in src/user/, src/kernel/, and driver-specific headers. Startup initializes executable or PRX module runtime state through src/startup/crt0.c, src/startup/crt0_prx.c, and src/startup/prxexports.c.
Linking and PRX Production
PSP-target build rules support static ELF executables and relocatable PRX modules. Common project integration and PRX linker setup are in src/base/build.mak, src/base/build_prx.mak, and src/base/linkfile.prx.in. Import/export assembly and post-link transformations connect application symbols to PSP firmware modules: src/base/pspimport.s, tools/psp-build-exports.c, tools/psp-fixup-imports.c, and tools/psp-prxgen.c.
Runtime Compatibility Layer
libcglue adapts newlib-facing POSIX-like operations—file descriptors, sockets, locks, pipes, and initialization—to PSP services. It is the key dependency boundary between standard C code and PSP kernel/user APIs. Thread-related portability support is separate in src/libpthreadglue/osal.c and src/libpthreadglue/tls-helper.c; SDK convenience/runtime functions reside in src/sdk/pspsdk.h, src/sdk/loadmodule.c, and src/sdk/threadutils.c.
Hardware and Media Libraries
Subsystems expose PSP firmware functionality through headers plus mostly assembly import stubs: input/display/audio (src/ctrl/pspctrl.h, src/display/pspdisplay.h, src/audio/pspaudiolib.c); networking (src/net/pspnet.h, src/net/psphttp.h, src/net/sceNetInet.S); and media codecs (src/mpeg/pspmpeg.h, src/mp3/pspmp3.h, src/atrac3/pspatrac3.h). Additional groups cover USB, WLAN, power, storage, utility dialogs, and kernel services.
Graphics Stack
libGU is a concrete implementation layer over the PSP Graphics Engine: it constructs and submits rendering commands, manages VRAM, display buffers, synchronization, and GPU state. Its public interface and internals are in src/gu/pspgu.h, src/gu/guInternal.c, and src/gu/vram.c. libGUM supplies matrix manipulation layered for GU usage via src/gum/pspgum.h, src/gum/pspgum.c, and src/gum/pspgum_vfpu.c; VFPU/FPU support is in src/vfpu/pspvfpu.c and src/fpu/pspfpu.c.
Host Tools, Packaging, and Documentation
Host executables transform assets and produce PSP-distributable artifacts: binary converters (tools/bin2c.c), PARAM.SFO generators (tools/mksfo.c), and PBP pack/unpack tools (tools/pack-pbp.c, tools/unpack-pbp.c). tools/psp-config.c locates installations. The separately licensed PRX encryption utility is tools/PrxEncrypter/main.c. Doxygen output is configured by Doxyfile; sample programs under src/samples/ are integration consumers of the installed SDK and build templates.
Main entry points: configure.ac Autotools build roots · pspimport.s Firmware import stubs · build.mak PSP project rules · build_prx.mak PRX linker setup
Components 20
Build & delivery
- Autotools build roots · Configures PSP toolchain, recursive builds, and installation.
configure.ac - Build installer
build-and-install.sh - PSPDEV Allegrex toolchain
- Installed SDK · Headers, libraries, templates, and host utilities consumed by PSP projects.
- PSP project rules · Builds static ELF applications or relocatable PRX modules.
src/base/build.mak - PRX linker setup
src/base/build_prx.mak - Sample programs · Integration consumers of installed headers and project templates.
PSP ABI & runtime
- Public PSP headers · Declares PSP user, kernel, and subsystem APIs.
- Firmware import stubs · Binds application imports to PSP firmware exports.
src/base/pspimport.s - Executable & PRX startup · Initializes executable or module runtime state.
src/startup/crt0.c - PSP firmware APIs
SDK libraries
- libcglue · Adapts newlib file, socket, lock, pipe, and initialization operations to PSP services.
- libpthreadglue
src/libpthreadglue/osal.c - SDK convenience runtime
src/sdk/pspsdk.h - Hardware & media libraries · Input, display, audio, networking, codecs, storage, power, USB, and utility services.
src/ctrl/pspctrl.h - libGU · Builds GPU commands and manages VRAM, buffers, synchronization, and state.
src/gu/guInternal.c - libGUM · Matrix operations layered for GU rendering.
src/gum/pspgum.c - VFPU & FPU support
src/vfpu/pspvfpu.c
Host tools
- PRX post-link tools · Generates exports, fixes imports, and creates PRX output.
tools/psp-prxgen.c - Packaging & asset tools · Converts assets and creates PARAM.SFO and PBP distributables.
tools/pack-pbp.c
Connections 20
- Build installer → Autotools build roots: prepares and runs
- Autotools build roots → PSPDEV Allegrex toolchain: selects
- Autotools build roots → Installed SDK: builds and installs
- Public PSP headers → Firmware import stubs: declared calls bind through
- Firmware import stubs → PSP firmware APIs: imports
- Executable & PRX startup → PSP firmware APIs: initializes against
- PSP project rules → PRX linker setup: selects for modules
- PRX linker setup → PRX post-link tools: produces input for
- PRX post-link tools → PSP firmware APIs: creates firmware-compatible PRX
- libcglue → PSP firmware APIs: adapts C operations to
- libpthreadglue → libcglue: uses runtime services
- SDK convenience runtime → PSP firmware APIs: uses
- Hardware & media libraries → Firmware import stubs: implemented largely by
- libGU → Hardware & media libraries: uses display services
- libGUM → libGU: layers matrix operations on
- VFPU & FPU support → libGUM: accelerates
- Installed SDK → Public PSP headers: installs
- Installed SDK → PSP project rules: provides
- Installed SDK → Packaging & asset tools: includes
- Sample programs → Installed SDK: consumes