PSPLINK

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

Moderators: cheriff, TyRaNiD

Post Reply
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

Yup you are probably right, will fix on the next round of commits.
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

Okay finally another binary release, contains various fixups as usual, also has the USB HOSTFS, USB shell, USB GDB support. Also contributed by Rasmus B is a simple console shell to access some features of the shell from the PSPs pad.

Update: Released 0.9d which has fixed for the PC side of USB so it seems to work correctly on Windows. Again slight caveat, seems usbhostfs_pc doesn't always respond to ctrl+c, seems to clear it you have to hit ctrl+c, close and reopen pcterm and then it shuts down. Don't ask me why ;)

http://ps2dev.org/psp/Tools/PSPLINK_0.9d

Report any bugs if anyone bothers to give it a go ;)
Phantom8
Posts: 30
Joined: Fri Jun 17, 2005 10:17 am

Post by Phantom8 »

Wow, I've tried to use the 0.9c and I can get the wifi shell working perfectly. This is an incredible piece of debugging software and I found it easy to use. BTW, the download link above for 0.9d doesn't work. I had to download the source code from SVN depositry and generated the binary. I can get the usbshell working on Linux, but I can't compile the usbhostfs_pc for Windows under cygwin. I got many errors in missing include files, such as "pshpack1.h", "poppack.h", etc. I think the problem is with my cygwin installation. Is it possible to generate the Windows version of usbhostfs_pc from a native Linux box, instead of cygwin? Or is it possible for you to host the Windows version usbhostfs_pc binary for download? Again, thanks so much for making such a wonderful debugging tool.
Oobles
Site Admin
Posts: 347
Joined: Sat Jan 17, 2004 9:49 am
Location: Melbourne, Australia
Contact:

Post by Oobles »

I downloaded v0.9d from the site today. Installed and got the usbhostfs_pc compiled on cygwin first time. For anyone trying to set this up, follow the instructions at the end of the manual.

I also had a go at using the eclipse IDE for PSP debugging. It was really quite simple. Create a new Debug project, select the GDB Server debug method and enter psp-gdb as the gdb executable. Start up the program using psplink debug command then run the debug in eclipse. I had Eclipse show me a breakpoint at the start of the program first time! I attempted some single stepping and running the program, but didn't get very far. I'm not sure what went wrong, but was impressed it got that far on the first run.

I did this on the train on the way home from work. Notebook on the lap, and PSP in my jacket pocket. Fun way to debug. :)

Nice work TyRaNiD!

David aka Oobles.
http://www.livemedia.com.au/Blog
Phantom8
Posts: 30
Joined: Fri Jun 17, 2005 10:17 am

Post by Phantom8 »

Oobles, do you mind to post the usbhostfs_pc binary for cygwin? TIA.
weltall
Posts: 310
Joined: Fri Feb 20, 2004 1:56 am
Contact:

Post by weltall »

i had the same problem but i used directly psp-gdb from cygwin.
I'm using it trougth usb so i do debug elf command and then i load gdb and connect to port 10001. it connect and shows the first breakpoint but if i press c it just hangs. the shell is still working but gdb and the application i'm trying to debug just stop working at all.
anyway great tool and thanks for it :D
ginka
Posts: 15
Joined: Fri Feb 17, 2006 2:27 am

Post by ginka »

