GoLang on the Sony PlayStation Portable (PSP)

779 views
Skip to first unread message

Kristopher Cost

unread,
Feb 17, 2015, 12:48:41 AM2/17/15
to golan...@googlegroups.com

Out of curiousity and the desire to meld to of my favorite past-times, what would be involved with getting GoLang code compiled for the Sony PlayStation Portable (PSP)?


The device is dual core:


PSP CPU Chip:

Sony CXD2962GG CPU

Based on MIPS R4000 32-bit Core

MIPS32R2 'Allegrex' core (little endian)


Media Engine Chip:

Sony CXD1876 CPU

Based on MIPS R4000 64-bit Core

MIPS32R2 core (little endian)


The base model has:

Main Memory 32MB (DDR SDRAM) (64MB on later models)

Flash Memory 32MB

Embedded DRAM 4MB


There exists an open-source C toolchain that supports all the custom instructions:


https://github.com/pspdev/pspsdk


I read up on getting MIPS cross compilation running:

https://github.com/golang/go/wiki/GccgoCrossCompilation


Would it be simular to that?


Any help with this odd mind exercise would be appreciated!

andrewc...@gmail.com

unread,
Feb 17, 2015, 2:59:42 AM2/17/15
to golan...@googlegroups.com
The link you showed is the sdk, not the toolchain. They link the toolchain here. https://github.com/pspdev/psptoolchain.

They use a patched gcc version 4.6.4 , gccgo is only included in version  4.7.1 and newer.

This means you will first need need to modify https://github.com/pspdev/psptoolchain/blob/master/scripts/002-gcc-stage1.sh to use the newer gcc.

then you will need to port this patch https://github.com/pspdev/psptoolchain/blob/master/patches/gcc-4.6.4-PSP.patch to the newer gcc, which may or may not be hard (and may have been done by someone else). You will also need to update all scripts if they don't work with the new gcc version.

After this is done you will need to modify https://github.com/pspdev/psptoolchain/blob/master/scripts/005-gcc-stage2.sh#L37 to have --enable-langues="c,c++,go".

Maybe then you will have a working toolchain, but will need to work out how to link go code with the platform C sdk and make go bindings.

There are probably other issues too.

andrewc...@gmail.com

unread,
Feb 17, 2015, 3:04:09 AM2/17/15
to golan...@googlegroups.com
It also seems like the sdk does not provide a posix like environment, which probably means the go runtime won't compile, which would need to be ported (things like threading support etc).


On Tuesday, February 17, 2015 at 6:48:41 PM UTC+13, Kristopher Cost wrote:

Aram Hăvărneanu

unread,
Feb 17, 2015, 8:29:36 AM2/17/15
to Andrew Chambers, golang-nuts
The go runtime doesn't really expect a POSIX environment at build time
(how could it, it's written in Go, after all). Every new operating
system, be it POSIX or not needs porting work (though POSIX platforms
might be easier).

But the PSP uses a MIPS CPU, the runtime is the least of your worries,
you need to wrote a MIPS compiler for Go.

--
Aram Hăvărneanu

Aram Hăvărneanu

unread,
Feb 17, 2015, 8:30:19 AM2/17/15
to Andrew Chambers, golang-nuts
Ah, sorry, it looks like you want to use gccgo, not gc, sorry for the noise.

--
Aram Hăvărneanu

andrewc...@gmail.com

unread,
Feb 17, 2015, 3:09:25 PM2/17/15
to golan...@googlegroups.com, andrewc...@gmail.com
A gc mips port would be sweet though :).

Tbh, I dont even know how to setup the go tool with a cross compiling gccgo.

Kristopher Cost

unread,
Feb 27, 2015, 12:47:09 PM2/27/15
to golan...@googlegroups.com, andrewc...@gmail.com
The patch porting seems possible for someone like me to accomplish, but the POSIX environment issue seems much more troubling. Do other MIPS toolchains provide the required POSIX environment?
Reply all
Reply to author
Forward
0 new messages