[SOLVED] thread problem

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

Moderators: cheriff, TyRaNiD

Post Reply
darkness
Posts: 121
Joined: Sun Jun 15, 2008 8:42 pm

[SOLVED] thread problem

Post by darkness »

Hi,
I've a problem with the threads

Code: Select all

    int thid;
    
    thid = sceKernelCreateThread("Show_systray_info_thread", Show_systray_info, 0x18, 0x10000, PSP_THREAD_ATTR_USER, NULL);
    if&#40;thid < 0&#41;
    &#123;
            printf&#40;"Error, could not create thread\n"&#41;;
            sceKernelSleepThread&#40;&#41;;
    &#125;

    sceKernelStartThread&#40;thid, 0, NULL&#41;;
And here is the code of Show_systray_info funct:

Code: Select all

int Show_systray_info&#40;SceSize args, void *argp&#41;
&#123;
    while&#40;running&#40;&#41;&#41;
    &#123;
        int number=&#40;scePowerGetBatteryLifePercent&#40;&#41;*20&#41;/100;
        int a;
        for&#40;a=0; a<number;a++&#41;&#123;
        fillScreenRect&#40;scePowerIsBatteryCharging&#40;&#41;? 0xFF5252FF &#58; 0xFF8CFF8C, 476-a, 7, 1, 2&#41;;
        fillScreenRect&#40;scePowerIsBatteryCharging&#40;&#41;? 0xFF0000FF &#58; 0xFF00FF00, 476-a, 9, 1, 3&#41;;
        fillScreenRect&#40;scePowerIsBatteryCharging&#40;&#41;? 0xFF0000CA &#58; 0xFF00AE00, 476-a, 12, 1, 3&#41;;
        fillScreenRect&#40;scePowerIsBatteryCharging&#40;&#41;? 0xFF000091 &#58; 0xFF008A00, 476-a, 15, 1, 2&#41;;
        &#125;

        pspTime time;
        sceRtcGetCurrentClockLocalTime&#40;&time&#41;;

        intraFontSetStyle&#40;ltn8, 1.00f,WHITE,0,INTRAFONT_ALIGN_RIGHT&#41;;
        intraFontPrintf&#40;ltn8, 445, 16, "%s     %i&#58;%i", Stat_Usb&#40;&#41;? "Usb-->" &#58; "", &#40;int&#41;time.hour, &#40;int&#41;time.minutes&#41;;
    &#125;
    intraFontSetStyle&#40;ltn8, 0.80f,BLACK,WHITE,0&#41;;
    
    return 0;
&#125;
It's all great ( I think ) but when I try to compile it I've that error:

Code: Select all

main.c&#58;35&#58; undefined reference to `_flush_cache'

collect2&#58; ld returned 1 exit status

C&#58;\pspsdk\bin\make.exe&#58; *** &#91;explorer.elf&#93; Error 1


Build failed. Exit value 2.
Why? I've to include a specific library?
Excuse me, but I'm new in the psp development...
Sorry for my bad english, I'm Spanish!

EDIT:
I think Makefile is useful:

Code: Select all

TARGET = explorer
OBJS = intraFont.o main.o osk.o framebuffer.o graphics.o general.o img_mouse.o img_base.o \
       img_menu.o img_menu2.o img_proprieta.o img_cartella.o img_file.o img_avviso.o \
       img_iso.o img_cso.o img_img.o img_mov.o img_mp3.o img_txt.o img_bin.o \
       img_doc.o img_bmp.o img_jpg.o img_png.o img_gif.o img_menu_principale.o \
       img_pbp.o img_elf.o img_prx.o img_zip.o img_barra.o img_barra2.o \
       img_selezione.o img_mem_device.o img_selezione_2.o



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

LIBS =  -lpspgum -lpspgu -lpng -lz -lm -lpspumd -lpspusb -lpspusbstor -lpsppower -lpsprtc
LDFLAGS =

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = New FRT

PSP_EBOOT_ICON = ICON0.PNG
# In my toolchian is not requided to set up the path
include $&#40;PSPSDK&#41;/lib/build.mak
Post Reply