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 

Building valid elfs

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



Joined: 21 Jul 2004
Posts: 12

PostPosted: Wed Jul 21, 2004 7:28 pm    Post subject: Building valid elfs Reply with quote

Hello World,
I am interested in starting ps2 development but I am having some trouble creating an elf that works.

I have used the toolchain to build the gcc compilier and that worked successfully as far as I know.

I am trying to compile the first of Dreamtimes PS2 tutorials, but although the tutorial compiles fine the elf doesnt run. I am able to run the elf that was included within the tutorial.

I notice the files size as slightly different when I compile the elf file compared to when Dreamtime compiles the elf

Is there any way of testing or verify the elf built correctly other than running it on a ps2?

Incidently it may interest you to know I am booting these demos from a pendrive and an unmodified ps2 runing the max media player on the latest action replay max.

My build is below. Perhaps I am missing some CFLAGS or something?

Any help would be appreciated

David

Quote:

-------------------------------------------------
ee-gcc -c -Wall -W -EL -G0 -O0 -mips3 -nostdlib -DPS2_EE g2.c -o obj/g2.o
g2.c:89:17 warning: multi-line string literals are deprecated
-------------------------------------------------
ee-gcc -c -Wall -W -EL -G0 -O0 -mips3 -nostdlib -DPS2_EE demo1.c -o obj/demo1.o
-------------------------------------------------
ee-gcc -xassembler-with-cpp -c -Wall -W -EL -G0 -O0 -mips3 -nostdlib -DPS2_EE crt0.s -o obj/crt0.o
crt0.s: Assembler messages:
crt0.s:29: Warning: Loop length is too short for r5900.
-------------------------------------------------
ee-gcc -xassembler-with-cpp -c -Wall -W -EL -G0 -O0 -mips3 -nostdlib -DPS2_EE ps2_asm.s -o obj/ps2_asm.o
-------------------------------------------------
ee-gcc -xassembler-with-cpp -c -Wall -W -EL -G0 -O0 -mips3 -nostdlib -DPS2_EE dma_asm.s -o obj/dma_asm.o
-------------------------------------------------
ee-gcc -xassembler-with-cpp -c -Wall -W -EL -G0 -O0 -mips3 -nostdlib -DPS2_EE gs_asm.s -o obj/gs_asm.o
-------------------------------------------------
ee-gcc -Wall -W -EL -G0 -O0 -mips3 -nostdlib -DPS2_EE -Tlinkfile -o demo1.elf obj/g2.o obj/demo1.o obj/crt0.o obj/ps2_asm.o obj/dma_asm.o obj/gs_asm.o -Wl,-Map,demo1.map
Back to top
View user's profile Send private message
blackdroid



Joined: 17 Jan 2004
Posts: 564
Location: Sweden

PostPosted: Wed Jul 21, 2004 7:48 pm    Post subject: Reply with quote

you can do basic checks by using readelf on the binary to see if its a valid elf, or ee-objdump -d, and look at the output to see the code.

Still this wont help you much unless its some really obvious error, like the toolchain not writing a proper elf header or somesuch, it would be easier to debug if you ran it through ps2link since ps2link catches exceptions and prints it on screen/console, with that you will get info on what kind of exception and where in code. alot easier.
_________________
Kung VU
Back to top
View user's profile Send private message Visit poster's website
BiB



Joined: 27 Feb 2004
Posts: 36
Location: France

PostPosted: Thu Jul 22, 2004 12:43 am    Post subject: Reply with quote

I haver the same problem.

