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 

making .elf out of .o using GCC?

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



Joined: 24 Feb 2004
Posts: 6
Location: England

PostPosted: Tue Feb 24, 2004 5:39 am    Post subject: making .elf out of .o using GCC? Reply with quote

Hi, I'm new to GCC for the ps2.

I was wondering if anyone could tell me how to convert .o files into .elf files using GCC. I'm using the ps2Dev envirmonment variables (That big 30 MB installation version).

I have a simple program with nothing in it (int main(void){}) called main.c

I compile it using: ee-gcc -Tc:\ps2dev\ps2lib\ee\startup\linkfile -o main.o main.c

Now I've got my object file, HOW do I turn it into an .elf file?

Thanks in advance and sorry for the very simple question.
_________________
my business site: http://www.codebytesdev.dynip.com
(brand spanking new)
Back to top
View user's profile Send private message Visit poster's website
mrbrown



Joined: 17 Jan 2004
Posts: 1536

PostPosted: Tue Feb 24, 2004 7:12 am    Post subject: Reply with quote

Short answer: read Makefile.eeglobal in ps2lib. You might have to read up on GNU make and Makefiles also, but it'll be worth it.
Back to top
View user's profile Send private message
Guest






PostPosted: Tue Feb 24, 2004 7:52 am    Post subject: still stuck Reply with quote

Thanks for the help mr brown. But I've read all the make files and still I can't convert object files into .elf files.

Can somebody please help me convert .o files into .elf files using ee-gcc?

Thanks.
Back to top
0xFF



Joined: 24 Feb 2004
Posts: 6
Location: England

PostPosted: Tue Feb 24, 2004 7:58 am    Post subject: Reply with quote

Sorry, I didn't log in, but that is my post above.

Seriously guys, help will be very appreciated!
_________________
my business site: http://www.codebytesdev.dynip.com
(brand spanking new)
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: Tue Feb 24, 2004 12:25 pm    Post subject: Reply with quote

ee-gcc -Tc:\ps2dev\ps2lib\ee\startup\linkfile -o main.elf main.c
Back to top
View user's profile Send private message Visit poster's website
Guest






PostPosted: Wed Feb 25, 2004 4:09 am    Post subject: Reply with quote

YEAAAAAAAAASSSSSS. Thanks Oopo. You're the man!
Back to top
ooPo
Site Admin


Joined: 17 Jan 2004
Posts: 2032
Location: Canada

PostPosted: Wed Feb 25, 2004 4:32 am    Post subject: Reply with quote

You had an elf file the whole time. You were just telling gcc to output as a file called main.o. :)
Back to top
View user's profile Send private message Visit poster's website
mharris



Joined: 25 Jan 2004
Posts: 155
Location: Annapolis, MD, USA

PostPosted: Wed Feb 25, 2004 7:55 am    Post subject: OT: ELF Reply with quote

And, strictly speaking, an object file (".o file") is "an elf file" too. It's an ELF relocatable, but it's not an ELF executable (which is what you wanted).

The ELF format (OK, this is redundant, since ELF stands for "Executable and Linking Format") is just an object container -- in addition to executable files and relocatable files, there are also shared libraries and probably other stuff too. Elf is a very nice container, as it's completely architecture-neutral; one file format for lots of things (exec, reloc, so), and lots of architecures (mips, x86, m68k, etc.) in both little-endian and big-endian format. Much nicer than the so-called "portable executable" that windows uses...

[I'm being pedantic here, of course, since everyone knows that in ps2dev parlance, "an .elf file" is generally taken to mean "A staticly-linked MIPS-5900 little-endian executable ELF file."]
Back to top
View user's profile Send private message AIM Address
Guest






PostPosted: Wed Feb 25, 2004 9:15 am    Post subject: Reply with quote

Thanks oopo, and mharris for being so imformative.

I just have one last question :?

Does anybody have any "single-line" code that I could use to test an .elf file on a ps2? This code be anything; it could just draw a block on the screen.

For example:

int main(void)
{
//insert single code function here!
}

Thanks everybody. :wink:
Back to top
0xFF



Joined: 24 Feb 2004
Posts: 6
Location: England

PostPosted: Wed Feb 25, 2004 9:17 am    Post subject: Reply with quote

Damn It. I keep on forgetting to log in! Sorry that is my post directly above.
_________________
my business site: http://www.codebytesdev.dynip.com
(brand spanking new)
Back to top
View user's profile Send private message Visit poster's website
mharris



Joined: 25 Jan 2004
Posts: 155
Location: Annapolis, MD, USA

PostPosted: Wed Feb 25, 2004 9:39 am    Post subject: Reply with quote

There is no "hello world" for the PS2...

IMHO, your best bet would be to get one of dreamtime's (and others') tutorials. All you need are the .elf files ;-P but the sources are worth looking at too, as they can show you a lot of the basics of PS2 development. dreamtime uses his own 2D graphics packages (rather than some of the libraries which have become available since he made the tuts); this can be good and bad -- it will help you understand the nuts and bolts of the GS and GIF, but the barrier to entry is pretty high (i.e., you'd have to some work if you wanted to add 3D, backface culling, etc.)

Any of the entries at thethirdcreation.net competitions would be something else to try -- they'll give you a good idea of what people are doing now, but the code is far more complicated in most cases.
Back to top
View user's profile Send private message AIM Address
Guest






PostPosted: Wed Feb 25, 2004 9:47 am    Post subject: Reply with quote

thanks for the wake-up call. I'll get to reading those tutorials by dreamtime.
Back to top
mrbrown



Joined: 17 Jan 2004
Posts: 1536

PostPosted: Wed Feb 25, 2004 11:00 am    Post subject: Reply with quote

Actually, if you use ps2lib there is "hello world", see the hello example in ps2lib/ee/samples/hello :).
Back to top
View user's profile Send private message
Guest






