psp showing blackscreen and shutting down

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
rAdi
Posts: 13
Joined: Tue Jul 08, 2008 5:17 pm

psp showing blackscreen and shutting down

Post by rAdi »

Hi,

yesterday I've installed the psptoolchain on my Ubuntu 8.04 System. PSP is running 4.01-M33-2, 1.50 kernelpatch installed. Everything worked fine and I was happy...until I compiled my first homebrew. Actually the compilation process worked, but when I tried to run the application (only simple hello world) the psp shows a blackscreen and restarts after 10sec. I found a thread about an issue with a toolchain update, but it should be fixed. I tried to checkout an older Version of the toolchain but the same issue.

I've compiled and tried to run one of the samples, but I'm getting the same problem. When running the homebrews using psplink/usbhost_fs and pcterm there is no output at all. The PSP just shows the string printed by psplink on startup and shuts down after 10sec. Sometimes usbhost_fs recognizes the psp's shut down. Sometimes it dosen't.

So far the problem. I'm a noob in psp programming, if I'm missing some stupid point don't be to harsh to me ;)

Last but not least the code and some output:

Code: Select all

#include <pspkernel.h>
#include <pspdebug.h>

PSP_MODULE_INFO&#40;"Hello World", 0, 1, 1&#41;;
PSP_HEAP_SIZE_KB&#40;20480&#41;;

// Exit callback
int exit_callback&#40;int arg1, int arg2, void *common&#41; &#123;
	sceKernelExitGame&#40;&#41;;
	return 0;
&#125;

// Callback thread
int CallbackThread&#40;SceSize args, void *argp&#41; &#123;
	int cbid;
	
	cbid = sceKernelCreateCallback&#40;"Exit Callback", exit_callback, NULL&#41;;
	sceKernelRegisterExitCallback&#40;cbid&#41;;
	
	sceKernelSleepThreadCB&#40;&#41;;
	
	return 0;
&#125;

// Sets up the callback thread and returns it thread id
int SetupCallbacks&#40;void&#41; &#123;
	int thid = 0;
	
	thid = sceKernelCreateThread&#40;"update_thread", CallbackThread, 0x11, 0xFA0, 0, 0&#41;;
	if&#40;thid >= 0&#41; &#123;
		sceKernelStartThread&#40;thid, 0, 0&#41;;
	&#125;
	
	return thid;
&#125;

int main&#40;&#41; &#123;
	pspDebugScreenInit&#40;&#41;;
	SetupCallbacks&#40;&#41;;
	
	pspDebugScreenPrintf&#40;"Hello World\n"&#41;;
	
	sceKernelSleepThread&#40;&#41;;
	
	return 0;
&#125;

Code: Select all

TARGET = hello
OBJS = main.o

#BUILD_PRX = 1
#PSP_FW_VERSION=371
#PSP_LARGE_MEMORY=1

INCDIR =
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $&#40;CFLAGS&#41; -fno-exceptions -fno-rtti
ASFLAGS = $&#40;CFLAGS&#41;

LIBDIR =
LDFLAGS =

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = Hallo Welt

PSPSDK=$&#40;shell psp-config --pspsdk-path&#41;
include $&#40;PSPSDK&#41;/lib/build.mak

Code: Select all

make
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall -D_PSP_FW_VERSION=150   -c -o main.o main.c
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall -D_PSP_FW_VERSION=150  -L. -L/usr/local/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 'Hallo Welt' 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
&#91;0&#93;        408 bytes | PARAM.SFO
&#91;1&#93;          0 bytes | NULL
&#91;2&#93;          0 bytes | NULL
&#91;3&#93;          0 bytes | NULL
&#91;4&#93;          0 bytes | NULL
&#91;5&#93;          0 bytes | NULL
&#91;6&#93;      79540 bytes | hello_strip.elf
&#91;7&#93;          0 bytes | NULL
rm -f hello_strip.elf
As you can see in the Makefile I've tried to compile for FW 1.50 and 3.71.

I hope you can help me to find a solution for my problems.
User avatar
Wally
Posts: 663
Joined: Mon Sep 26, 2005 11:25 am

Post by Wally »

Firstly you should be building for 401 M33-2 not 1.5..


