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 

Best ps2linux based development environment ?

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






PostPosted: Sat May 01, 2004 5:59 pm    Post subject: Best ps2linux based development environment ? Reply with quote

I am gearing up to do some major porting. My plan is to do
some initial porting work in ps2 linux, and then when I am
far enough along, work on making the app native.

The question is, what is the best environment for ps2linux ?
There is the stock ps2linux distribution, there is the BlackRhino
updated kernel and distribution, and then there is the newer
Sony BB 2.4.x kernel. Actually, I don't want to use the stock
environment, but would like to know what else is better
recommended.

My needs are a decent gcc and binutils that supports all 5900
instructions, which mrbrown magnificently provides. What is
the best underlying environment and kernel for these tools ?

Gorim
Back to top
mrbrown



Joined: 17 Jan 2004
Posts: 1536

PostPosted: Mon May 03, 2004 12:39 am    Post subject: Reply with quote

Use xRhino 2.2.21 and the BlackRhino distribution. As far as GCC and binutils, you have a choice: the GCC/binutils shipped with the kit are "stable" but crappy (W.R.T. code generation). You could use binutils 2.13.2.1 and GCC 3.0.4 instead, but few people use these so if something goes wrong you won't get much support.
Back to top
View user's profile Send private message
Guest






PostPosted: Mon May 03, 2004 12:57 am    Post subject: Reply with quote

mrbrown wrote:
You could use binutils 2.13.2.1 and GCC 3.0.4 instead, but few people use these so if something goes wrong you won't get much support.


Thanks for the great info. Actually, I had poor luck with the stock
PS2Linux version of the assembler - it didn't like EE 128bit MMI
instructions, but when I installed the 2.13.2.1 last night, the assembler
had no problems. Unfortunately, the resulting executable wouldn't
work, but I expected that from previous forum posts. I will try
getting xrhino/blackrhino up and running with the newer binutils and
gcc and see how the whole picture works out.

Thanks again!

Gorim
Back to top
ldesnogu



Joined: 17 Apr 2004
Posts: 95

PostPosted: Mon May 03, 2004 1:10 am    Post subject: Reply with quote

gorim wrote:
but when I installed the 2.13.2.1 last night, the assembler
had no problems. Unfortunately, the resulting executable wouldn't
work, but I expected that from previous forum posts.
Could you provide me with some info about that?
I am currently looking into differences between gas 2.9ee and gas 2.14.

If you want to use gas 2.14 (dit not look into 2.13.2.1) you have to add -mabi=32. Could you try that?
Back to top
View user's profile Send private message
Guest






PostPosted: Mon May 03, 2004 1:47 am    Post subject: Reply with quote

ldesnogu wrote:
gorim wrote:
but when I installed the 2.13.2.1 last night, the assembler
had no problems. Unfortunately, the resulting executable wouldn't
work, but I expected that from previous forum posts.
Could you provide me with some info about that?
I am currently looking into differences between gas 2.9ee and gas 2.14.

If you want to use gas 2.14 (dit not look into 2.13.2.1) you have to add -mabi=32. Could you try that?



Sure,

It was a simple experiment. I created a simple C program that
did a simple "C= A + B" on register variables. I used GCC -S
to create assembler output. The actual output wasn't relevant,
I just wanted something where I could quick edit it and insert
a MMI instruction to see if the assembler would grok it. Sorry I
can't cut and paste it right now, but essentually I inserted

PADDSW $2,$3,$4 or something like that.

The gas that came with the linux kit didn't like it, but then I
installed the newer and patched (specifically for EE) binutils
provided by mrbrown and the assembler took it just fine. The
resulting executable wasn't runnable, but as mentioned, it was
an expected result. I first wanted to know which assemblers
would understand MMI, and then I would install my development
environment/toolchain around that.

Hope that helps,

Gorim
Back to top
ldesnogu



Joined: 17 Apr 2004
Posts: 95

PostPosted: Mon May 03, 2004 1:53 am    Post subject: Reply with quote

gorim wrote:
The
resulting executable wasn't runnable, but as mentioned, it was
an expected result.
Did you try to use -mabi=32 as I suggested?
Back to top
View user's profile Send private message
mrbrown



Joined: 17 Jan 2004
Posts: 1536

PostPosted: Mon May 03, 2004 3:50 am    Post subject: Reply with quote

He needs to use -mips3 and/or -m5900. The equivalent to -m5900 is -mcpu=5900 or -mcpu=r5900, IIRC.
Back to top
View user's profile Send private message
ldesnogu



Joined: 17 Apr 2004
Posts: 95

