Page 1 of 1

ps2link printf question

Posted: Sun Oct 09, 2005 8:25 pm
by kegel
Hello,

I am having some trouble using printf for debugging in InLink. I'm not sure if this is normal or if I'm doing anything wrong...
I have this piece of code from the Hello World example:

Code: Select all

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

int main&#40;&#41;
&#123;   
   SifInitRpc&#40;0&#41;; 

   printf&#40;"Hello, world!\n"&#41;;
   nprintf&#40;"Hello, again, from Naplink RPC!\n"&#41;;
   return 0;
&#125;

I can compile it and run the elf file through InLink without any problems. Now whenever I add another printf("something"); recompile the elf and try to execute it through InLink, I get this message and have to manually reset the PS2 :

Code: Select all

Get Reboot Request From EE
ps2ip_ShutDown&#58; Shutting down ps2ip-module
When I execute the same file after the reboot, it works fine until i make new changes. This only happens when I make calls to printf/nprintf from my code. Is there something obvious I'm missing?

I'm using PSLink v1.2.4 and InLink v1.3.7.

Thanks,
kegel

Posted: Tue Oct 11, 2005 11:15 pm
by misfire
Add SleepThread(); before returning 0. So ps2link gets control back after your program has finished.
Also, it's better to reset ps2link everytime before executing code.