I saw something like a start address ofr a .elf file (i don't remember where i read it)

Maybe the problem comes from this wrong address.

Someone heard about this address ???
Back to top
View user's profile Send private message
BiB



Joined: 27 Feb 2004
Posts: 36
Location: France

PostPosted: Thu Jul 22, 2004 12:44 am    Post subject: Reply with quote

i forgot to tell you that the elf runs fine on an emul

I can't send the .elf file to the ps2 console
Back to top
View user's profile Send private message
BiB



Joined: 27 Feb 2004
Posts: 36
Location: France

PostPosted: Thu Jul 22, 2004 2:00 am    Post subject: Reply with quote

daveb, can you send me your 2 elf files please ?

bib_12345@hotmail.com

thx
Back to top
View user's profile Send private message
blackdroid



Joined: 17 Jan 2004
Posts: 564
Location: Sweden

PostPosted: Thu Jul 22, 2004 2:15 am    Post subject: Reply with quote

well the emulator does not emulate the ps2 properly, ive had a bunch of elf files that work on the ps2 but not under the emu. So emulator does not count.
_________________
Kung VU
Back to top
View user's profile Send private message Visit poster's website
BiB



Joined: 27 Feb 2004
Posts: 36
Location: France

PostPosted: Thu Jul 22, 2004 3:30 am    Post subject: Reply with quote

Someone knows where is the problem ?????
Back to top
View user's profile Send private message
blackdroid



Joined: 17 Jan 2004
Posts: 564
Location: Sweden

PostPosted: Thu Jul 22, 2004 4:55 am    Post subject: Reply with quote

To what problem ? I already told dave what he could, do you have a problem aswell ?
_________________
Kung VU
Back to top
View user's profile Send private message Visit poster's website
BiB



Joined: 27 Feb 2004
Posts: 36
Location: France

PostPosted: Thu Jul 22, 2004 5:07 am    Post subject: Reply with quote

I have compiled my own program so i can't compare with another.

In fact, I would like to know if someone already had this kind of problem and if he haf found a solution
Back to top
View user's profile Send private message
blackdroid



Joined: 17 Jan 2004
Posts: 564
Location: Sweden

PostPosted: Thu Jul 22, 2004 5:56 am    Post subject: Reply with quote

Well according to |pixel| who has seen your post on another forum your problem is entirely based on you using ps2client wrong, you need to add the host: device in order to tell ps2link to load from host:
_________________
Kung VU
Back to top
View user's profile Send private message Visit poster's website
daveb



Joined: 21 Jul 2004
Posts: 12

PostPosted: Thu Jul 22, 2004 6:16 am    Post subject: Reply with quote

blackdroid wrote:
you can do basic checks by using readelf on the binary to see if its a valid elf, or ee-objdump -d, and look at the output to see the code.

Still this wont help you much unless its some really obvious error, like the toolchain not writing a proper elf header or somesuch, it would be easier to debug if you ran it through ps2link since ps2link catches exceptions and prints it on screen/console, with that you will get info on what kind of exception and where in code. alot easier.


Blackdroid, thanks for your suggestions. I ran objdump and readelf on the elf file I complied. It appeared to be a valid elf, but I dont really know what to look for. Any suggestions?

I'm trying to sort out a way of running pc2link but I dont know if I can. I somehow need to get the ps2link and the related irx files to my memory card and then boot it using the indepence exploit.

However my current boot method only seems to allow elf files than dont call irx file to run (I guess because none of the programs look for the irx files on the usb port).

Would you know is there a version of pc2link that does require any irx files.
I have been able to load naplink on my ps2 as there is a version that doesnt require any irx files. But I dont know where i can buy a 3202 cable expect lik-sang, i dont know if they are that common.
Back to top
View user's profile Send private message
blackdroid



Joined: 17 Jan 2004
Posts: 564
Location: Sweden

PostPosted: Thu Jul 22, 2004 6:37 am    Post subject: Reply with quote

a ps2link that has the irx drivers embedded in the elf has been put on the todo list, cant give a definite date for that to happen though.

you dont know anyone with a modded machine that can help you move it over for you ?
or someone with that commercial memorycard tool.
_________________
Kung VU
Back to top
View user's profile Send private message Visit poster's website
daveb



Joined: 21 Jul 2004
Posts: 12

PostPosted: Thu Jul 22, 2004 6:47 am    Post subject: Reply with quote

Blackdroid,
again thanks.

I'll try and find somebody with a modded ps2,
but I'll guess i'll just wait for a version of ps2link that has the irx drivers embedded.
Back to top
View user's profile Send private message
ole



Joined: 08 May 2004
Posts: 92
Location: Czech Republic

PostPosted: Fri Jul 23, 2004 12:54 am    Post subject: Reply with quote

Quote:
I somehow need to get the ps2link and the related irx files to my memory card


make simple program that writes files to MC (it's one of the examples in ps2lib so you can modify it). Then embed all ps2link link files in your elf and store those files (embeded as char array for example) to mc - by running the elf. Complicated but should work.
Back to top
View user's profile Send private message
blackdroid



Joined: 17 Jan 2004
Posts: 564
Location: Sweden

PostPosted: Fri Jul 23, 2004 1:38 am    Post subject: Reply with quote

Now he could not get the hello world sample from ps2sdk to work properly.

err, I just reread, dreamtimes tutorials. hm I guess its time to check that those do work properly with the new toolchain, I dont see why not, but you never know.
_________________
Kung VU
Back to top
View user's profile Send private message Visit poster's website
daveb



Joined: 21 Jul 2004
Posts: 12

PostPosted: Fri Jul 23, 2004 6:32 am    Post subject: Reply with quote

ole wrote:
make simple program that writes files to MC (it's one of the examples in ps2lib so you can modify it). Then embed all ps2link link files in your elf and store those files (embeded as char array for example) to mc - by running the elf. Complicated but should work.

I did think of doing something like this. However Im in a kind of catch 22. I cant run a program I've compiled and I cant see why the program is failing as I can't run ps2link.

I did try compiling all the examples from the ps2sdk. Again they all compiled fine but didnt seem to run. I assume the programs output some information to the tv not and just to ps2link
Back to top
View user's profile Send private message
daveb



Joined: 21 Jul 2004
Posts: 12

PostPosted: Sat Jul 24, 2004 8:20 am    Post subject: Reply with quote

Would any body be kind enough to try running my hello.elf ?
I compiled the example program from the PS2SDK and although it built fine it doesnt execute. All I get is a blank screen when i run it. Perhaps somebody can tell me where I have gone wrong?

http://www.geocities.com/daveb_77/Hello.zip

thanks[/url]
Back to top
View user's profile Send private message
blackdroid



Joined: 17 Jan 2004
Posts: 564
Location: Sweden

PostPosted: Sat Jul 24, 2004 8:48 am    Post subject: Reply with quote

elf works, it just prints text to the console(naplink, ps2link), wich you dont have.

comment the printf and nprintf, and the sio ( unless you have the sio installed ).
and uncomment the scr_printf, and you should get output on the screen instead.
_________________
Kung VU
Back to top
View user's profile Send private message Visit poster's website
daveb



Joined: 21 Jul 2004
Posts: 12

PostPosted: Sat Jul 24, 2004 7:29 pm    Post subject: Reply with quote

Blackdroid,
Thanks so much for testing it. I had a suspision that it was working only i couldnt see the output.

Thanks again
Back to top
View user's profile Send private message
blackdroid



Joined: 17 Jan 2004
Posts: 564
Location: Sweden

PostPosted: Sat Jul 24, 2004 7:52 pm    Post subject: Reply with quote

well change the code and you will get output on the screen.
_________________
Kung VU
Back to top
View user's profile Send private message Visit poster's website
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