PostPosted: Mon May 03, 2004 3:53 am    Post subject: Reply with quote

mrbrown wrote:
He needs to use -mips3 and/or -m5900. The equivalent to -m5900 is -mcpu=5900 or -mcpu=r5900, IIRC.
This is just part of the problem :-)
-mabi is required too it seems.
Back to top
View user's profile Send private message
mrbrown



Joined: 17 Jan 2004
Posts: 1536

PostPosted: Mon May 03, 2004 3:58 am    Post subject: Reply with quote

Yes, but -mabi won't fix the problem with missing instructions, only -mips3 and -mcpu will. -mabi only deals with calling conventions.
Back to top
View user's profile Send private message
ldesnogu



Joined: 17 Apr 2004
Posts: 95

PostPosted: Mon May 03, 2004 4:49 am    Post subject: Reply with quote

mrbrown wrote:
Yes, but -mabi won't fix the problem with missing instructions, only -mips3 and -mcpu will.

IIRC you already documented that in your PS2 binutlis release.

Quote:
-mabi only deals with calling conventions.

-mabi does not only change the calling convention, it seems to also change gp_rel stuff, wich makes me guess it *may* have a positive impact on the dynamic linking problems you found: on a stupid test I did, using the old ld (called by old gcc collect2), the generated exec looks very similar.
They are not identical because of the way the more recent binutils generate code for la encoding to deal with offsets bigger than 16 bits for PIC.

My ps2linux kit is in a box, so I can't make any further tests, so I thought gorim was an ideal guinea pig :)

Note I may be completely off on that topic...
Back to top
View user's profile Send private message
Saotome



Joined: 03 Apr 2004
Posts: 182

PostPosted: Mon May 03, 2004 4:57 am    Post subject: Reply with quote

i would also like to use some multimedia instructions since i have some programs for PC which use MMX which i want to port to PS2, but i have problems to find any info or examples about MMI on the EE (am already searching for about two weeks).
does anyone have some links to maybe just a list of instructions or some macros or examples how to implement MMI?

thanks ;)
Back to top
View user's profile Send private message
bigboss



Joined: 22 Jan 2004
Posts: 27
Location: Sevilla, Spain

PostPosted: Mon May 03, 2004 5:50 am    Post subject: Reply with quote

Look at:

http://www1.mplayerhq.hu/cgi-bin/cvsweb.cgi/ffmpeg/libavcodec/ps2/?cvsroot=FFMpeg
_________________
Bigboss/PS2Reality

Oopo is apparently Gilipollas sin animo de ofender of course de buen rollo (aka humor de ese)
Back to top
View user's profile Send private message Visit poster's website
blackdroid



Joined: 17 Jan 2004
Posts: 564
Location: Sweden

PostPosted: Mon May 03, 2004 6:21 am    Post subject: Reply with quote

You could always check opcodes/mips-opc.c in binutils.
basically all p* with 0x7000 are mmi instructions that can be used on R5900 ( no not all, I spotted one or two that wont work ), most of them are pretty selfexplanatory.
_________________
Kung VU
Back to top
View user's profile Send private message Visit poster's website
Saotome



Joined: 03 Apr 2004
Posts: 182

PostPosted: Mon May 03, 2004 6:52 am    Post subject: Reply with quote

thank you very much, both of you :)
that should be a great help
Back to top
View user's profile Send private message
mrbrown



Joined: 17 Jan 2004
Posts: 1536

PostPosted: Mon May 03, 2004 8:39 am    Post subject: Reply with quote

Of course, the easiest place to check MMI syntax is INST_E.pdf :P.
Back to top
View user's profile Send private message
blackdroid



Joined: 17 Jan 2004
Posts: 564
Location: Sweden

PostPosted: Mon May 03, 2004 10:47 am    Post subject: Reply with quote

yeah but it doesnt seem like he has the manuals, now does it ? :)
_________________
Kung VU
Back to top
View user's profile Send private message Visit poster's website
EugeneE3RD



Joined: 03 Apr 2004
Posts: 51

PostPosted: Mon May 03, 2004 3:16 pm    Post subject: Re: Best ps2linux based development environment ? Reply with quote

Well, there are 3 different Linux based systems which can be installed on the PS2 thru the Linux kit which are:

BlackRhino Linux:

http://blackrhino.xrhino.com/main.php?page=home

Gentoo Linux for PS2:

http://dev.gentoo.org/~kumba/mips/ps2/gentoo-ps2/

Netbsd for PS2:

