Adventures with PSPSDK and psplink on MacOS X

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

Moderators: cheriff, TyRaNiD

Post Reply
MagerValp
Posts: 10
Joined: Fri Jul 20, 2007 12:12 am
Contact:

Adventures with PSPSDK and psplink on MacOS X

Post by MagerValp »

I worked on getting the latest svn versions of the toolchain to run on my mac yesterday, and got nearly all the way. I'm hoping that someone here can help me get the last few things running.

The first problem is that binutils 2.16.1 doesn't compile on MacOS X 10.5 (leopard). A bug in autoconf makes it erroneously detect .dSYM as the extension for executable files, when gcc is called with -g. The workaround is to set an explicit CFLAGS to the beginning of toolchain.sh, like so:

Code: Select all

#!/bin/bash
# toolchain.sh by Dan Peori ([email protected])

# automake fails on MacOS X 10.5 with -g flag
export CFLAGS="-O2"

 ## Enter the psptoolchain directory.
 cd "`dirname $0`" || { echo "ERROR: Could not enter the psptoolchain directory."; exit 1; }
...snip...
The second problem is that gprof has text files with a .m extension, that get translated into C. Apple's gmake thinks that .m files are Objective-C files, and tries to compile them, which fails miserably. There's a simple Makefile workaround in later versions of binutils, that can be backported. Add two new sections to patches/binutils-2.16.1-PSP.patch like so:

Code: Select all

diff -burN binutils-2.16.1/gprof/Makefile.am binutils-psp/gprof/Makefile.am
--- binutils-2.16.1/gprof/Makefile.am  2004-11-30 18:20:48.000000000 +0100
+++ binutils-psp/gprof/Makefile.am 2007-08-13 03:51:51.000000000 +0200
@@ -38,6 +38,9 @@
 
 diststuff: $(BUILT_SOURCES) info $(man_MANS)
 
+# This empty rule is a hack against gmake patched by Apple.
+%.o:%.m
+
 .m.c:
 	awk -f $(srcdir)/gen-c-prog.awk > ./$*.c \
 	    FUNCTION=`(echo $*|sed -e 's,.*/,,g' -e 's/_bl//')`_blurb \
diff -burN binutils-2.16.1/gprof/Makefile.in binutils-psp/gprof/Makefile.in
--- binutils-2.16.1/gprof/Makefile.in	2004-11-30 18:20:48.000000000 +0100
+++ binutils-psp/gprof/Makefile.in	2008-05-26 12:24:11.000000000 +0200
@@ -774,6 +774,9 @@
 
 diststuff: $(BUILT_SOURCES) info $(man_MANS)
 
+# This empty rule is a hack against gmake patched by Apple.
+%.o:%.m
+
 .m.c:
 	awk -f $(srcdir)/gen-c-prog.awk > ./$*.c \
 	    FUNCTION=`(echo $*|sed -e 's,.*/,,g' -e 's/_bl//')`_blurb \
After that it builds all the way up to psplinkusb's remotejoy. The psplink Makefile tries to decide if it's running under linux, and if so it builds the SDL version, otherwise it goes to the default Windows version. The check just looks for /usr/include/SDL/SDL.h, which fails. At this point I just went ahead and compiled it manually, but testing for the existence of the sdl-config command should work on all platforms with SDL installed:

Code: Select all

if which sdl-config &> /dev/null; then { $(MAKE) -C tools/remotejoy/pcsdl all; } else { $(MAKE) -C tools/remotejoy/pc all; } fi
So far so good - after this toolchain.sh successfully installs for me. Second half with psplink woes will have to wait until I've made lunch for my son :)
MagerValp
Posts: 10
Joined: Fri Jul 20, 2007 12:12 am
Contact:

Post by MagerValp »

OK, so, if anyone wants to try the patches on osx, or maybe confirm that they don't break on Linux or Windows, that would be great. On to psplink.

On MacOS X 10.4 I used the 20070626 snapshot of the toolchain, and psplinkusb checked out from svn around the same time. It worked great on 3.40OE and 3.52M33 on my fat PSP.

I compiled psplinkusb and installed the files from release_oe on my fat now running 3.90M33-3. When I start psplink I get nothing but a black screen. When I start usbhostfs_pc -vv on the Mac, the PSP shuts down. People on #pspdev says that psplinkusb svn checked out yesterday works on their machines running 3.90, so I'm not sure what to make of it.

I then tried http://www.luaplayer.org/pspsdk-image.rar with VirtualBox. Unfortunately VirtualBox crashes hard when I try to access the PSP - I couldn't even get the files copied over to the memory stick. Too bad, as a shrinkwrapped development VM seemed like a really good idea.

As a last resort I installed minpspw under Parallels, which got me a little further. psplink starts up with the proper message, usbhostfs_pc -vv connects to the device, and pspsh gives me a prompt. ls works, and I can list files on the memory stick, but cd and trying to run things gives me the error: invalid magic: 4F42452F.

I'm not quite sure what to try next. There's iR Shell, but it has issues with 3.90, and I'm wary about replacing the XMB. If someone would be willing to zip up the latest psplinkusb from svn, I'd love to try that.

Is anyone here running psplinkusb on osx, and if so, how? :)
Insert_witty_name
Posts: 376
Joined: Wed May 10, 2006 11:31 pm

Post by Insert_witty_name »

Works fine for me on Tiger.
ooPo
Site Admin
Posts: 2023
Joined: Sat Jan 17, 2004 9:56 am
Location: Canada
Contact:

Post by ooPo »

Seems to build and work fine under Ubuntu, so I've committed the changes to psptoolchain and psplinkusb.
MagerValp
Posts: 10
Joined: Fri Jul 20, 2007 12:12 am
Contact:

Post by MagerValp »

Great, thanks.
ooPo
Site Admin
Posts: 2023
Joined: Sat Jan 17, 2004 9:56 am
Location: Canada
Contact:

Post by ooPo »

Thanks for doing the hard work, I had been meaning to get around to it for a long time now. :)
Post Reply