Using the iop compiler to build PSX binaries

Discuss the development of software, tools, libraries and anything else that helps make ps2dev happen.

Moderators: cheriff, Herben

Post Reply
Maximus32
Posts: 40
Joined: Mon Aug 27, 2007 12:28 am
Contact:

Using the iop compiler to build PSX binaries

Post by Maximus32 »

I'm trying to port my existing application (see bricks-os.org) to the PSX, yes, the good old Playstation One. Unfortunately the latest compiler I can find on the internet for the PSX is an old gcc 2.7.2.3, just too old for what I need.

So I was trying to use the iop compilers to do the job, that works, only it produces elf files, and the PSX needs to use ecoff format. I already tried recompiling the iop compilers, and building a new standard mips-r3000 compiler with ecoff support, but I can't get the cross-compilers to compile.

Things I tried:

Code: Select all

../configure --prefix="$PS2DEV/psx" --target="mips-ecoff" --enable-langues="c,c++" --with-newlib --without-headers
../configure --prefix="$PS2DEV/psx" --target="mipsel-ecoff" --enable-langues="c,c++" --with-newlib --without-headers
../configure --prefix="$PS2DEV/psx" --target="mipsel-sf-ecoff" --enable-langues="c,c++" --with-newlib --without-headers

Does anyone know how to get/build an up-to-date compiler for the PSX? Or a conversion tool from elf-to-ecoff?
User avatar
Lukasz
Posts: 248
Joined: Mon Jan 19, 2004 8:37 pm
Location: Denmark
Contact:

Post by Lukasz »

Gcc already supports MIPS R3000 (PSOne processoror), so there is no need to use the IOP version. If I'm not mistaken, the only part that is different with IOP gcc is the ability to output IRX files directly.You can just download the lastest version of gcc and compile it to support MIPS r3000.

As for the targets, there is atleast mips-idt-ecoff and maybe even mips-mips-ecoff. The following link suggests (although a bit old) to look in the GCC source for the list of supported targets: http://gcc.gnu.org/ml/gcc-help/2000-03/msg00060.html
Maximus32
Posts: 40
Joined: Mon Aug 27, 2007 12:28 am
Contact:

Post by Maximus32 »

I just tried the following script (modified from the ps2toolchain):

Code: Select all

## GCC 4.3.2, needs GMP?
#tar -jxf gcc-4.3.2.tar.bz2.tar
#cd gcc-4.3.2

## GCC 3.2.2
#tar -jxf gcc-3.2.2.tar.bz2.tar
cd gcc-3.2.2

## Create and enter the build directory.
mkdir "build-psx-stage1" && cd "build-psx-stage1" || { exit 1; }

## Configure the build.
../configure --prefix="$PS2DEV/psx" --target="mips-idt-ecoff" --enable-languas="c,c++" --with-newlib --without-headers || { exit 1; }

## Compile and install.
make clean && make -j 2 && make install && make clean || { exit 1; }

## Exit the build directory.
cd .. || { exit 1; }
I'm using this environment. First I tried the latest gcc (4.3.2) but it needs something I don't have (gmp?). So I tried to compile 3.2.2, that gives me the following error:

Code: Select all

gcc -DHAVE_CONFIG_H -I. -I../../fastjar -I. -I. -I../../fastjar -I../../fastjar/../zlib -I../../fastjar/../include   -W -Wall -pedantic -Wstrict-prototypes -Wmissing-prototypes -Wwrite-strings -g -O2 -c ../../fastjar/jartool.c
gcc -DHAVE_CONFIG_H -I. -I../../fastjar -I. -I. -I../../fastjar -I../../fastjar/../zlib -I../../fastjar/../include   -W -Wall -pedantic -Wstrict-prototypes -Wmissing-prototypes -Wwrite-strings -g -O2 -c ../../fastjar/dostime.c
../../fastjar/jartool.c: In function `main':
../../fastjar/jartool.c:437: error: `S_IRGRP' undeclared (first use in this function)
../../fastjar/jartool.c:437: error: (Each undeclared identifier is reported only once
../../fastjar/jartool.c:437: error: for each function it appears in.)
../../fastjar/jartool.c:437: error: `S_IROTH' undeclared (first use in this function)
../../fastjar/jartool.c: In function `extract_jar':
../../fastjar/jartool.c:1427: error: too many arguments to function `mkdir'
../../fastjar/jartool.c: In function `help':
../../fastjar/jartool.c:1893: warning: string length `594' is greater than the length `509' ISO C89 compilers are required to support
make[1]: *** [jartool.o] Error 1
make[1]: *** Waiting for unfinished jobs....
What am I doing wrong?

EDIT:I just tried the latest 3x version of gcc (3.4.6). That one fails during the configure: "*** Configuration mips-idt-ecoff not supported"
ooPo
Site Admin
Posts: 2023
Joined: Sat Jan 17, 2004 9:56 am
Location: Canada
Contact:

Post by ooPo »

Here's some potential problems:

1) It appears that fastjar hasn't been updated since 1999.

http://fastjar.sourceforge.net/

2) Using S_IRGRP apparently isn't a good idea under windows:
Windows doesn't define all of the permissions macros (e.g., S_IRGRP)
because its filesystems don't have that concept.
http://sourceware.org/ml/gdb-patches/20 ... 00152.html

3) The string length warning may indicate that the author of fastjar doesn't feel that following standards is important. This means the code may be very dependent on the exact system he or she was doing development on. That system probably existed back in 1999 so you may or may not want to replicate it. :)

What I'm trying to say is that perhaps the compiler isn't to blame here for your problems compiling that specific program.
Maximus32
Posts: 40
Joined: Mon Aug 27, 2007 12:28 am
Contact:

Post by Maximus32 »

So perhaps using Linux could solve the problem...

I tried the same thing, only this time on Linux. I get the following error:

Code: Select all

config.status: executing depdir commands
mkdir -p -- .deps
make[1]: Leaving directory `/home/maximus32/dev/psxtoolchain/gcc-4.3.2/build-psx-stage1'
make: *** [all] Error 2
I can't even get past the configure. Could this have something to do with file/directory rights? There's not really a message about what's going wrong. I also tried gcc 3.2.2. It gives me the same message.

I'm using Ubuntu 8.04
Post Reply