http://www.netbsd.org/Ports/playstation2/ . Unfortuntly, Netbsd for PS2 doesn't have support for the game controller, Audio , i.LINK, Memory Card & DVD/CD-ROM drive.
Back to top
View user's profile Send private message Send e-mail
mrbrown



Joined: 17 Jan 2004
Posts: 1536

PostPosted: Mon May 03, 2004 3:50 pm    Post subject: Reply with quote

blackdroid wrote:
yeah but it doesnt seem like he has the manuals, now does it ? :)


Yeah, sorry I was thinking it was gorim, who I assume has the manuals since he's porting stuff to the Kit. My mistake.
Back to top
View user's profile Send private message
blackdroid



Joined: 17 Jan 2004
Posts: 564
Location: Sweden

PostPosted: Mon May 03, 2004 8:18 pm    Post subject: Re: Best ps2linux based development environment ? Reply with quote

EugeneE3RD wrote:
Well, there are 3 different Linux based systems which can be installed on the PS2 thru the Linux kit which are:

Netbsd for PS2:

http://www.netbsd.org/Ports/playstation2/ . Unfortuntly, Netbsd for PS2 doesn't have support for the game controller, Audio , i.LINK, Memory Card & DVD/CD-ROM drive.


Ill just have to state the obvious *BSD is not a "Linux based system" if at all it could be said the other way around.

/disgruntled BSD user.
_________________
Kung VU
Back to top
View user's profile Send private message Visit poster's website
Guest






PostPosted: Mon May 03, 2004 11:08 pm    Post subject: Reply with quote

ldesnogu wrote:
gorim wrote:
The
resulting executable wasn't runnable, but as mentioned, it was
an expected result.
Did you try to use -mabi=32 as I suggested?


Sorry no. I didn't have a chance to try the binutils release you
suggested. I would like to try soon, but I am actually on vacation
and only sneak to ps2dev or my ps2 as my wife allows.

I hope to be able to spend this coming weekend setting up my
dev environment and test more things.

Gorim
Back to top
Guest






PostPosted: Mon May 03, 2004 11:15 pm    Post subject: Reply with quote

mrbrown wrote:
He needs to use -mips3 and/or -m5900. The equivalent to -m5900 is -mcpu=5900 or -mcpu=r5900, IIRC.


Ok, I have used those flags with the stock ps2linux gcc in combo with
your newer patched binutils. The problem I am having is that the
gcc does not appear to output double-word arithmetic instructons
for add/sub if I *do not* used -mips3. On the other hand, if I use
-mips3, not only will it output the double-word add/sub, it will
output double-word mult, the latter of which is unsupported in the EE.

Am I missing some options on the stock compiler, or should I assume
that updating the compiler to the more recent patched one you
provide should solve the problem ?

On the other hand, the linker absolutely chokes on any object file
compiled with -mips3 and/or -mabi=64.

Gorim
Back to top
Guest






PostPosted: Mon May 03, 2004 11:19 pm    Post subject: Reply with quote

Saotome wrote:

does anyone have some links to maybe just a list of instructions or some macros or examples how to implement MMI?

thanks ;)


Your best bet is to acquire the Linux kit. The accompanying DVD roms
include the entire EE instruction set reference in PDF, which is invaluable
if you want to do ANY MMI coding.

Or, as others suggested, you can paw through patched binutils code
and derive the instruction descriptions that way, which is the hard way.
No doubt they chuckled on making those suggestions :)

Gorim
Back to top
Guest






PostPosted: Mon May 03, 2004 11:23 pm    Post subject: Reply with quote

mrbrown wrote:
blackdroid wrote:
yeah but it doesnt seem like he has the manuals, now does it ? :)


Yeah, sorry I was thinking it was gorim, who I assume has the manuals since he's porting stuff to the Kit. My mistake.


Yeah, your mistake in thinking it was me he was responding to, but
not mistaken that I do have the manuals. :)

Gorim
Back to top
Saotome



Joined: 03 Apr 2004
Posts: 182

PostPosted: Tue May 04, 2004 2:44 am    Post subject: Reply with quote

gorim wrote:

Your best bet is to acquire the Linux kit. The accompanying DVD roms
include the entire EE instruction set reference in PDF, which is invaluable
if you want to do ANY MMI coding.

actually i dont have enough money to afford the linux kit at the moment, and i dont want to acquire the linux kit just to do some MMI coding ;)
but maybe anyone knows if i can download the instruction set reference somewhere? i already found an "EE Core User's Manual" via google, but the link doesnt work.

gorim wrote:

Or, as others suggested, you can paw through patched binutils code
and derive the instruction descriptions that way, which is the hard way...

