forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Using the iop compiler to build PSX binaries

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS2 Development
View previous topic :: View next topic  
Author Message
Maximus32



Joined: 27 Aug 2007
Posts: 41

PostPosted: Wed Nov 12, 2008 5:52 am    Post subject: Using the iop compiler to build PSX binaries Reply with quote

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:
../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?
Back to top
View user's profile Send private message Visit poster's website
Lukasz



Joined: 19 Jan 2004
Posts: 248
Location: Denmark

PostPosted: Wed Nov 12, 2008 6:06 pm    Post subject: Reply with quote

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
_________________
Lukasz.dk
Back to top
View user's profile Send private message Visit poster's website
Maximus32



Joined: 27 Aug 2007
Posts: 41

PostPosted: Wed Nov 12, 2008 8:13 pm    Post subject: Reply with quote

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

Code:
## 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:
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"
Back to top
View user's profile Send private message Visit poster's website
ooPo
Site Admin


Joined: 17 Jan 2004
Posts: 2032
Location: Canada

PostPosted: Wed Nov 12, 2008 11:52 pm    Post subject: Reply with quote

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:

Quote:
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/2005-03/msg00152.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.
Back to top
View user's profile Send private message Visit poster's website
Maximus32



Joined: 27 Aug 2007
Posts: 41

PostPosted: Thu Nov 13, 2008 2:00 am    Post subject: Reply with quote

So perhaps using Linux could solve the problem...

I tried the same thing, only this time on Linux. I get the following error:
Code:
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
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS2 Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group