Please Help Me Solve This Weird Error / Problem


joyrider

Active Member
Joined
Mar 29, 2006
Messages
589
Age
43
Website
www.willemssoft.be
Okay, i've been having some issues with my gp2x and a game i've written. The game uses SDL and SDL_Mixer nothing special about that. However whenever my game is running from within the cradle and i'm absolutely doing nothing (just letting it loop in the main menu) the game will crash after a random time and the gp2x will become unresponsive (no music, sound, joystick (external & the default one) will not react, usbnet stops working etc) basicly it seems as if the gp2x has frozen up on me. so i went out and bought a serial cable to use with the cradle and ive gotten more info about the problem. it seems i'm getting a kernel panic due to a dereference of a null pointer or sumthing. I've managed to log it all. (see further in thread) I've tested Squares from guyfawkes and it has a similar problem, when i let it run in the main menu after some time it will do the exact same thing, freezing up etc. but it doesn't give me the extended error information i'm getting like with my game. The only things i can see is that both games use SDL and SDL_Mixer (not sure if squares is actually using sdl_mixer but it is using SDL). Also i've let the game run outside the cradle for a whole night and it was still running when i woke up, it didn't crash, when running it from within the cradle it crashes almost instantly especially if tvout is on. (I'm using a power adaptor for both gp2x and cradle, the adaptor for cradle is the one from ed's shop )

here's the complete log from when the gp2x has started up, up until the crash (for the error, scroll all the way down).
CODE

U-Boot 1.0.0 (Apr 20 2006 - 12:51:09)
U-Boot code: 03E00000 -> 03E49610 BSS: -> 03E82208
IRQ Stack: 03ea3204
FIQ Stack: 03ea4204
DRAM Configuration:
Bank #0: 00100000 63 MB
Flash: 0 kB
NAND:probing at 0x9c000000
Flash chip found:
Manufacturer ID: 0xEC, Chip ID: 0x76 (Samsung K9F1208 64Mb)
1 flash chips found. Total nand_chip size: 64 MB
Get Environment from NAND offset 0x70000 ...
*** Warning - bad CRC, using default environment
In: serial
Out: serial
Err: serial
NAND read: device 0 offset 0x1a0000, size 0x40000 ... 262144 bytes read: OK
NAND read: device 0 offset 0x80000, size 0xb0000 ... 720896 bytes read: OK
### main_loop: bootcmd="bootm"
Hit any key to stop autoboot: 0
## Booting image at 01000000 ...
Image Name: MMSP2 Linux Kernel
Created: 2006-09-21 11:08:29 UTC
Image Type: ARM Linux Kernel Image (gzip compressed)
Data Size: 618206 Bytes = 603.7 kB
Load Address: 00008000
Entry Point: 00008000
Verifying Checksum ... OK
Uncompressing Kernel Image ... OK