Yup - I tried it with eclipse last night as well ( under linux and usbhostfs ). The only additonal change I had to make was change the debug port to 10001 ( took me a few minutes to figure out why it wasn't working :). It seems to be able to hit several breakpoints before it stops responding. I'm able to single step and set new breakpoints which works fine for a few minutes. Anyways, great addition to the tool set!
weltall
Posts: 310
Joined: Fri Feb 20, 2004 1:56 am
Contact:

Post by weltall »

i tried the d version and now it seems to work
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

Phantom8, you need to install the w32api package in cygwin, that should fix the include errors.

As for the gdb problems I don't know what would be causing that. What have you people been testing under gdb ?

At least with the samples I can run it seemingly for as long as I feel like, however I guess depending what you do the gdb thread might stall as it might need a priority boost. But that should only be an issue if you really do not yield the CPU at all.
Oobles
Site Admin
Posts: 347
Joined: Sat Jan 17, 2004 9:49 am
Location: Melbourne, Australia
Contact:

Post by Oobles »

I've been playing around with usbgdb today. Trying it out with eclipse and stand alone. Discovered a few things. First thing I did was add in some lines of code in usbhostfs_pc to echo the commands sent to/from gdb. Turns out ethereal doesn't capture from localhost. I was thinking of adding these with a command line option.

In do_async:

Code: Select all

data[ readlen - sizeof( struct AsyncCommand ) ] = 0;
fprintf( stderr, "->(%i) %s\n", readlen-sizeof(struct AsyncCommand), data );
and in async_thread:

Code: Select all

gdbdata[readbytes]=0;
fprintf&#40; stderr, "<-&#40;%i&#41; %s\n", readbytes, gdbdata&#41;;
While running eclipse I found a few stub commands that weren't implemented that it expects. I followed the following document while implemetning...
http://sources.redhat.com/gdb/current/o ... db_33.html

In handle_query to get the current thread id:

Code: Select all

case 'C'&#58;
	thread_id = sceKernelGetThreadId&#40;&#41;;
	output&#91;0&#93; = 'Q';
	output&#91;1&#93; = 'C';
	mem2hex&#40; &#40;unsigned char *&#41; &thread_id, &output&#91;2&#93;, 4 &#41;;
	break;
In gdbHandleException to set the thread id for other commands.

Code: Select all

case 'H'&#58;
	ptr = &input&#91;0&#93;;
	if &#40; *ptr = 'c' &#41; &#123;
		cThreadTarget = atoi&#40; ptr++ &#41;;		
		strcpy&#40;output,"OK"&#41;;
	&#125; else if &#40; *ptr = 'g' &#41; &#123;
		gThreadTarget = atoi&#40; ptr++ &#41;;		
		strcpy&#40;output,"OK"&#41;;
	&#125;
	break;
Should I commit these as I go? I didn't want to commit unless you wanted me to. I write crappy C code. :) I'm still finishing a command to return if a thread is still running.

David. aka Oobles.
http://www.livemedia.com.au/Blog
ginka
Posts: 15
Joined: Fri Feb 17, 2006 2:27 am

Post by ginka »

Well I updated pspsdk's use of gdb to 6.4 and now I don't seem to have any issues with gdb debugging under eclipse. After setting/disabling breakpoints everywhere, stepping over/into code, and modifying variable values for over 10mins, I didn't have any crashes - so I'll stick with this version for the time being.
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

Oobles, does eclipse actually need those commands to work, or is it just that the gdb stub is rejecting them? There are a number of commands which are not implemented atm, threading stuff being one of them cause there is no real thread support yet. I might change that tonight. However in the general case if it isn't supported gdb should just ignore it.

Oh and a small point, calling sceKernelGetThreadId() isn't a good idea in that case as that will get the thread id of the gdb thread and not the thread which has errors. Will sort that out as well in the threading stuff. Good work on it though :)

And ginka, what version of gdb were you using before? Didn't think I had done anything but gdb 6.4, or were you using the insight debugger?
zilt
Posts: 45
Joined: Tue Feb 21, 2006 11:59 pm
Location: Ontario, Canada
Contact:

Post by zilt »

Is there a gdb 6.4 for pspsdk? toolchain.sh seems to only install 6.3.
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

Ah my bad, it does indeed install 6.3, although the one on my system actually shows 6.4. Perhaps it is insight's gdb. In fact it is insight's gdb. Will look at updating the one in the toolchain to vanilla 6.4.
ginka
Posts: 15
Joined: Fri Feb 17, 2006 2:27 am

Post by ginka »

TyRaNiD wrote:And ginka, what version of gdb were you using before? Didn't think I had done anything but gdb 6.4, or were you using the insight debugger?
Took the gdb 6.3 patch file and fixed up all the rejects against 6.4. I haven't used insight before - I did try emerging it with gentoo once but the make failed, so just stuck with eclipse and psp-gdb/tui. 6.4 does seem more stable though then 6.3.
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

Okay I have added 6.4 to the toolchain as well as being able to build insight separately. The patch itself was the same as insights, not that that is a massive surprise considering they are exactly the same core revision (same cvs tag etc.)
optixx00
Posts: 11
Joined: Mon Jul 18, 2005 1:40 am

Post by optixx00 »

I had some problems with usbhostfs on linux 2.6.15-ck1, sometimes it blocked while io operations. After changing USB_TIMEOUT in usbhostfs_pc/main.c to something between 10 and 100 it works properly. Maybe other linux user experience same probs, so this could be a hint.
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

How strange, I might make USB_TIMEOUT something like 1000 on all systems then, if the bulk in fails with a timeout it doesn't actually seem to cause much of an issue.
reakt
Posts: 22
Joined: Fri May 06, 2005 8:35 pm
Location: Basingstoke, UK

Post by reakt »

Great tool, thankyou!
I also need some help. I'm trying to load an elf which uses the network modules. I've setup the psplink.ini file so that it loads the inet modules:

modload=flash0:/kd/ifhandle.prx
modload=flash0:/kd/pspnet.prx
modload=flash0:/kd/pspnet_inet.prx
modload=flash0:/kd/pspnet_apctl.prx
modload=flash0:/kd/pspnet_resolver.prx

However, when I load my elf, it fails to run properly as it fails on the call to pspSdkLoadInetModules()

I get an error code back but it looks incorrect :- -2147352263

Any idea what I'm doing wrong?

Thanks!
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

Well the you are getting an EXCLUSIVE_LOAD error, you shouldn't be calling pspSdkLoadInetModules at all if they are already loaded for I am sure the obvious reasons :)

Also ensure that your application is a pure user mode application and not a kernel mode application otherwise it will fail to link in the correct libraries. See the net prx samples in pspsdk.

You will still need to call pspSdkInetInit() though.
tomson2000
Posts: 4
Joined: Sun Jan 22, 2006 1:14 pm

Post by tomson2000 »

>>> TyRaNiD

Thank you for your contribution!
Phantom8
Posts: 30
Joined: Fri Jun 17, 2005 10:17 am

Post by Phantom8 »

I'm having some problem with the USB Shell. I tried to use both telnet & pcterm to port 10000, but the USB Shell is only half working. I can only see the output and cannot give commands to the shell. It seems whatever I typed, it only echoed back but didn't do anything. If I issue command via a wifi shell, I can see all the output display on both the USB shell and wifi shell. Any idea on the problem. TIA!
Sharkus
Posts: 27
Joined: Sun Jun 19, 2005 6:49 am

Post by Sharkus »

I get the following error any time I try to run one of the examples compiled as a .elf:

Code: Select all

host0&#58;/gu/cube/> ./cube.elf
Failed to Load/Start module 'host0&#58;/gu/cube/cube.elf' Error&#58; 0x800200D9
Things works fine if I compile and run the .prx version. The problem I have with the .prx is that GDB doesn't seem to be able to find any symbols... (The sprite example behaves exactly the same way as well.)

Also, besided modifying the common sdk makefile is there a way to skip the psp-strip step?
Oobles
Site Admin
Posts: 347
Joined: Sat Jan 17, 2004 9:49 am
Location: Melbourne, Australia
Contact:

Post by Oobles »

If you want to debug a PRX the best thing to do is run debug xxxx.prx on the psp, then run gdb using xxxx.elf. I assume this is what you are trying to do?

David. aka Oobles.
http://www.livemedia.com.au/Blog
Sharkus
Posts: 27
Joined: Sun Jun 19, 2005 6:49 am

Post by Sharkus »

Thanks for the tip! It seems to work okay. I'm still wondering why the .elf files won't run directly... Did something change in the sdk/toolchain recently that makes them incompatible with psplink?
weltall
Posts: 310
Joined: Fri Feb 20, 2004 1:56 am
Contact:

Post by weltall »

Maybe i've found a little problem.
i'm using usb shell and i load an application then i try ss host0:/sc.bmp but it crashes the shell that doens't respond anymore.
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

You will have to be abit more specific regarding the problem, are you running it on windows or *nix, what are you actualyl trying to take a screenshot of etc?

One thing the shell does not do with the screenshot is actually validate the frame pointer (I really should do ;P) I have tested it on a number of different things, sdk gu samples, kill everything that moves 0.9 both running off host as well as a couple of games and they all seem to work without crashing.
weltall
Posts: 310
Joined: Fri Feb 20, 2004 1:56 am
Contact:

Post by weltall »

well i'm using windows and i'm loading the usbhostfs from the cygwin shell.
i tried two programs
1-a mine game (i'm using the lua player graphic library compiled as a lib to display graphic)
2-nesterj 1.10

and it just crashes all the times i try to save on host but if i save on ms it goes fine so i don't think it's a framepointer problem

edit: I forgot that it creates a 0 byte file
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

Well I tried nesterj on both my linux box and a windows xp machine with cygwin and they both seemed to work oki, the emu is abit funny, sometimes it wont reset correctly, this is most likely down to thread priority issues though as I would expect once the emu is running it is not waiting on vblank (unless you told it to), it works if you suspend the thread first.

Strange though that it works to ms and not to host, but again it could be some strange priority issue but you would think that would affect all systems not just cygwin.

In short no real idea what the problem is :( Can you do screenshots to ms and then while it is running use the cp command to copy it to host or does this not work either ?
weltall
Posts: 310
Joined: Fri Feb 20, 2004 1:56 am
Contact:

Post by weltall »

for me it doesn't work maybe I've something wrong on my pc...?

this is what happens with any file

host:/> cp ./sexypsf.elf ms0:/sho.elf
cp host:/sexypsf.elf -> ms0:/sho.elf ->this works fine
host:/> cp ms0:/sho.elf host:/abc
cp ms0:/sho.elf -> host:/abc
(here it stops responding)

and this is what i can see from usbhostfs_pc on cygwin:

Administrator@pc1 ~/usbhostfs_pc
$ ./usbhostfs_pc.exe
USBHostFS (c) TyRaNiD 2k6
found 5 busses
Connected to device
Accepting shell connection from 127.0.0.1
Error reading write data cmd->extralen 2048, ret -116 -> this happens when crash occours
Error in write command
found 5 busses
found 5 busses
found 5 busses
found 5 busses
found 5 busses

with 0.9c i couldn't even load files from host but with d loading from host worked.
Post Reply