Rust SDK for Sony PSP homebrew

Write PSP homebrew in modern, safe Rust.

Syscall bindings for the PSP OS, safe RAII wrappers on top of them, and a cargo psp toolchain that turns your crate into an EBOOT.PBP. Edition 2024, with kernel mode and experimental std support.

Syscall bindings
830+
High-level modules
40+
Examples
30
License
MIT
Stylised handheld with “Hello PSP from rust!” on screen Hello PSP from rust! PSP is now operating at 333/166MHz

Why rust-psp

A complete SDK, not just bindings

A maintained fork of overdrivenpotato/rust-psp, updated for Edition 2024 on recent nightly Rust and extended well beyond the original crate.

  • Edition 2024, pinned nightly

    Built and tested in CI against a pinned nightly, with #[unsafe(no_mangle)]-style attributes and unsafe_op_in_unsafe_fn enforced across the workspace.

  • Raw access when you need it

    psp::sys exposes 830+ OS functions across 50+ system libraries (threads, I/O, GE, audio, networking, codecs), resolved by NID at load time, plus the sceGu/sceGum graphics library written in Rust.

  • Safe wrappers by default

    RAII handles for files, sockets, audio channels, fonts and threads. Allocators and VRAM return Result with structured errors instead of panicking.

  • Kernel mode

    module_kernel!() unlocks Media Engine control, hardware registers, syscall hooking, NAND, IR remote and exception handlers on custom firmware.

  • Experimental std

    A PSP platform layer for the standard library: String, Vec, std::fs, std::thread, std::sync and std::time on the device.

  • One command to a playable EBOOT

    cargo psp builds core/alloc (or std) for mipsel-sony-psp, converts the ELF to a PRX, and packs PARAM.SFO and assets into EBOOT.PBP.

Get started

From zero to EBOOT.PBP

You need a nightly Rust toolchain, this fork's cargo-psp tools, and a crate that depends on psp from Git.

  1. Pin a nightly toolchain

    The PSP target needs nightly features and -Z build-std, which requires the Rust source component. The SDK uses nightly internals, so pin the nightly CI tests against; the newest nightly may not build.

    rust-toolchain.toml
    [toolchain]
    channel = "nightly-2026-04-13"
    components = ["rust-src"]
  2. Install the build tools

    Installs cargo-psp plus the prxgen, pack-pbp, mksfo and prxmin helpers it calls. They must be on your PATH.

    Any platform
    cargo install --git https://github.com/AndrewAltimit/rust-psp cargo-psp --locked

    Builds the host tools from this repository and places all five binaries in ~/.cargo/bin.

  3. Create a crate that depends on psp

    Use cargo new my-game, point the dependency at this repository, and replace main.rs. The entry point is psp_main, registered by psp::module!.

    Cargo.toml
    [package]
    name = "my-game"
    version = "0.1.0"
    edition = "2024"
    
    [dependencies]
    psp = { git = "https://github.com/AndrewAltimit/rust-psp" }
    # optional features: "kernel", "std", "embedded-graphics"
    src/main.rs
    #![no_std]
    #![no_main]
    
    psp::module!("my_game", 1, 0);
    
    fn psp_main() {
        psp::callback::setup_exit_callback().unwrap();
        psp::dprintln!("Hello PSP from rust!");
    }
  4. Build and run

    Run in the PPSSPP emulator, or copy the file to ms0:/PSP/GAME/my-game/EBOOT.PBP on a Memory Stick for real hardware.

    Terminal
    cargo psp --release
    # Output: target/mipsel-sony-psp/release/EBOOT.PBP

    Optional: a Psp.toml next to Cargo.toml sets the XMB title, icon, background and other PARAM.SFO fields (for example title = "My Game").

API overview

High-level modules

Safe, idiomatic wrappers live at the top of the crate. Everything they wrap is also available unwrapped in psp::sys.

System & runtime

  • callback

    Home-button exit callback in one call.

  • thread

    Closure-based spawn, JoinHandle, ThreadBuilder.

  • sync

    SpinMutex, SpinRwLock, lock-free SpscQueue, UncachedBox.

  • timer

    One-shot Alarm with closures and RAII VTimer.

  • time

    Instant, Duration, DateTime, FrameTimer.

  • rtc

    Tick arithmetic, RFC 3339 format/parse, UTC and local conversion.

  • power

    Clock speeds, battery info, AC detection, power-event callbacks.

  • system_param

    Language, nickname, timezone, date and time format.

  • dialog

    Blocking message, confirm and error dialogs.

  • panic

    Panic handler with unwinding and catch_unwind.

  • test_runner

    On-device test harness reporting FINAL_SUCCESS/FINAL_FAILURE.

Graphics

  • display

    Vblank sync and framebuffer set/get.

  • framebuffer

    DoubleBuffer page flipping, DirtyRect, LayerCompositor.

  • gu_ext

    GU state snapshots, 2D setup and a SpriteBatch.

  • vram_alloc

    VRAM bump allocator returning Result.

  • font

    System PGF fonts with a cached VRAM glyph atlas.

  • image

    Hardware JPEG decode and software BMP decode.

  • embedded_graphics

    DrawTarget framebuffer for the embedded-graphics crate. feature

Audio & media

  • audio

    RAII PCM channels and the SRC channel.

  • audio_mixer

    Multi-channel mixer with volume, panning and fades.

  • audiocodec

    Hardware MP3, AAC, ATRAC3 and ATRAC3plus frame decoding.

  • mp3

    Mp3Decoder over the sceMp3 API.

  • mpeg

    H.264 decoding on the Media Engine via AvcDecoder.

