掌叔
2008-06-07 16:31:21
摘自:[url]http://xinyu-29.spaces.live.com[/url]
作者:Computer29
配置开发环境,测试HELLO WORLD
工具:toolchain.......
将psptoolchain-20060120.tgz解压
按照README里
1、chmod a+x ./toolchain.sh
2、./toolchain.sh 已ROOT权限
完成后:
gmake[2]: Leaving directory `/tmp/pspdev/pspsdk/src/atrac3'
Making clean in .
gmake[2]: Entering directory `/tmp/pspdev/pspsdk/src'
gmake[2]: Nothing to be done for `clean-am'.
gmake[2]: Leaving directory `/tmp/pspdev/pspsdk/src'
gmake[1]: Leaving directory `/tmp/pspdev/pspsdk/src'
Making clean in .
gmake[1]: Entering directory `/tmp/pspdev/pspsdk'
test -z "doc/pspsdk.tag -r doc/html " || rm -f doc/pspsdk.tag -r doc/html
gmake[1]: Leaving directory `/tmp/pspdev/pspsdk'
3、export PATH="/usr/local/pspdev/bin:"
最后psp-cgg -v
[root@localhost psptoolchain]# psp-gcc -v
使用内建 specs。
目标:psp
配置为:../configure --prefix=/usr/local/pspdev --target=psp --enable-languages=c,c++ --with-newlib --enable-cxx-flags=-G0
线程模型:single
gcc 版本 4.0.2 (PSPDEV 20051022)
返回类似信息即安装成功。
接下来是HELLO WORLD
/// Hello World - My First App for the PSP
/*
This program was created by (Your Name Here) on (Date Here)
It is a simple "Hello World" Application.
*/
#include
#include
PSP_MODULE_INFO("Hello World", 0, 1, 1);
#define printf pspDebugScreenPrintf
#define i 0
/* 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
By Computer29");
sceKernelSleepThread();
return 0;
}
以及我们的MAKE FILE
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
好了,最后make一下即可得到1。0的PBP,再用工具转换成1.5的,然后CP到PSP/GAME150下就可以了!
andmoe
2011-10-18 09:54:03
这分明就是在开发嵌入式啊