So this
#BUILD_PRX = 1
#PSP_FW_VERSION=371
#PSP_LARGE_MEMORY=1
should be
BUILD_PRX = 1
PSP_FW_VERSION=402
#PSP_LARGE_MEMORY=1
The FW_VERSION can be anything.

type make clean in the directory
then make

Tell us how you go!

Wally

P.S if all fails.. search the forums! (PSPLink would be some good advice for you!
rAdi
Posts: 13
Joined: Tue Jul 08, 2008 5:17 pm

Post by rAdi »

As I've said in my post I'm using psplink. I'm starting usbhostfs_pc in a terminal. When starting psplink on the psp I get:
USBHostFS (c) TyRaNiD 2k6
Connected to device
Accepting async connection (0) from 127.0.0.1
So I think everythin is fine, so far. The last line is the output when starting pcterm in another terminal.

After changing the code in the Makefile (actually I've tried this before) I'm getting this error in my pcterm:
host0:/> ./hello.elf
Failed to Load/Start module 'host0:/hello.elf' Error: 0x800200D9
After looking it up I think it's a memory issue.

Am I using psplink the right way or is there another which I'm missing?
User avatar
Wally
Posts: 663
Joined: Mon Sep 26, 2005 11:25 am

Post by Wally »

After changing the code in the Makefile (actually I've tried this before) I'm getting this error in my pcterm:
host0:/> ./hello.elf
Failed to Load/Start module 'host0:/hello.elf' Error: 0x800200D9
ah
try adding this to your main.cpp file
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER|PSP_THREAD_ATTR_VFPU);

after the module info.

You will have to add -lpspvfpu to your LIBS..

Maybe im wrong.

Wally
rAdi
Posts: 13
Joined: Tue Jul 08, 2008 5:17 pm

Post by rAdi »

So...I've added the line to my source and everything compiled well...

I've started another homebrew (not compiled by me) using psplink and it worked. Than I've tried to run the pbp, elf and prx with psplink. Heres the output:
$ ./pcterm
Opening connection to localhost port 10000

host0:/> ./hello.elf
Failed to Load/Start module 'host0:/hello.elf' Error: 0x800200D9

host0:/> ./hello.prx
Load/Start host0:/hello.prx UID: 0x03B0E34B Name: Hello World

host0:/> ./EBOOT.PBP
Load/Start host0:/EBOOT.PBP UID: 0x029A4963 Name: Hello World

host0:/> exit
So the hello.prx an eboot.pbp output looks quite good, but actually the psp did nothing. It just remained showing the "psplink foo bar" string...

Starting the eboot.pbp from the ms0 drive gives the following output:
ms0:/psp/GAME4XX/hello/> ls
Listing directory ms0:/psp/GAME4XX/hello/
drwxrwxrwx 0 07-07-2008 16:38 .
drwxrwxrwx 0 07-07-2008 16:38 ..
-rwxrwxrwx 92422 08-07-2008 11:33 EBOOT.PBP

ms0:/psp/GAME4XX/hello/> ./EBOOT.PBP
Exception - Address load/inst fetch
Thread ID - 0x018BCF39
Th Name - user_main
psplink wasn't responding anymore and the psp did nothing...Perhaps I did something wrong with including -lpspvfpu to my LIBS. Where should I do that, just to be sure that I did nothing wrong there. But I think i would have got compile error, if I had a problem with my LIBS.

btw. thanks for the help with this stupid problem ;)
User avatar
Wally
Posts: 663
Joined: Mon Sep 26, 2005 11:25 am

Post by Wally »

psplink wasn't responding anymore and the psp did nothing...Perhaps I did something wrong with including -lpspvfpu to my LIBS. Where should I do that, just to be sure that I did nothing wrong there. But I think i would have got compile error, if I had a problem with my LIBS.

btw. thanks for the help with this stupid problem ;)
Quite Correct, a compile error would have happened.

this is past me now :P.. Wait for someone like J.F to come!

Wally
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

Instead of

Code: Select all

   sceKernelSleepThread&#40;&#41;;
   
   return 0;
&#125; 
Try

