""
All times are GMT -4. The time now is 04:42 AM.  


Go Back   PSX/PS2/PS3 Scene Newz > PlayStation2 Forums > PS2 Homebrew/Dev & Emu Scene > PS2 Linux

PS2 Linux Show your penguin pride. Discuss PS2 Linux (Official kit and Blackrhino) here!



Reply
 
Thread Tools Display Modes
  #1  
Old 07-29-2010, 06:46 PM
eljedi eljedi is offline
Registered User
 
Join Date: Jul 2010
Posts: 5
binutils

Hello guys!

I'm a really newbie on linux ps2 (just installed few days ago deba5er usb distro).

I got a problem while trying to compile gcc 4.4. It just blows up and I got the "out of the branch" error. So i thought it could be a linker problem while trying to link the assembler.

Searching on google I found that with newer versions of binutils i can use an option called -relax-branch to solve the previous problem, but that requieres to update the binutils.

I downloaded the binutils from gnu ftp server, and here comes my problems:
compiling binutils 2.20.1 with ./configure (no options, all by default) i compiles and passes the checks. When I try to compile a simple dummy code like:
void(){} (just this in a file) i got this error:
as: unrecognized option `-mwarn-short-loop'

So i decided to test a older version, 2.14.
I repeat the scenario, but I got a different error:
as: unrecognized option `-mcpu=r5900'

Any light on that??
Thanks!!
Reply With Quote
  #2  
Old 07-29-2010, 08:47 PM
coldguy coldguy is offline
Registered User
 
Join Date: Jul 2010
Posts: 3
As I understand it, the PS2 support that was added to GCC and binutils was never merged into the mainline of the projects, so the support doesn't exist in newer versions. I might be wrong on these version numbers, but for Linux on the PS2 I think the newest GCC you can get is 2.95 (or if you just want to make bare ELFs there's a 3.something port.) ps2dev was the best source for this information but it looks like it's down right now

