Help newbie

Discuss the development of software, tools, libraries and anything else that helps make ps2dev happen.

Moderators: cheriff, Herben

Post Reply
PS2Newbie
Posts: 2
Joined: Sat Mar 26, 2005 10:57 pm

Help newbie

Post by PS2Newbie »

Hi !
I'm totally a newbie to PS2 programming so sorry for my stupidness, just recently take a look at PS2SDK. I also coded some simple programs, work fine on Naplink but totally failed from other loaders such as LaunchELF even the "Hello world" that was bundled in PS2SDK1.2

I did these steps for the "Hello world !" ELF:
FTP -> mc0:/HELLO.ELF --> boot LaunchELF -->FileBrower --> execute --> freeze...nothing

(Here Helloworld from PS2SDK for your easy ref.)

Code: Select all

#include <tamtypes.h>
#include <sifcmd.h>
#include <kernel.h>
#include <sifrpc.h>
#include "sio.h"

int main&#40;&#41;
&#123;   
   SifInitRpc&#40;0&#41;; 
/*
   init_scr&#40;&#41;;
   scr_printf&#40;"Hello, world!\n"&#41;; // hello world in the screen
*/
   printf&#40;"Hello, world!\n"&#41;;
   nprintf&#40;"Hello, again, from Naplink RPC!\n"&#41;;
   
   sio_init&#40;115200, 0, 0, 0, 0&#41;;
   sio_printf&#40;"Hello from EE SIO!\n"&#41;;

   /* Return to the bootloader or PS2 browser. */
   SleepThread&#40;&#41;;
&#125; 
This is a quite simple program but I still can not execute it from the MC. Did I do something wrong ? Do we have to manually reset IOP in our programs ?

Moreover, how do we know the location that our ELF was loaded ? Supposed to be in arg[0] but see nothing in Naplink.

Thx
NEWBIE
cory1492
Posts: 216
Joined: Fri Dec 10, 2004 1:49 pm

Post by cory1492 »

which version of ps2link are you using? are you modded or using swap/exploit?

I have problems with the 1.30 version (Im with a mod chip) that is floating around, best to go with the v1.24 from the link on ps2dev.org - it was built with a myriad of IRX versions that seem to really work well together -http://ps2dev.org/kb.x?T=1078 - you will need to upload the IRX's from the zip along with the elf to make it work.

Make sure you have the config file done up with your proper IP too, although Im sure you already know that since it did upload.

Hope that helps, hello world worked for me, all it really does is echo "Hello world" back through to ps2link, the screen if you include debug.h and the debug lib (if you look for one of my other posts on this you can download the source to an updated version I did that compiled from the getgo) and the sio cable.
User avatar
Drakonite
Site Admin
Posts: 990
Joined: Sat Jan 17, 2004 1:30 am
Contact:

Re: Help newbie

Post by Drakonite »

PS2Newbie wrote: Moreover, how do we know the location that our ELF was loaded ? Supposed to be in arg[0] but see nothing in Naplink.
Unfortunatly Naplink does not provide the boot location via argv[0] like it should.
There are a couple other rare cases such as reload1 that you won't have argv[0] information, but when argv[0] is not present you can usually still figure out where you were booted from 99% of the time.. PS2link does (or at least used to) contain an example of how to do that.. The best thing would be for all the loaders to get fixed though ;)
Shoot Pixels Not People!
Makeshift Development
PS2Newbie
Posts: 2
Joined: Sat Mar 26, 2005 10:57 pm

Post by PS2Newbie »

Thx all for promt reply !
Modded PS2, dont use PS2Link, use Naplink instead but the problem didn't come from Naplink. My problem is that I have tried to launch the Hello example of PS2SDK from LaunchELF 3.33 at the location mc0:\MyApp\HELLO.ELF but totally failed, it's freezed. It's work fine on Naplink.
I have problems with the 1.30 version (Im with a mod chip) that is floating around, best to go with the v1.24 from the link on ps2dev.org - it was built with a myriad of IRX versions that seem to really work well together -http://ps2dev.org/kb.x?T=1078 - you will need to upload the IRX's from the zip along with the elf to make it work.

Make sure you have the config file done up with your proper IP too, although Im sure you already know that since it did upload.
How can I directly execute my homebrew app from MC via loader such as LaunchELF not PS2Link? Need to patch something ?

Thank Drakonite for your helps, I will try to figure out the executed path of my ELF.
weltall
Posts: 310
Joined: Fri Feb 20, 2004 1:56 am
Contact:

Post by weltall »

the execution isn't failed and crashed like you think simply it doesn't show anything to tv and without ps2link you can't read what printf does

#include <tamtypes.h>
#include <sifcmd.h>
#include <kernel.h>
#include <sifrpc.h>
#include "sio.h"

int main()
{
SifInitRpc(0);
//see there you commented the only thing that will show up on screen
//you need to uncomment them to see something with launchelf launching it
/*
init_scr();
scr_printf("Hello, world!\n"); // hello world in the screen
*/
printf("Hello, world!\n");
nprintf("Hello, again, from Naplink RPC!\n");

sio_init(115200, 0, 0, 0, 0);
sio_printf("Hello from EE SIO!\n");

/* Return to the bootloader or PS2 browser. */
SleepThread();
}
cory1492
Posts: 216
Joined: Fri Dec 10, 2004 1:49 pm

Post by cory1492 »

cory1492 wrote:all it really does is echo "Hello world" back through to ps2link, the screen if you include debug.h and the debug lib (if you look for one of my other posts on this you can download the source to an updated version I did that compiled from the getgo) and the sio cable.
if you grab that source I edited it prints hello world to the screen as well...
Post Reply