Code: Select all

   sceKernelDelayThread&#40;4*1000*1000&#41;;
   sceKernelExitGame&#40;&#41;;
   return 0;
&#125; 
rAdi
Posts: 13
Joined: Tue Jul 08, 2008 5:17 pm

Post by rAdi »

Same problem as above. When I get the point right the only difference would be that the application would sleep for the given time (4*1000*1000) an exit after that. Is the sceKernelSleepThread(); function deprecated or why shouldn't I use it?
israr
Posts: 5
Joined: Tue Jul 08, 2008 3:15 pm

Post by israr »

psplink can only load PRX files via USB.

call pspDebugScreenInit() at start of main() to initialize blank screen. Call pspDebugScreenPrintf to print text on this screen.

If you dont call pspDebugScreenInit the display will keep showing "psplink foo bar" text..
rAdi
Posts: 13
Joined: Tue Jul 08, 2008 5:17 pm

Post by rAdi »

Code: Select all

int main&#40;&#41; &#123;
   pspDebugScreenInit&#40;&#41;;
   SetupCallbacks&#40;&#41;;
   
   pspDebugScreenPrintf&#40;"Hello World\n"&#41;;
   
   sceKernelSleepThread&#40;&#41;;
   
   return 0;
&#125;
Ok, so I will only try the PRX files when using USB. As you can see in the code snippet (rest of the code is in my initial post) I'm calling pspDebugScreenInit() and pspDebugScreenPrintf().
Pirata Nervo
Posts: 409
Joined: Tue Oct 09, 2007 4:22 am

Post by Pirata Nervo »

of course you will get a black screen and it won't quit to XMB.
you are only sleeping the thread and you dont have any delay after printing hello world.
:)
Image
Upgrade your PSP
rAdi
Posts: 13
Joined: Tue Jul 08, 2008 5:17 pm

Post by rAdi »

Actually I've already changed this. I'm using the snippet J.F. posted above:

Code: Select all

   sceKernelDelayThread&#40;4*1000*1000&#41;;
   sceKernelExitGame&#40;&#41;;
   return 0;
&#125;
But does the PSP clear the screen when using sceKernelSleepThread(); or why should I get a blank screen when using this function. And furthemore why should the psp shut down after 10sec. Would be pretty annoying, if the watchdog timer restarts the psp when you send a thread to sleep.

The problem is I get the same behaviour for every application I compile, even the sdk's samples.
Pirata Nervo
Posts: 409
Joined: Tue Oct 09, 2007 4:22 am

Post by Pirata Nervo »

It "sleeps" the thread so nothing from the current thread is shown (at least this is what I think).

And it probably shut downs due to a crash.
Image
Upgrade your PSP
rAdi
Posts: 13
Joined: Tue Jul 08, 2008 5:17 pm

Post by rAdi »

Never thought about the possibility that the psp shuts down because of a crash... ;)

I don't think I'm getting anywhere if we follow this way. So let us forget all about the code I've posted and I'm asking a new question:

Does anybody know what can cause a problem where every compiled homebrew runs into a blackscreen and shuts down the PSP when executed?

I think the problem is environment related, but I get no errors when installing the toolchain.

As I said I'm using Ubuntu 8.04. I've checked out the newest toolchain from the svn. Installed everything mentioned in the readme-ubuntu.txt. The environment variables are set correctly (according to the readme) and the installation works like a charm...

No Errors when compiling the homebrew code (own an samples of the sdk).

Everything looks fine when starting the prx in pcterm over usbhostfs_pc but nothing happens on the PSP.
rAdi
Posts: 13
Joined: Tue Jul 08, 2008 5:17 pm

Post by rAdi »

By the way, are there some issues on using psptoolchain with 64Bit Linux?
Pirata Nervo
Posts: 409
Joined: Tue Oct 09, 2007 4:22 am

Post by Pirata Nervo »

I use Ubuntu 8.04 too and I have no problems :)
what version are you running? (psp)
Image
Upgrade your PSP
rAdi
Posts: 13
Joined: Tue Jul 08, 2008 5:17 pm

Post by rAdi »

4.01 M33-2

Perhaps somebody could post code/link to code or upload some short source which is known to be working. Then I could test if the problem is my environment.
Pirata Nervo
Posts: 409
Joined: Tue Oct 09, 2007 4:22 am