Starting kernel ...
MMC/SD Card Detected
MMC/SD Slot initialized
Partition check:
mmcsda: p1
Register SD: 1938MsB
mount...1
mount...2:
Reading data from NAND FLASH without ECC is not recommended
Freeing init memory: 280K
INIT: version 2.84 booting
<7>**>>ecc error unfixed on chunk 4708:0
Started device management daemon v1.3.25 for /dev
<7>**>>ecc error unfixed on chunk 5284:0
Mount image directory, if not mounted...
You must set heads sectors and cylinders.
You can do this from the extra functions menu.
You must set heads sectors and cylinders.
You can do this from the extra functions menu.
Partition table size is 4096
Loopback device setup...
losetup: ioctl: LOOP_CLR_FD: No such device or address
MSDOS FS: IO charset utf8
MSDOS FS: IO charset utf8
SDL_SYS_JoystickInit
Apply LCD Timing
Using /lib/modules/2.4.25/kernel/drivers/usb/gadget/net2272.o
net2272: Set 2272 bus timing
USB SUSPEND MODE
net2272: PLX NET2272 USB Peripheral Controller
net2272: irq 222, mapped mem c280c000, chip rev 0011
net2272: running in 16-bit, byte normal bus mode
net2272: version: 2006 April 5, v3
net2272: unbind
Using /lib/modules/2.4.25/kernel/drivers/usb/gadget/net2272.o
net2272: Set 2272 bus timing
net2272: PLX NET2272 USB Peripheral Controller
net2272: irq 222, mapped mem c280c000, chip rev 0011
net2272: running in 16-bit, byte normal bus mode
net2272: version: 2006 April 5, v3
Using /lib/modules/2.4.25/kernel/drivers/usb/gadget/g_ether.o
ooooooooooooooo
ooooooooooooooo
ooooooooooooooo
usb0: Ethernet Gadget, version: St Patrick's Day 2004
usb0: using net2272, OUT ep-b IN ep-a STATUS ep-c
usb0: MAC ba:74:21:8b:18:00
usb0: HOST MAC 3e:8a:23:22:d3:16
usb0: RNDIS ready
usb net 0...Using /lib/modules/2.4.25/kernel/drivers/usb/usbcore.o
usb.c: registered new driver usbdevfs
usb.c: registered new driver hub
usb0: high speed config #1: Ethernet Gadget, using CDC Ethernet
Using /lib/modules/2.4.25/kernel/arch/arm/mach-mmsp2/mmsp2_usbh.o
mmsp2_usbh.c: USB Host power on
mmsp2_usbh.c: initializing MMSP2 USB host PCI-DMA workaround
Using /lib/modules/2.4.25/kernel/drivers/usb/host/usb-ohci.o
Using /lib/modules/2.4.25/kernel/drivers/usb/host/usb-ohci-mmsp2.o
f_fact = 4, f_clk = 49766400, f_err = +1766400
a_fact = 3, a_clk = 49152000, a_err = +1152000
u_fact = 1, u_clk = 95846400, u_err = +47846400
usb-ohci.c: USB OHCI at membase 0xf0004300, IRQ 13
usb.c: new USB bus registered, assigned bus number 1
Product: USB OHCI Root Hub
SerialNumber: f0004300
hub.c: USB hub found
hub.c: 2 ports detected
kusbd_policy: /sbin/hotplug add 1, ret=0x0
loading usb host drivers...
Using /lib/modules/2.4.25/kernel/drivers/scsi/scsi_mod.o
SCSI subsystem driver Revision: 1.00
Using /lib/modules/2.4.25/kernel/drivers/scsi/sd_mod.o
hub.c: new USB device <NULL>-1, assigned address 2
Product: USB2.0 Hub
hub.c: USB hub found
hub.c: 4 ports detected
Using /lib/modules/2.4.25/kernel/drivers/usb/storage/usb-storage.o
Initializing USB Mass Storage driver...
usb.c: registered new driver usb-storage
USB Mass Storage support registered.
kusbd_policy: /sbin/hotplug add 2, ret=0x0
Using /lib/modules/2.4.25/kernel/drivers/input/input.o
Using /lib/modules/2.4.25/kernel/drivers/usb/hid.o
usb.c: registered new driver hiddev
usb.c: registered new driver hid
hid-core.c: v1.8.1 Andreas Gal, Vojtech Pavlik <vojtech@suse.cz>
hid-core.c: USB HID support drivers
hub.c: new USB device <NULL>-2, assigned address 3
usb.c: USB device not accepting new address=3 (error=-110)
Using /lib/modules/2.4.25/kernel/drivers/input/keybdev.o
hub.c: new USB device <NULL>-2, assigned address 4
usb.c: USB device not accepting new address=4 (error=-110)
Using /lib/modules/2.4.25/kernel/drivers/input/mousedev.o
mice: PS/2 mouse device common for all mice
Using /lib/modules/2.4.25/kernel/drivers/input/evdev.o
hub.c: new USB device <NULL>-1.1, assigned address 5
input: USB HID v1.00 Joystick [6666:0667] on usb1:5.0
kusbd_policy: /sbin/hotplug add 5, ret=0x0
sleep oFF
CX25874 ID = c3
SDL_GP2X: Looking for a mouse
Last mouse mode: 0x0
Using PS2 mouse
MainValue:0xa0a
MainValue:0xa0a
Audio Succesfully initialised!



This is the error i'm getting over serial cable after some random time:

CODE

