Page 1 of 1

Windows GCC Help Needed

Posted: Fri Feb 20, 2004 7:16 am
by Ibanez_NZ
Hi! New to the PS2 dev scene and need some help...

Ideally would like to be able to get the Windows PS2 Development Environment up and running properly. I already tried the whole cygwin/binutils/patches/gcc-ee/gcc-iop thing, but got lost amongst all the makes/configs/patches etc. and didn't come close to building a working compiler; I then did a bit of assembly coding using a (homemade) R5900 assembler, but ran into a dead end beyond simple 2d bitmaps. So that brings me back to gcc.

I downloaded said 'Windows PS2 Development Environment' (you know- the one with everything all pre-compiled and ready to go? Just what I was looking for!), got at installed, etc. great. Having trouble though getting anything to compile (even 'void main(void) {}'). I copied over crt0.s and crt0.o and not get errors reading...

crt0.o: In function '_start':
crt0.s:48: Undefined reference to '_stack'
crt0.s:48: Undefined reference to '_stack'
crt0.s:49: Undefined reference to '_stack_size'
crt0.s:49: Undefined reference to '_stack_size'
crt0.s:60: Undefined reference to '_heap_size'
crt0.s:60: Undefined reference to '_heap_size'
collect2: ld returned 1 exit status

This is when I use 'ee-gcc main.c' on my 'int main(void) {}' program. Anyone got any idea on what I'm doing wrong? Really keen to get into this- been trying for weeks and it's really driving me crazy!!!!

Thanks guys any help would be GREATLY appreciated!!!!

Posted: Fri Feb 20, 2004 7:56 am
by ooPo
Sounds like you're not telling gcc where to find the linkfile. Do this by adding:

-T$(PS2LIB)/ee/startup/linkfile

Thank you!!!

Posted: Fri Feb 20, 2004 8:15 am
by Ibanez_NZ
Oopo, you are a freaking genius!!!! That seemed to have done the trick (with a minor adjustment). I am forever in your debt! Can't wait to get into some real coding action- just have to brush up on my C skills now (obviously it's been a while :) )

Thanks again for the quick rely!

Posted: Fri Feb 20, 2004 8:21 am
by blackdroid
has the first canadian genius been spotted ?

Canadian Genius

Posted: Fri Feb 20, 2004 8:28 am
by Ibanez_NZ
Allen, John F.: Physicist. co-discoverer of superfluidity
Altman, Sidney: 1989 Nobel Prize winner in chemistry.
Banting, Frederick: 1923 Nobel Prize winner in medicine. co-discoverer of insulin
Brockhouse, Bertram: 1994 Nobel Prize winner in physics.
Best, Charles: co-discoverer of insulin with Banting
Giauque, William Francis: 1949 Nobel Prize Winner in Chemistry
Gosling, James: Programmer. inventor of Java
Herzberg, Gerhard: 1971 Nobel Prize winner in chemistry
Hubel, David: 1981 Nobel Prize winner in medicine
Marcus, Rudolph: 1992 Nobel Prize winner in Chemisty
Osler, Sir William: Physician. "most influential physician in history"
Penfield, Wilder: Neurosurgeon. discovered electrical stimulation of the brain
Polanyi, John: 1986 Nobel Prize winner in chemistry
Schawlow, Arthur: 1981 Nobel Prize winner in physics (for lasers)
Scholes, Myron: 1997 Nobel Prize winner in Economics
Smith, Michael: 1993 Nobel Prize winner in chemistry
Taube, Henry: 1983 Nobel Prize winner in chemistry
Taylor, Richard: 1990 Nobel Prize winner in physics
Vickrey, William: 1996 Nobel Prize winner in economics
Wilson, Tuzo: Geophysicist. plate tectonics

And now....

Oopo: PS2 Dev master. Winner of Ibanez's "Best guy ever"

Posted: Fri Feb 20, 2004 8:56 am
by blackdroid
Hahaha :) a good rebuttal indeed. 10 bmx ninja points awarded

Posted: Fri Feb 20, 2004 11:42 am
by ooPo
Excellent job of teaching the king of vu a few facts about the most wonderful of countries... Canada.

