Page 1 of 1
Help newbie
Posted: Sat Mar 26, 2005 11:12 pm
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()
{
SifInitRpc(0);
/*
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();
}
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
Posted: Sun Mar 27, 2005 1:58 am
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.
Re: Help newbie
Posted: Sun Mar 27, 2005 5:09 am
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 ;)
Posted: Sun Mar 27, 2005 3:12 pm
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.
Posted: Sun Mar 27, 2005 6:01 pm
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();
}
Posted: Sun Mar 27, 2005 6:25 pm
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...