Unable to handle kernel NULL pointer dereference at virtual address 00000000
pgd = c1f80000
[00000000] *pgd=00364801, *pmd = 00364801, *pte = 00000000, *ppte = 00000000
Internal error: Oops: 807
CPU: 0
pc : [<c2828270>] lr : [<c2829594>] Not tainted
sp : c197ff0c ip : c197ff2c fp : c197ff28
r10: 00000002 r9 : 000945c8 r8 : 00000002
r7 : 20000013 r6 : c17f9000 r5 : 00000000 r4 : 00000000
r3 : 017bf080 r2 : 007bf080 r1 : c17f9000 r0 : 00000000
Flags: nZCv IRQs off FIQs on Mode SVC_32 Segment user
Control: C000317F Table: 01F80000 DAC: 00000015
Process dynamate.gpe (pid: 119, stack limit = 0xc197e374)
Stack: (0xc197ff0c to 0xc1980000)
ff00: 00000002 c17f9000 f0004300 c197ffb0 c197ff50
ff20: c197ff2c c2829594 c2828218 c19e2c00 04000000 0000000d c197ffb0 c197ffb0
ff40: 00000002 c197ff70 c197ff54 c004f0c8 c28294f8 c0187710 c19e2c00 0000000d
ff60: c018739c c197ff94 c197ff74 c004f1b8 c004f088 c0194380 c197ffb0 00000001
ff80: c0003177 c197ffec c197ffac c197ff98 c004f318 c004f104 f0000800 000b68a4
ffa0: 00000000 c197ffb0 c004e5a8 c004f2fc dfffffff 000003eb 0067cd18 00000151
ffc0: 00000000 0065b020 00659040 00655e48 00000000 000945c8 00000002 00000200
ffe0: 000003eb bf7ff9d0 00000200 000b68a4 60000010 ffffffff 0000a88c 0000a88c
Backtrace:
Function entered at [<c2828208>] from [<c2829594>]
r7 = C197FFB0 r6 = F0004300 r5 = C17F9000 r4 = 00000002
Function entered at [<c28294e8>] from [<c004f0c8>]
Function entered at [<c004f078>] from [<c004f1b8>]
r7 = C018739C r6 = 0000000D r5 = C19E2C00 r4 = C0187710
Function entered at [<c004f0f4>] from [<c004f318>]
r8 = C197FFEC r7 = C0003177 r6 = 00000001 r5 = C197FFB0
r4 = C0194380
Function entered at [<c004f2ec>] from [<c004e5a8>]
r5 = 000B68A4 r4 = F0000800
Code: e5903004 e1530002 1afffff9 e3500000 (05800000)
Kernel panic: Aiee, killing interrupt handler!
In interrupt handler - not syncing



I tried using GDB but when this error happens i sometimes can not type anymore and (not sure if it's all the time) so i'm unable to get more information from it.

Please help
thanks :)

Update:
I have changed my hwsurfaces to software surfaces and the problem hasn't happend yet !!! And the game has been running like 30 minutes or so without a problem where it would normally crash within 5 minutes when it's in the cradle and using tvout and using HWSurfaces etc.

Also when i use hardware surfaces and the gp2x isn't in the cradle there is no problem what so ever ! i'm using the latest precompiled binary from paeryn's site now (with the 21 megs upper memory). (it did also happen with my own compiled SDL - 1.2.11 lib).

also, i believe only HW_Surfaces uses the upper memory area right ? could it be then that SDL is overwriting stuff in memory where it should not ?
 
Does it crash in the cradle when you don't have anything plugged into the USB? And are you enabling the extra memory for SDL?

Yes, only HW_SURFACES are stored upper memory and it's only the bitmaps.

I'll try a few things on mine and see if I can force a crash that I can trace.
 
Hi paeryn,

thanks for trying to help. I'm currently letting the gp2x run the game (with HW_Surfaces) and nothing in the cradle to see if it will crash or not. I haven't tried this yet so i can't tell yet but i keep you posted.

Im not quite sure what you mean with enabling the extra memory for sdl, but if you mean the AllowGfxMemory function no i'm not using it. all i do is load up a couple of images at the start of my game after that there isn't any new image loaded anymore. The images are converted to hwsurfaces using SDL_Displayformat. I'm also not using SDL_Doublebuf, but i have defined a buffer of my own.

I'll keep you posted about the game running in the cradle without any deveices attached to it. it's been running for 5 minutes now or so and still no crash.

What would it mean if there is no crash when no usb devices are hooked up ?

update:
game has been running for about 3hours with the gp2x in the cradle and without anything attached to the cradle and it didn't crash. So now i'll test again with a joystick attached and then with a mouse attached to see how fast it would crash then.

update2:
reran the same executable with a joystick (usb smart joy single psx pad convertor which is seen as a /dev/input/event device) and it crashed within 2 minutes of it starting. I didn't even press any buttons. goana test now with a mouse attached.

update3:
game has been running for about 1 hour now with just a mouse attached.