actually i already had a look at the instruction descriptions and it doesnt really look that hard ;) i'm used to that kind of work because its similar to how i began with MMX when i didnt have a mmx-compiler
Back to top
View user's profile Send private message
ldesnogu



Joined: 17 Apr 2004
Posts: 95

PostPosted: Tue May 04, 2004 3:08 am    Post subject: Reply with quote

Saotome wrote:
but maybe anyone knows if i can download the instruction set reference somewhere?
I know you won't like my answer, but the only easy legal way to get it is to buy the Linux kit.
Back to top
View user's profile Send private message
ldesnogu



Joined: 17 Apr 2004
Posts: 95

PostPosted: Tue May 04, 2004 5:21 am    Post subject: Reply with quote

I finally dug out my PS2 to test what I told. The poor beast had been off since last June...

My silly stupid program is:
Code:
#include <stdio.h>

int main(int argc, const char *argv[])
{
  fprintf(stderr, "Was here\n");

  return 1;
}

Impressive heh ? :)

I then used the following Makefile (sorry it's even dumber than the .c file and is for cross compilation):
Code:
CC   = /usr/local/ps2/bin/mipsEEel-linux-gcc
DEBUG   = -g
CFLAGS   = $(DEBUG)
LDFLAGS   = $(DEBUG)

# Binutils execs
OLDAS   = /usr/local/ps2/mipsEEel-linux/bin/as
NEWAS   = /home/ldesnogu/Binutils/Dev/strippeddown-2.14/mybinutils-2.14/build/gas/as-new

# Flags
OLDASFLAGS = -v -mwarn-short-loop -mcpu=r5900 -KPIC -mips2 -msingle-float
NEWASFLAGS = -v -mwarn-short-loop -march=r5900 -KPIC -msingle-float -mabi=32

all: simple-oldas simple-newas


###############################################################################
# Generate execs (using gcc collects)

simple-oldas: simple-oldas.o
simple-newas: simple-newas.o

###############################################################################
# Generate .o (using as)

simple-oldas.o: simple.s
   $(OLDAS) $(OLDASFLAGS) simple.s -o simple-oldas.o

simple-newas.o: simple.s
   $(NEWAS) $(NEWASFLAGS) simple.s -o simple-newas.o

###############################################################################
# Generate .s

simple.s: simple.c
   $(CC) $(CFLAGS) -S simple.c

###############################################################################

.PHONY: clean
clean:
   rm -f simple-oldas simple-oldas.o
   rm -f simple-newas simple-newas.o simple.s


Nothing complex as you can see.

And the PS2linux happily ran both simple-old and simple-newas.

Some notes:
- the execs are dynamically linked
- the linker used is the old one
- to make large scale tests one should change gcc spec file.

Time to move on to something more complex, as this does not prove much from my point of view.
Next step is to build a dynamically shared library...
Back to top
View user's profile Send private message
ldesnogu



Joined: 17 Apr 2004
Posts: 95

PostPosted: Tue May 04, 2004 6:08 am    Post subject: Reply with quote

And now for the shared library stuff.

Makefile
Code:
CC   = /usr/local/ps2/bin/mipsEEel-linux-gcc
DEBUG   = -g
CFLAGS   = $(DEBUG)
LDFLAGS   = $(DEBUG)

# Binutils execs
OLDAS   = /usr/local/ps2/mipsEEel-linux/bin/as
NEWAS   = /home/ldesnogu/Binutils/Dev/strippeddown-2.14/mybinutils-2.14/build/gas/as-new

# Flags
OLDASFLAGS = -mwarn-short-loop -mcpu=r5900 -KPIC -mips2 -msingle-float
NEWASFLAGS = -mwarn-short-loop -march=r5900 -KPIC -msingle-float -mabi=32

all: main-oldas-oldlib main-oldas-newlib main-newas-oldlib main-newas-newlib


###############################################################################
# Generate execs (using gcc collect2)

main-oldas-oldlib: testso-main-oldas.o testso-oldas.so
   $(CC) $(LDFLAGS) -o $@ $^

main-oldas-newlib: testso-main-oldas.o testso-newas.so
   $(CC) $(LDFLAGS) -o $@ $^

main-newas-oldlib: testso-main-newas.o testso-oldas.so
   $(CC) $(LDFLAGS) -o $@ $^

main-newas-newlib: testso-main-newas.o testso-newas.so
   $(CC) $(LDFLAGS) -o $@ $^

###############################################################################
# Generate .so (using gcc collect2)

testso-oldas.so: testso-oldas.o
   $(CC) $(LDFLAGS) -shared -o $@ $<

testso-newas.so: testso-newas.o
   $(CC) $(LDFLAGS) -shared -o $@ $<

###############################################################################
# Generate .o (using as)

testso-oldas.o: testso.s
   $(OLDAS) $(OLDASFLAGS) -o $@ $<

testso-newas.o: testso.s
   $(NEWAS) $(NEWASFLAGS) -o $@ $<

testso-main-oldas.o: testso-main.s
   $(OLDAS) $(OLDASFLAGS) -o $@ $<

testso-main-newas.o: testso-main.s
   $(NEWAS) $(NEWASFLAGS) -o $@ $<

###############################################################################
# Generate .s

testso.s: testso.c
   $(CC) $(CFLAGS) -fPIC -S testso.c

testso-main.s: testso-main.c
   $(CC) $(CFLAGS) -fPIC -S testso-main.c

###############################################################################

files.tar: main-oldas-oldlib main-oldas-newlib \
      main-newas-oldlib main-newas-newlib \
      testso-oldas.so testso-newas.so
   tar cf $@ $^

.PHONY: clean
clean:
   rm -f testso-oldas.o testso-oldas.so \
      testso-newas.o testso-newas.so \
      testso-main.s testso.s \
      testso-main-newas.o testso-main-oldas.o \
      main-oldas-oldlib main-oldas-newlib \
      main-newas-oldlib main-newas-newlib

testso.h
Code:
#ifndef TESTSO_H
#define TESTSO_H

int shared_fn(const char *fmt, ...);

#endif /* TESTSO_H */

testso.c
Code:
#include <stdio.h>
#include <stdarg.h>

int shared_fn(const char *fmt, ...)
{
  va_list ap;

  va_start(ap, fmt);
  vfprintf(stderr, fmt, ap);
  va_end(ap);

  return 0x1234DEAD;
}

testso-main.c
Code:
#include <stdio.h>
#include "testso.h"

int main(int argc, const char *argv[])
{
  int res;

  res = shared_fn("Call it with %s and %x\n", "string", 0x9876CAFE);
  fprintf(stderr, "res = %x\n", res);

  return 0;
}


All four generated execs behave as expected.

So did I miss anything or can we conclude that gas 2.14 can be used in place of the older one?
Back to top
View user's profile Send private message
Guest






PostPosted: Tue May 04, 2004 2:23 pm    Post subject: Reply with quote

[quote="Saotome"][quote="gorim"]

actually i dont have enough money to afford the linux kit at the moment, and i dont want to acquire the linux kit just to do some MMI coding ;)
but maybe anyone knows if i can download the instruction set reference somewhere? i already found an "EE Core User's Manual" via google, but the link doesnt work.