(Edit: Just to clarify, it's not simply a matter of getting an older version of GCC or binutils. You have to find versions patched specifically for PS2 support)
Reply With Quote
  #3  
Old 07-30-2010, 02:26 AM
eljedi eljedi is offline
Registered User
 
Join Date: Jul 2010
Posts: 5
I thought binutils 2.14 worked on ps2 linux.. and the support was on mainline as i read someone made the patch for that version.

Sorry for the confusion, my bad!!

If that patch exists, is it available still?

thanks!
Reply With Quote
  #4  
Old 07-31-2010, 02:08 AM
coldguy coldguy is offline
Registered User
 
Join Date: Jul 2010
Posts: 3
I'm honestly not sure, I'm just getting started playing with the PS2 development stuff myself. The patch should still be out there somewhere. Maybe someone more knowledgeable can enlighten us on the state of the PS2 Linux toolchain, and where to obtain it?
Reply With Quote
  #5  
Old 07-31-2010, 10:21 AM
Mega Man Mega Man is offline
Registered User
 
Join Date: Jan 2010
Location: Germany
Posts: 43
The latest working version is gcc 3.0.3 which was available at the offical PS2 Linux homepage. This page is closed now. You can look at the dosbox thread in this forum to get the it.

Otherwise the best you can get is here: http://rapidshare.com/files/37089499...4.tar.bz2.html
This includes binutils-2.16.1 and gcc-4.2.0.
It is not possible to compile it completely. You will only get the early stage called xgcc. When you try to compile something with xgcc, it is very likely that the compiler stops with an internal error. To get this solved you need to be a GCC expert. Only simple assembler will work. I assume most people don't want assembler only.

You can test the new binutils with the following program:
Code:
#define zero $0
#define AT $1
#define v0 $2
#define v1 $3
#define a0 $4
#define a1 $5
#define a2 $6
#define a3 $7
#define t0 $8

#define gp $29
#define ra $31

.data
msg:
	.ascii "MIPS Assembler Test\n"
len:
	.long . - msg

.text
.global __start
__start:
	lui $29, %hi(_gp)
	addiu $29, %lo(_gp)

	li $2, 4004

	li $4, 1
	la $5, msg
	lw $6, len
	syscall

	li $4, 0
	li $2, 4001
	syscall
You can compile it with the commands:
Code:
ee-as   -o mini.o mini.s
ee-ld -o simple mini.o
Reply With Quote
  #6  
Old 07-31-2010, 11:19 AM
eljedi eljedi is offline
Registered User
 
Join Date: Jul 2010
Posts: 5
Thanks MegaMan and Coldguy.

I think i found a patch for version 2.14:
http://bitbucket.org/ps2dev/ps2toolchain/wiki/Home

You download it, execute toolchain script and it will create a patches dir. Inside this dir there's a patch for the binutils-2.14
I'm trying it at the moment..

Is there some tutorial on how to use this toolchain? I got some error when trying to compile a simple dummy.c file:
void(){}

Thanks!


EDIT: Do you use a cross compiler to compile code for ps2linux or just compile inside the ps2? (which is very slow)
Reply With Quote
  #7  
Old 07-31-2010, 02:54 PM
Mega Man Mega Man is offline
Registered User
 
Join Date: Jan 2010
Location: Germany
Posts: 43
Your test should include at least a function name:
Code:
void main()
{
}
I use a native compiler for BlackRhino because the old Debian didn't supported cross compiling. For the Kernel I use a cross compiler. I built the GCC 4 as cross compiler. I think it will not be possible to build the GCC binary native with the old GCC.
Reply With Quote
  #8  
Old 08-01-2010, 04:17 AM
eljedi eljedi is offline
Registered User
 
Join Date: Jul 2010
Posts: 5
It was a typo, sorry.

I use this: main(){}
without a void, or any type so i don't need to make any include. Otherwise i will need to use includes.

when using gcc 3.03, did you get this error:

as: unrecognized option `-mcpu=r5900'

I tried to pass -Wa,-march=5900 but gcc still calls as with -mcpu option.

thanks!
Reply With Quote
  #9  
Old 08-01-2010, 09:08 AM
Mega Man Mega Man is offline
Registered User
 
Join Date: Jan 2010
Location: Germany
Posts: 43
Normally the message "-mcpu=r5900" appears if you try to cross compile but you don't have the cross binutils installed. It then calls the native assembler which doesn't support mips and print this message. But it is also possible that you have mips binutils without support for PS2 (R5900).
Reply With Quote
  #10  
Old 08-02-2010, 04:32 AM
eljedi eljedi is offline
Registered User
 
Join Date: Jul 2010
Posts: 5
using as -march=r5900 works perfectly.
I read -mcpu on binutils 2.14 is deprecated. But gcc 3.03 passes -mcpu automaticly to as, even if I specify -Wa,-march=5900

Is there someway to avoid that?

thanks!!
Reply With Quote
  #11  
Old 08-02-2010, 02:46 PM
Mega Man Mega Man is offline
Registered User
 
Join Date: Jan 2010
Location: Germany
Posts: 43
The parameters should be stored in the spec file, but don't ask me how this is working. I never used it. The spec file for my cross compiler is stored at the following place:
/usr/local/ps2/lib/gcc-lib/mipsEEel-linux/2.95.2/specs

Maybe replacing some occurances of "-mcpu=r5900" or "mcpu" will help.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

» Sponsors
» Advertisement
» Advertisements
Powered by vBadvanced CMPS v3.2.2


All times are GMT -4. The time now is 04:42 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Copyright ©2010 PSX-SCENE.COM
Portions of this site are protected under the Creative Commons license.
We are in no way affiliated with Sony Computer Entertainment Inc.
As this is a public forum, we are not responsible for any of it's content.
All posted material is Copyright of their respective owners.