I missed it the first time... did you say homemade r5900 assembler? And you got confused with building a toolchain? Wow. :)

Posted: Fri Feb 20, 2004 12:42 pm
by Ibanez_NZ
Yeah, got a good list of the opcodes and was pretty simple (compared to making a CISC assembler anyway!)- used Delphi to start to make an IDE with it, but gave it up. Hope to get into the demo scene once I get going; been coding demos since the old C64/Amiga days and done some DirectX games, so plenty of C/assembly experience, but definitely not a *nix guru, so am *not* liking GCC and the whole toolchain rubbish! (am looking at the gcc.gnu.org page now to learn how to use it).

blackdroid: Can I cash in my bmx ninja points for dumb questions?

Stuck again

Posted: Sat Feb 21, 2004 6:47 am
by Ibanez_NZ
Ok blackdroid, lets see if there are any Swedish geniuses... I got the 'hello world' sample program working with ps2lib (I didn't know you could just type 'make' doh!). But having trouble with the 'starsim' demo (the real simple one by Sjeep- hey a fellow kiwi!)- cant seem to be able to call the functions in hw.s. Even adding a DmaReset() line in the hello world program says

Undefined reference to 'DmaReset'

(I do have "#include "hw.h" in my source). I am completely baffled, no doubt it is something trivial, but I am stumped- very frustrating because the code part is easy- just compiling is the hard part!!!

Ok so 100 bmz ninja points to anyone who can help out a fellow code monkey here :)

Posted: Sat Feb 21, 2004 8:41 am
by blackdroid
Undefined reference is during linking stage.. you dont provide the object file wich contains the functions and gcc says it cant find them by saying "Undefined reference"..

Posted: Sat Feb 21, 2004 9:33 am
by Ibanez_NZ
Yeah got that much figured out, just trying to work out how to feed gcc the hw.s file with my hello.c- I tried using the 'as' command, but the register values aren't defined, I guess I could put those definitions in, but surely there must be an easier way (there should be a gcc switch or a line in my makefile perhaps?)

Posted: Sat Feb 21, 2004 11:00 am
by blackdroid
hw.s should have been compiled to an object file
ee-gcc -o hw.o hw.s
and then when linking hw.o should be given..
ee-gcc -o starsim starsim.o hw.o ( or some like that )

Posted: Sat Feb 21, 2004 12:23 pm
by Ibanez_NZ
Well, well, looks like the first Swedish genius has been spotted, disregarding a few insignificants (Nobel, Swedenborg, et. al).

With a bit of tinkering got it working...

ee-gcc -c hw.s

once I removed crt0.o from the directory (don't know why, but google told me and it worked..)

Nothing can stop me now!!!!!!! (hmmm we'll see!)

Posted: Sat Feb 21, 2004 3:12 pm
by mrbrown
Er .. whether or not the Canadian and Swede are geniuses or not, every question you've asked thus far is presented in those nice little files we call Makefiles :).

Study GNU make and the Makefiles within ps2lib, it'll save you a lot of time.

Posted: Sat Feb 21, 2004 5:06 pm
by Ibanez_NZ
Might seem obvious to you vets, big mental leap to someone who hasn't used GCC before. Well and truly got the whole 'make' and 'makfile' thing sussed now, so no more newbie questions I promise.

Posted: Sat Feb 21, 2004 8:39 pm
by blackdroid
Ibanez_NZ wrote:so no more newbie questions I promise.
right ;)

Posted: Sun Feb 22, 2004 6:00 am
by Ibanez_NZ
Haha- have a little faith blackdroid! :) Make good progress on my own graphics library already, popping polygons all over the place now, will do some 3d maths functions today (can almost do this blindfolded now- been doing this since the early 80s!). The only problem is that the PS2 ethenet cables are not out in New Zealand yet (expected in March), so I have to do my testing on an emulator, which running on a 500Mhz P3 is sloooooow :P

Posted: Sun Feb 22, 2004 8:53 am
by blackdroid
google for an online store that sells sony ethernet adapter. they exist :)
also a piece of advice, dont do vu code with the emu, they dont seem to emulate vu floats properly.