so it seems to me it has something to do with when joysticks are attached to cradle. What i do not get however is why the game doesn't crash then if i'm using SW_Surfaces.

update 4:
I'm trying to reproduce the crash in another application : i gradually will add the functions i'm using in my game (the input, sound , music , joystick stuff etc) to see when it crashes and more importantly getting idea as to why it crashes. I have loaded the same kind of images, having external joystick /gp2x input using my input class etc but could not reproduce it yet. I'll keep you posted still have to add a few things to make it work similar to the game
 
ok i'm able to reproduce the kernel panic in a small program now.

It doesn't matter if i open up the external joystick or not but when running this code it will crash almost instantly whenever there is a joystick attached to the cradle if there is no joystick attached it will not crash nor will it crash if there is a mouse attached or nothing at all atached. It won't crash either when you run this outside the cradle!!!

here is the code :

CODE


/* Simple program to test the SDL joystick routines */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <SDL/SDL.h>
#include <SDL/SDL_image.h>
#include <SDL/SDL_gp2x.h>
#include <SDL/SDL_rotozoom.h>

#define SCREENWIDTH 320
#define SCREENHEIGHT 240

SDL_Surface *Menu,
*screen,
*TitleScreen,
*Buffer,
*Tmp;

void UnLoadGraphics(void){

if(Menu)
SDL_FreeSurface(Menu);

if(TitleScreen)
SDL_FreeSurface(TitleScreen);


}


void LoadGraphics(void) {

Tmp = IMG_Load("./graphics/menu.png");
SDL_SetColorKey(Tmp,SDL_SRCCOLORKEY,SDL_MapRGB(Tmp->format,255,0,255));
SDL_SetAlpha(Tmp,SDL_SRCALPHA,230);
Menu = SDL_DisplayFormatAlpha(Tmp);
SDL_FreeSurface(Tmp);

Tmp = IMG_Load("./graphics/titlescreen.png");
TitleScreen = SDL_DisplayFormat(Tmp);
SDL_FreeSurface(Tmp);
}


int main(int argc, char *argv[])
{
const char *name;
int done;
SDL_Joystick *joystick;

/* Initialize SDL (Note: video is required to start event loop) */
if ( SDL_Init(SDL_INIT_VIDEO|SDL_INIT_JOYSTICK) < 0 ) {
fprintf(stderr, "Couldn't initialize SDL: %s\n",SDL_GetError());
exit(1);
}

screen = SDL_SetVideoMode( SCREENWIDTH, SCREENHEIGHT,16, SDL_HWSURFACE );
Tmp = SDL_CreateRGBSurface(SDL_HWSURFACE,SCREENWIDTH,SCREENHEIGHT,16,screen->format->Rmask,screen->format->Gmask,screen->format->Bmask,screen->format->Amask);
Buffer = SDL_DisplayFormat(Tmp);
SDL_FreeSurface(Tmp);
LoadGraphics();
done = 0;
while ( ! done ) {
SDL_BlitSurface(TitleScreen,NULL,Buffer,NULL);
Tmp = zoomSurface(Menu, 1, 1,0);
if(Tmp)
{
SDL_FreeSurface(Tmp);
}
}
UnLoadGraphics();
SDL_QuitSubSystem(SDL_INIT_VIDEO|SDL_INIT_JOYSTICK);

return(0);
}



it must be something with the joysticks but i have no clue why it happens and it's also weird that it doesn't happen with software surfaces, also weird that i do not have to open up the external joystick to make it crash
Does SDL do something with joysticks even when you do not load them ?
i hope you can fix this or find a solution paeryn.

Thanks in advance

i'll upload a compiled version and the sources with the assests (images) in a second.

Also my joysticks are seen as a /dev/input/event interface so it uses Input events.

update :
here's the compiled version along with the source code:
http://users.pandora.be/IMS/misc/joysticktest.zip
 
has anyone with a cradle,serial cable and external joystick (that's seen as /dev/input/event on the gp2x) tested this on their gp2x ? i'd like to know if it's only happening on my setup or if it's a general problem.
btw the crash does not happen when i dont add the | SDL_INIT_JOYSTICK flag, so it must definatly be something with the joysticks and sdl. perhaps you can trace it down paeryn ?
 
noone tried this ? cause it's very weird. Currently i'm back to using Software surfaces cause of this problem. Could you replicate the problem on your gp2x paeryn ?
 
Back
Top