That link has existed for years and has always been inaccessible
(at least since the time Sony or someone told them to clam up)

Anyhow, you have some alternatives:
The kit is being sold for $99 right now, an awesome deal, but it
won't last. I am not sure they plan to produce the kit anymore.
Or maybe, now with the HD and BBA released, they could choose
to sell only the DVDs. Anyhow, checkout playstation2-linux.com.

I bought the JAP Linux DVDs off ebay 2 years ago. Someone apparently
bought that kit and split it up. Check out ebay, or playstation2-linux.com
for people who no longer want their kit, you might get a deal.

Finally, I have an extra printed copy of that manual. But I think
copyright would prevent me from sending it to you. I don't want
it anymore because its thick and cumbersome, my first printed
copy. I printed it again on A4 landscape two pages per side of
each sheet so it took less space and I can see more info at a time.
The original was merely single-page per side of each sheet. The
difference being, the latter is 2 printed pages per sheet, while the
former (newer) is 4 printed pages per sheet.

If it was legal for me to distribute a copy I printed originally for
my own personal purposes to someone else, I would be willing
to send it to you, but I will wait on the advice of others first.
Otherwise I just have to throw it away. If you already had a Linux
DVD, I could probably for sure legally give you one printed copy.
(at least, Sony probably wouldn't care if I did), but then you prob
wouldn't need my copy.

Gorim
Back to top
Saotome



Joined: 03 Apr 2004
Posts: 182

PostPosted: Wed May 05, 2004 3:46 am    Post subject: Reply with quote

gorim wrote:
... I would be willing
to send it to you...

thanks gorim
but i think i will try first with what i have now: i have the instructions from "mips-opc.c" - there is no info what each instruction does, but i think i'll find out somehow ;) and with the examples which bigboss posted (here) i can already see how to use some of them.
actually thats more than i had before i asked here, so i'm happy with it :)
thanks again
Back to top
View user's profile Send private message
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