Host system: Debian GNU/Linux sid/testing x86
PSP: PSP Slim with a hacked 3.90M33-2 firmware
Required tools and libs
Prepare a place for the PSP development stuff:
mkdir -p $HOME/lib/pspdev
Make it available for your current session:
echo -e "export PSPDEV=~/lib/pspdev\nexport PATH=\$PATH:\$PSPDEV/bin" >> $HOME/.bashrc bash
Get and install the toolchain:
svn co svn://svn.ps2dev.org/psp/trunk/psptoolchain cd psptoolchain ./toolchain.sh
It’ll probably ask for some develpment packages, just look for them in apt, install them and run the last step again.
Get and install psp libraries
svn co svn://svn.ps2dev.org/psp/trunk/psplibraries cd psplibraries ./libraries.sh
Ok, requirements installed
Hello world
main.cpp
#include <pspkernel.h> #include <pspdebug.h> PSP_MODULE_INFO("Hello World", 0, 1, 1); #define printf pspDebugScreenPrintf /* Exit callback */ int exit_callback(int arg1, int arg2, void *common) { sceKernelExitGame(); return 0; } /* Callback thread */ int CallbackThread(SceSize args, void *argp) { int cbid; cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL); sceKernelRegisterExitCallback(cbid); sceKernelSleepThreadCB(); return 0; } /* Sets up the callback thread and returns its thread id */ int SetupCallbacks(void) { int thid = 0; thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0); if(thid >= 0) { sceKernelStartThread(thid, 0, 0); } return thid; } int main() { pspDebugScreenInit(); SetupCallbacks(); printf("Hello World"); sceKernelSleepThread(); return 0; }
Makefile
TARGET = hello OBJS = main.o CFLAGS = -O2 -G0 -Wall CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti ASFLAGS = $(CFLAGS) EXTRA_TARGETS = EBOOT.PBP PSP_EBOOT_TITLE = Hello World PSPSDK=$(shell psp-config --pspsdk-path) include $(PSPSDK)/lib/build.mak
Ok, now compile it
saladino@Zack:~/projects/pspstuff$ make psp-g++ -I. -I/home/saladino/lib/pspdev/psp/sdk/include -O2 -G0 -Wall -I. -I/home/saladino/lib/pspdev/psp/sdk/include -O2 -G0 -Wall -fno-exceptions -fno-rtti -D_PSP_FW_VERSION=150 -c -o main.o main.cpp psp-gcc -I. -I/home/saladino/lib/pspdev/psp/sdk/include -O2 -G0 -Wall -D_PSP_FW_VERSION=150 -L. -L/home/saladino/lib/pspdev/psp/sdk/lib main.o -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -o hello.elf psp-fixup-imports hello.elf mksfo 'Hello World' PARAM.SFO psp-strip hello.elf -o hello_strip.elf pack-pbp EBOOT.PBP PARAM.SFO NULL \ NULL NULL NULL \ NULL hello_strip.elf NULL [0] 408 bytes | PARAM.SFO [1] 0 bytes | NULL [2] 0 bytes | NULL [3] 0 bytes | NULL [4] 0 bytes | NULL [5] 0 bytes | NULL [6] 77508 bytes | hello_strip.elf [7] 0 bytes | NULL rm -f hello_strip.elf
That’s all, now copy it to the corresponding folder in your memory stick, in my case this was psp/game380/helloworld/EBOOT.PBP
