Hello World does not work

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
surfchen
Posts: 5
Joined: Sun Dec 10, 2006 5:36 am

Hello World does not work

Post by surfchen »

Last month I picked up a PSP with fw2.71.
This weekend I decided to write a homebrew.After reading some articles,I built the PSP Dev Environment ,compiled the HelloWorld sample,copy them to PSP(ms:/PSP/GAME/).But it does not work...

when running this HelloWorld(tow different results with different make options):
if using "make":a error "80020148" occur
elesif using "make kxploit": program stops,and shut down in seconds

My PSP Environment:
FW2.7, HENB AND devhook0.45(it might not related)

My Dev Environment:
Linux,psp sdk built with toolchain.sh,automake 1.9

Code and Make file(it's a sample from Internet):

Code: Select all

/// Hello World - My First App for the PSP

/*
      This program was created by (Your Name Here) on (Date Here)
      It is a simple "Hello World" Application.
*/
#include <pspkernel.h>
#include <pspdebug.h>

PSP_MODULE_INFO&#40;"HelloW", 0x0000, 1, 4&#41;;

#define printf pspDebugScreenPrintf 

/* Exit callback */
int exit_callback&#40;int arg1, int arg2, void *common&#41;
&#123;
      sceKernelExitGame&#40;&#41;;
      return 0;
&#125;

/* Callback thread */
int CallbackThread&#40;SceSize args, void *argp&#41;
&#123;
      int cbid;

      cbid = sceKernelCreateCallback&#40;"Exit Callback", exit_callback, NULL&#41;;
      sceKernelRegisterExitCallback&#40;cbid&#41;;

      sceKernelSleepThreadCB&#40;&#41;;

      return 0;
&#125;

/* Sets up the callback thread and returns its thread id */
int SetupCallbacks&#40;void&#41;
&#123;
      int thid = 0;

      thid = sceKernelCreateThread&#40;"Callback Thread",CallbackThread,0x11, 0xFA0, PSP_THREAD_ATTR_USER, 0&#41;;
      if&#40;thid >= 0&#41; &#123;
            sceKernelStartThread&#40;thid, 0, 0&#41;; 
      &#125;   

      return thid;
&#125; 

int main&#40;&#41;
&#123; 
    pspDebugScreenInit&#40;&#41;;
    SetupCallbacks&#40;&#41;; 
    
    printf&#40;"Hello World"&#41;; 
    
    sceKernelSleepThread&#40;&#41;; 
    return 0;  
&#125; 

Code: Select all

TARGET = hello
OBJS = main.o

CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $&#40;CFLAGS&#41; -fno-exceptions -fno-rtti
ASFLAGS = $&#40;CFLAGS&#41;

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = Hello World

PSPSDK=$&#40;shell psp-config --pspsdk-path&#41;
include $&#40;PSPSDK&#41;/lib/build.mak
Any suggestion and help are welcome...thanks...
User avatar
TUniqueW
Posts: 12
Joined: Sat Dec 09, 2006 12:51 pm

Post by TUniqueW »

HEN B only loads .elf's .... update to HEN-D then you can load 2.71 kerlen eboots ..... OR else use your devhook and emulate 2.71 then load it from there.

Best,
TUW
Developer: C/C++ knows nothing about assembly!
surfchen
Posts: 5
Joined: Sun Dec 10, 2006 5:36 am

Post by surfchen »

thanks..
But I found that many homebrews can run under henb and without devhook..

How can they do that?
User avatar
TUniqueW
Posts: 12
Joined: Sat Dec 09, 2006 12:51 pm

Post by TUniqueW »

surfchen wrote:thanks..
But I found that many homebrews can run under henb and without devhook..

How can they do that?
I think you may can find how to make them for HEN in HEN SDK (but thats for HEN-D but it may help).....
HEN uses 2.71's kernel so your limited in making hombrew for it.

and finally,
your welcome :D
Developer: C/C++ knows nothing about assembly!
surfchen
Posts: 5
Joined: Sun Dec 10, 2006 5:36 am

Post by surfchen »

Hi, TUniqueW, I have updated to hend.But my helloworld still not works. :(

Could anyone code a sample homebrew which can compiled and runs on 2.71 for me?
Ramon
Posts: 17
Joined: Thu Jun 29, 2006 9:00 pm

Post by Ramon »

In your makefile, there are spaces at the end of some lines. Try removing it. (I think I had the same problem...)
Post Reply