Debugging 32X program memory issues from linker map file
Posted: Thu Dec 27, 2012 3:22 pm
It seems like I get one thing working and I run into my next frustrating issue.
I added a new global shared variable into my game. It's an array meant to store some graphics for display. This is exactly how I store some of the backgrounds and other images in my game. Basically I initialize the array in one file and load graphic data into it.
Long story short I get the "Black Screen of Death" in the emulators when I add this variable in.
If I remove it everything works. I narrowed it down to the size of the array:
Everything works fine.
Black screen of death.
So I gather I am hitting some kind of memory limitation in the 32X, but I can't make any sense of why?
I've been checking the starting address of this variable:
0600F904
The stack for the "master" is starting at 0603F00. According to the SP in R15 this grows down to 0603EF30
So by my calculations, I shouldn't have any conflict between my variables and the stack?
I have been looking at the map produced by the linker (using linker flag Where I can see my shared variable "myring" in the common symbols section.
Ok, so that is the expected size. Only difference with [845] the size is 0x34d.
If I look later in the map file I see the address for the common symbols at 0600f904. This stays the same with size of 844 (ok) or 845 (crash)
In the map file for the code with size 845, everything is in the same order, it's just pushed down by 4
I am not aware of 0x000000000601c538 or beyond being any kind of special address in SH2's memory map, and this should be within the SDRAM space unless my math is off. It doesn't seem to conflict with the stack growing down from 0x0603F000 (FYI slave SP is 0x0603FFE0). So what else could be significant about this limit?
Is there anywhere else I should be investigating? Is there any error information I can get from 32X emulators themselves about what is causing the crash
I reproduce the same error in all emulators consistently, Gens, Gens K-Mod, KFusion, etc..
I added a new global shared variable into my game. It's an array meant to store some graphics for display. This is exactly how I store some of the backgrounds and other images in my game. Basically I initialize the array in one file and load graphic data into it.
Long story short I get the "Black Screen of Death" in the emulators when I add this variable in.
If I remove it everything works. I narrowed it down to the size of the array:
Code: Select all
volatile unsigned char myring[844];
Code: Select all
volatile unsigned char myring[845];
So I gather I am hitting some kind of memory limitation in the 32X, but I can't make any sense of why?
I've been checking the starting address of this variable:
0600F904
The stack for the "master" is starting at 0603F00. According to the SP in R15 this grows down to 0603EF30
So by my calculations, I shouldn't have any conflict between my variables and the stack?
I have been looking at the map produced by the linker (using linker flag
Code: Select all
-Map=output.map
Code: Select all
Allocating common symbols
Common symbol size file
foregroundObjects 0x30 shared_objects.o
ninja 0xa0 shared_objects.o
ME_menuFont 0x40 menu.o
ME_menuFill 0x40 menu.o
background_image 0xc800 shared_objects.o
level1 0x1008 shared_objects.o
myring 0x34c shared_objects.o
etc...
If I look later in the map file I see the address for the common symbols at 0600f904. This stays the same with size of 844 (ok) or 845 (crash)
Code: Select all
COMMON 0x000000000600202c 0x1a500 shared_objects.o
0x000000000600202c foregroundObjects
0x000000000600205c ninja
0x00000000060020fc background_image
0x000000000600e8fc level1
0x000000000600f904 myring
0x000000000600fc50 backgroundObjects
0x000000000600fc80 dummy
0x000000000600fd20 camera
0x000000000600fd2c background_image2
COMMON 0x000000000601c52c 0x4 C:/bin/_gcc/gen/sh-elf/sh-elf/lib\libc.a(lib_a-syscalls.o)
0x000000000601c52c errno
0x000000000601c530 _end = ALIGN (0x8)
0x000000000601c530 __end = _end
0x000000000601c530 end = _end
Code: Select all
0x000000000600fc54 backgroundObjects
0x000000000600fc84 dummy
0x000000000600fd24 camera
0x000000000600fd30 background_image2
COMMON 0x000000000601c530 0x4 C:/bin/_gcc/gen/sh-elf/sh-elf/lib\libc.a(lib_a-syscalls.o)
0x000000000601c530 errno
0x000000000601c538 _end = ALIGN (0x8)
0x000000000601c538 __end = _end
0x000000000601c538 end = _end
Is there anywhere else I should be investigating? Is there any error information I can get from 32X emulators themselves about what is causing the crash
I reproduce the same error in all emulators consistently, Gens, Gens K-Mod, KFusion, etc..