| View previous topic :: View next topic |
| Author |
Message |
0xFF
Joined: 24 Feb 2004 Posts: 6 Location: England
|
Posted: Tue Feb 24, 2004 5:39 am Post subject: making .elf out of .o using GCC? |
|
|
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 |
|
 |
mrbrown
Joined: 17 Jan 2004 Posts: 1536
|
Posted: Tue Feb 24, 2004 7:12 am Post subject: |
|
|
| 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 |
|
 |
Guest
|
Posted: Tue Feb 24, 2004 7:52 am Post subject: still stuck |
|
|
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
|
Posted: Tue Feb 24, 2004 7:58 am Post subject: |
|
|
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 |
|
 |
ooPo Site Admin
Joined: 17 Jan 2004 Posts: 2032 Location: Canada
|
Posted: Tue Feb 24, 2004 12:25 pm Post subject: |
|
|
| ee-gcc -Tc:\ps2dev\ps2lib\ee\startup\linkfile -o main.elf main.c |
|
| Back to top |
|
 |
Guest
|
Posted: Wed Feb 25, 2004 4:09 am Post subject: |
|
|
| YEAAAAAAAAASSSSSS. Thanks Oopo. You're the man! |
|
| Back to top |
|
 |
ooPo Site Admin
Joined: 17 Jan 2004 Posts: 2032 Location: Canada
|
Posted: Wed Feb 25, 2004 4:32 am Post subject: |
|
|
| You had an elf file the whole time. You were just telling gcc to output as a file called main.o. :) |
|
| Back to top |
|
 |
mharris
Joined: 25 Jan 2004 Posts: 155 Location: Annapolis, MD, USA
|
Posted: Wed Feb 25, 2004 7:55 am Post subject: OT: ELF |
|
|
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 |
|
 |
Guest
|
Posted: Wed Feb 25, 2004 9:15 am Post subject: |
|
|
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
|
Posted: Wed Feb 25, 2004 9:17 am Post subject: |
|
|
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 |
|
 |
mharris
Joined: 25 Jan 2004 Posts: 155 Location: Annapolis, MD, USA
|
Posted: Wed Feb 25, 2004 9:39 am Post subject: |
|
|
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 |
|
 |
Guest
|
Posted: Wed Feb 25, 2004 9:47 am Post subject: |
|
|
| 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
|
Posted: Wed Feb 25, 2004 11:00 am Post subject: |
|
|
| Actually, if you use ps2lib there is "hello world", see the hello example in ps2lib/ee/samples/hello :). |
|
| Back to top |
|
 |
Guest
|
Posted: Wed Feb 25, 2004 11:13 pm Post subject: |
|
|
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
|
Posted: Wed Feb 25, 2004 11:19 pm Post subject: |
|
|
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 |
|
 |
pixel
Joined: 30 Jan 2004 Posts: 791
|
Posted: Wed Feb 25, 2004 11:21 pm Post subject: |
|
|
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 |
|
 |
0xFF
Joined: 24 Feb 2004 Posts: 6 Location: England
|
Posted: Wed Feb 25, 2004 11:43 pm Post subject: |
|
|
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 |
|
 |
pixel
Joined: 30 Jan 2004 Posts: 791
|
Posted: Thu Feb 26, 2004 12:08 am Post subject: |
|
|
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 |
|
 |
0xFF
Joined: 24 Feb 2004 Posts: 6 Location: England
|
Posted: Thu Feb 26, 2004 12:33 am Post subject: |
|
|
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 |
|
 |
mrbrown
Joined: 17 Jan 2004 Posts: 1536
|
Posted: Thu Feb 26, 2004 1:30 am Post subject: |
|
|
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 |
|
 |
|