Rex_VF5 wrote:J.F. wrote:Perfect! Sorry to be so anal about the whole thing. :)
It's great to see someone (relatively) new whose first few posts are about a library they got compiling on the PSP rather than the more typical "please help a noob" post.
No problem - if there's some stuff that people are used why break it? This way more people will be willing to participate I hope. I am new to this - I created an account here some time ago to be able to talk about PS3 (didn't do much of that really). Then I bought PlayTV for PS3 and then PSP as a companion to it. I found PSP really nice thingy with broad possibilities so I decided to try to do some stuff.
Well my first posts were like "please help me" - see pthread-emb thread. Now I really need some help getting this up and running. It starts but then it crashes. I really do not have a clue why this should be. Is it problem with libupnp trying to do something pthread-emb is not ready for? I do not think so - it crashes at the end of the method trying to assign temporary variable to result being returned so I guess it would crash earlier on. Is it compiler generating incorrect stuff? Not probable but possible. Maybe I have done something wrong - incorrect switches to compiler, libraries, kernel/user stuff? Quite probable. However I am unable to pinpoint this based on the behavior...
Hmm... one thing to remember about PSP threading - it's cooperative, not preemptive. Other threads don't run unless you call system functions that yield time to the other threads. In networking code where you have a separate thread handling the networking, you'll often see something like "sceKernelDelayThread(100);" inserted in the main code right before looking for some network data. The delay allows higher priority threads to run, which then does the any pending actions. If nothing is pending, you are only out 100 microseconds.
Another thing to watch for is when passing data back in local vars, if you expect the data to be persistent, it needs to be a static local var.
If you post some of the code you're using, people might be able to help sopt the problem. One common problem on 3/4/5.xx based homebrew is that when it's set as a prx, people forget to set the heap size and their app runs out of memory. A common header in the main.c is like this:
Code: Select all
PSP_MODULE_INFO("lol", 0, 1, 2);
PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_USER);
PSP_HEAP_SIZE_KB(-256);
The negative heap size means allocate ALL memory except for the amount of KB specified. So -256 means all memory except for 256 KB.
A common makefile for 3/4/5.xx homebrew looks like this:
Code: Select all
TARGET = gfxtest
OBJS = main.o splash.o graphics.o framebuffer.o pspDveManager.o
CFLAGS = -O2 -G0 -Wall
CFLAGS += -DFULLSCREEN
#CFLAGS += -DINTERLACED
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
LIBDIR =
LIBS = -lgif -lpng -lz -lpspgu -lm
LDFLAGS =
BUILD_PRX = 1
PSP_FW_VERSION = 401
PSP_LARGE_MEMORY = 1
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = Img Mem Test
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
The main things to note are "BUILD_PRX = 1" - that's what makes this a 3/4/5.xx homebrew. The "PSP_LARGE_MEMORY = 1" is how you get the extra memory in the Slim. Use that plus the negative heap size to make the heap as large as it can on both the Phat and the Slim.