Input & storage

  • input

    Controller with press/release detection and analog deadzones.

  • osk

    System on-screen keyboard via text_input or OskBuilder.

  • io

    RAII File, read_dir, read_to_vec, stat.

  • config

    Compact binary key-value settings files.

  • savedata

    Builder over the system save/load dialog.

  • usb

    USB bus control and RAII UsbStorageMode.

Networking

  • net

    Access-point connection, DNS, TcpStream, UdpSocket.

  • http

    HttpClient with request builder and responses.

  • wlan

    WLAN chip status and MAC address.

Memory, cache & math

  • mem

    Typed partition allocators; wrong-partition use is a compile error.

  • cache

    CachedPtr/UncachedPtr and dcache/icache control.

  • dma

    memcpy_dma and vram_blit_dma with cache handling.

  • simd

    VFPU vectors, 4×4 matrices, colour ops and easing.

  • math

    VFPU-backed sinf, cosf, fminf, fmaxf.

Kernel mode --features kernel

  • me

    Boot the Media Engine and run tasks on it with MeExecutor.

  • hw

    Volatile MMIO reads/writes and typed Register<T>.

  • hook

    SyscallHook and find_function for CFW plugins.

  • gpio

    GPIO port and pin access.

  • syscon

    System controller: battery, power status, Baryon version.

  • sysreg

    System registers: GPIO and USB enable, interrupts.

psp::sys

The raw layer: 830+ extern functions generated by the psp_extern! macro, each stub tagged with its NID so the PSP loader can resolve it, plus the GU/GUM graphics library implemented in Rust. Largest areas: networking, kernel threads and memory, PSMF, USB, utility dialogs, RTC and I/O.

Browse psp/src/sys

Examples

30 runnable examples

Each is its own crate under examples/. Build one with cd examples/<name> && cargo +nightly-2026-04-13 psp --release (the nightly CI pins).

Kernel mode

Full hardware access on custom firmware

Enable the kernel feature and declare your module with module_kernel!. It sets module attribute 0x1000 and starts psp_main on a kernel thread.

src/main.rs
#![no_std]
#![no_main]

psp::module_kernel!("MyKernelApp", 1, 0);

fn psp_main() {
    psp::callback::setup_exit_callback().unwrap();
    // Kernel-only: Media Engine clock
    let me_mhz = unsafe {
        psp::sys::scePowerGetMeClockFrequency()
    };
    psp::dprintln!("ME clock: {}MHz", me_mhz);
}

Unlocks

  • Media Engine boot and task execution (psp::me)
  • Memory-mapped register I/O (psp::hw), GPIO, Syscon and Sysreg
  • Syscall hooking for CFW plugins (psp::hook, sctrlHEN*)
  • NAND flash, SIRCS infrared and USB bus-driver syscalls
  • CPU exception handler registration

Requires custom firmware such as ARK-4 or PRO. In PPSSPP the module loads, but kernel-only calls may return errors.

Standard library experimental

Use std on the PSP

With the std feature, cargo psp overlays a PSP platform layer onto your rust-src and rebuilds the standard library with -Z build-std.

src/main.rs
#![feature(restricted_std)]
#![no_main]

psp::module!("std_hello", 1, 0);

fn psp_main() {
    psp::callback::setup_exit_callback().unwrap();
    let greeting = String::from("Hello from std!");
    let names = vec!["sajattack", "overdrivenpotato"];
    for name in names {
        psp::dprintln!("{greeting} Hi, {name}.");
    }
}
Standard library support on PSP
std APIBacked by
String, Vec, collectionsPSP memory allocator
std::threadsceKernelCreateThread
Mutex / CondvarLightweight mutexes / event flags
std::timeSystem time and RTC ticks
std::fs, stdiosceIo*, kernel stdout/stderr
std::net, std::processUnsupported

Use psp = { git = "…", features = ["std"] }. cargo psp detects the feature; RUST_PSP_BUILD_STD=1 forces a std build. Output goes to target/mipsel-sony-psp-std/.

The PSP overlay ships in the rust-psp repository, and cargo psp finds it next to your psp dependency, so it always matches the revision you build against. See docs/std.md.

Toolchain

What cargo psp does

A thin wrapper over cargo build that drives three small host tools. All of them, plus a standalone PRX minifier, are written in Rust.

Build pipeline: cargo build produces an ELF, prxgen converts it to a PRX, mksfo creates PARAM.SFO from Psp.toml, and pack-pbp combines them into EBOOT.PBP.
  1. source Your crate + psp
  2. cargo build
    -Z build-std · mipsel-sony-psp
  3. artifact ELF imports fixed up
  4. prxgen
  5. artifact PRX relocatable module
  6. pack-pbp
    + PARAM.SFO from mksfo
  7. output EBOOT.PBP ready for XMB / PPSSPP
Host tools
BinaryRole
cargo-pspCargo subcommand: builds, then runs the steps below for every binary target.
prxgenConverts the linked ELF into a PSP PRX module.
mksfoWrites PARAM.SFO (title, disc ID, version, region…) from Psp.toml.
pack-pbpPacks SFO, icons, background, music and the PRX into EBOOT.PBP.
prxminStandalone utility that minifies and strips PRX files.
Psp.toml (optional)
title = "My Game"
xmb_icon_png = "assets/icon0.png"       # 144x80
xmb_background_png = "assets/pic1.png"  # 480x272
disc_id = "ABCD-12345"
disc_version = "1.00"