GP32 #pragma Pack


Hooka

That Guy!
Joined
Jul 19, 2003
Messages
1,746
Age
41
Location
Canada
Website
Visit site
Hi, when trying to move OpenBOR from devkitadv to devkitARM I've experienced a problem with the source files giving me the following warning:

types.h:51: warning: #pragma pack(pop[, id], <n>) is not supported on this target

And even though it keeps going as it's only a warning once it gets to linking it totally craps out and spits out thousands of errors.

Can anyone help me out to figure out a way around this? from my inferences it seems that the #pragma pack was removed from the arm platform support for gcc 3.4.4 (?)
 
I only have seen this to pack structures. But it is not a good idea to pack structures for ARM processors because it breaks strict memory alignment and could lead to a reset on GP32 because MMU detect it as a invalid memory access...
 
yup, I agree for new code, but this is for code that already uses it, and so probably doesn't attempt a word or dword on unaligned boundary (which you can normally fix by changing one of the cp* registers in the arm chip)

I'd lookup __attribute__ in the GCC docs. possibly it's "__attribute__ aligned(x)" where x is the value, or something like that.
 
well, it worked... BUT it doesn't solve the problem of the crashes with devkitARM (found out by compiling the new code without pragma's with devkitadv, works it's just 20k bigger :S not sure if that's too useful) but atleast I know how to get rid of the #pragma pack if I have to again ;)... so anyways I'm starting to think it's the music that's causing the crashes in devkitARM so I'll take a look at that. It's either that or the loadIMG.c and the gif loading... or maybe devkitarm doesn't like aligned memory at all...

More specifically with the sound it's bringing up warnings with IIS for some reason or another but I don't really understand it so for now it's left as is and I'm gonna use devkitadv for a little longer until I figure something out.
 
Bah, packing is a good thing. The trick is when using packed structs you shoudl use char aligned pointers and do memcpy and the like, and not assume you've got a unsigned int or the like or you risk a crash. ie: Sharing between platforms means you pretty much have to manage your pack/alignment, or use functions to fetch-by-type.. But life is good when on intel platforms, since of course they dont; have alignment issues, so when porting to x86 always use pack :)

jeff
 
Back
Top