PostPosted: Wed Feb 25, 2004 11:13 pm    Post subject: Reply with quote

Spot on mrbrown! :D

I found the Hello world sample, albeit I can't get it to compile using the makefile.

Please consider the following question as an extension of my last question, making this question, the very last silly question that I've asked.

How do you make the hello world sample using the makefile and make.exe?

I've got this far:

make -f "c:\ps2dev\ps2lib\ee\samples\hello\makefile" all

then I get this error:

MAKE: *** No rule to make target `hello.o', needed by `hello.elf'. Stop.

My hello world makefile looks like this:

EE_BIN = hello.elf
EE_OBJS = hello.o

all: $(EE_BIN)

clean:
ee-gcc -o *.elf *.c

include C:\ps2dev\ps2lib\ee\samples\hello\Makefile.pref
include C:\ps2dev\ps2lib\ee\samples\hello\Makefile.eeglobal



Thanks guys!
Back to top
0xFF



Joined: 24 Feb 2004
Posts: 6
Location: England

PostPosted: Wed Feb 25, 2004 11:19 pm    Post subject: Reply with quote

Sorry I forgot to login (again). That is my post above.
I must remember to execute the following code each time I use this forum:

unit32 DumbAssUser0xFF = 0x00001000;

TCHAR mental_note = "REMEMBER TO LOGIN!";

DMATransfer(DumbAssUser0xFF, mental_note); :wink:
_________________
my business site: http://www.codebytesdev.dynip.com
(brand spanking new)
Back to top
View user's profile Send private message Visit poster's website
pixel



Joined: 30 Jan 2004
Posts: 791

PostPosted: Wed Feb 25, 2004 11:21 pm    Post subject: Reply with quote

Change to the "hello" directory instead of making it from the very outside of the building tree.

And for the forum, when you login, you have the little nifty checkbox "Remember me".
_________________
pixel: A mischievous magical spirit associated with screen displays. The computer industry has frequently borrowed from mythology. Witness the sprites in computer graphics, the demons in artificial intelligence and the trolls in the marketing department.
Back to top
View user's profile Send private message
0xFF



Joined: 24 Feb 2004
Posts: 6
Location: England

PostPosted: Wed Feb 25, 2004 11:43 pm    Post subject: Reply with quote

Thanks pixel, but there are still some errors when I run make.exe from the same directory as the hello sample.

When I compile it from the "hello" directory, I get this:

C:\ps2dev\ps2lib\ee\samples\hello>make
ee-gcc -D_EE -fshort-double -O2 -G0 -c -Wall -Ic:/ps2dev/PS2LIB/ee/include -Ic:/
ps2dev/PS2LIB/common/include -I. hello.c -o hello.o
MAKE: ee-gcc: Command not found
MAKE: *** [hello.o] Error 127

The hello makefile looks like this:

EE_BIN = hello.elf
EE_OBJS = hello.o

all: $(EE_BIN)

clean:
rm -f *.elf *.o *.a

include ..\..\..\Makefile.pref
include ..\..\..\Makefile.eeglobal


I'm stumped for answers, please help.
_________________
my business site: http://www.codebytesdev.dynip.com
(brand spanking new)
Back to top
View user's profile Send private message Visit poster's website
pixel



Joined: 30 Jan 2004
Posts: 791

PostPosted: Thu Feb 26, 2004 12:08 am    Post subject: Reply with quote

Your environment (read, the PATH variable) is not correct. Set it so it includes the path to your ee-gcc.exe file.
_________________
pixel: A mischievous magical spirit associated with screen displays. The computer industry has frequently borrowed from mythology. Witness the sprites in computer graphics, the demons in artificial intelligence and the trolls in the marketing department.
Back to top
View user's profile Send private message
0xFF



Joined: 24 Feb 2004
Posts: 6
Location: England

PostPosted: Thu Feb 26, 2004 12:33 am    Post subject: Reply with quote

Thanks a MILLION pixel for sticking with me.

I finally got the sample working (and appened to an infinite loop so I could see "Hello World" on the screen)

I owe you one.
If you need any favours, I'll be glad to help. :D
_________________
my business site: http://www.codebytesdev.dynip.com
(brand spanking new)
Back to top
View user's profile Send private message Visit poster's website
mrbrown



Joined: 17 Jan 2004
Posts: 1536

PostPosted: Thu Feb 26, 2004 1:30 am    Post subject: Reply with quote

I need somebody whacked ... this so-called Canadian genius who goes by the name ooPo "The Fixer".

Then fly over to Sweden and off blackdroid "The MIA".

:P
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