Post by Pirata Nervo »

http://www.psp-programming.com/tutorials/c/lesson02.htm
there's a working sample (hello world)
Image
Upgrade your PSP
rAdi
Posts: 13
Joined: Tue Jul 08, 2008 5:17 pm

Post by rAdi »

Right, actually that's the tutorial I've followed for writing the code...But there were some hints because of my problem, so I'll try it ones more with copy and paste...
User avatar
Torch
Posts: 825
Joined: Wed May 28, 2008 2:50 am

Post by Torch »

Remove the line PSP_HEAP_SIZE_KB(20480);
and try declaring int main with the argc and argv.
Aside from that your program should be fine.

And enable
#BUILD_PRX = 1
#PSP_FW_VERSION=371
in the makefile.

Don't use PSPLink at this stage. Just run it as an eboot from the XMB.

If all else fails, reinstall the toolkit from scratch.
Pirata Nervo
Posts: 409
Joined: Tue Oct 09, 2007 4:22 am

Post by Pirata Nervo »

@Torch using argv or argv does not matter.
Image
Upgrade your PSP
rAdi
Posts: 13
Joined: Tue Jul 08, 2008 5:17 pm

Post by rAdi »

So...I've copied the source from the tutorial posted above again...compiled with a new installed toolchain and tried to start the EBOOT.PBP directly from the XMB and PSPLink.

Getting the same problems. When starting the eboot from xmb it seems to start but I only have a Blackscreen and after 10 sec the psp shuts down. Using PSPLink and starting the eboot from ms0 seems to work but the output of the PSP doesn't change and the PSPLink string is on screen.

@Pirata Nervo: to point it out clear, you are running an Ubuntu 8.04 64Bit and not 32Bit?

Actually this problem is getting on my nerves. It seems I'm the only one having such problems and I'm wondering if this is a sign of a higher beeing that I should not code for PSP ;)
Pirata Nervo
Posts: 409
Joined: Tue Oct 09, 2007 4:22 am

Post by Pirata Nervo »

im running the i386 installation. (0x86 architecture)
I am gonna format this soon and re-install with 64 bit version probably.
Image
Upgrade your PSP
rAdi
Posts: 13
Joined: Tue Jul 08, 2008 5:17 pm

Post by rAdi »

So you know that the 64Bit installation should be no problem?
Pirata Nervo
Posts: 409
Joined: Tue Oct 09, 2007 4:22 am

Post by Pirata Nervo »

Well as far as I know it should work perfectly.
Try this tutorial:
http://www.psp-hacks.com/forums/viewtopic.php?id=109360
Image
Upgrade your PSP
rAdi
Posts: 13
Joined: Tue Jul 08, 2008 5:17 pm

Post by rAdi »

So I'll try this tutorial now. It says to use the toolchain from http://ps2dev.org/psp/Tools/Toolchain. It's quite old, isn't it? I think I'll check out a new one from svn or is there sth. wrong with it?

Another point is the PATH Variable. The tutorial is missing the PSPSDK variable the readme-ubuntu.txt of the svn checkout mentions.

I will just try it and report the result of my 10th (could be even more ;) installation.
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

rAdi wrote:So you know that the 64Bit installation should be no problem?
I run 64 bit Ubuntu 8.04. It's not a problem... except for certain linux side apps that are 32 bit, like the converter apps for libito. I made some posts in the past about how to fix those apps to work in 64 bit. I don't use psplink/psplinkusb, so I can't tell you if they work in 64 bit.
Pirata Nervo
Posts: 409
Joined: Tue Oct 09, 2007 4:22 am

Post by Pirata Nervo »

I don't set the PSPSDK variable and it works perfectly
Image
Upgrade your PSP
User avatar
Torch
Posts: 825
Joined: Wed May 28, 2008 2:50 am

Post by Torch »

I managed to install it on Ubuntu 8.04 64-Bit but could never compile anything. (I barely know even the basics of Linux so I couldn't even begin to troubleshoot the problem. I currently work on XP x64 without any problems, but it runs 32-bit apps almost seamlessly).
Post Reply