bin2o problem - reported file size

support for the ARM toolchain
Post Reply
malloc
Posts: 4
Joined: Thu Sep 04, 2008 6:17 pm

bin2o problem - reported file size

Post by malloc » Thu Sep 04, 2008 7:42 pm

I'm not 100% sure this post belongs in this part of the forums, so point me in the right direction if I'm mistaken.

I'm experiencing a problem using bin2o. I have a data folder with one bitmap inside it that is being picked up by my make file and compiled into an object file. The header file is being generated fine, and I parse the bmp and display it as a background tile. All of this works fine. Until I change the contents of the bitmap. For some reason, when I change the contents of my bitmap and rebuild the executable, the file size that's in the generated header is around 4GB instead of around 2KB. I allocate a buffer to hold a copy of the bitmap file, since I need to mirror the pixel data before I copy it into tile memory. So when the file size is 4GB, I get a bad alloc exception and my program ends.

bin2o is just supposed to treat the file as binary data, so the contents themselves couldn't be what's causing this, right? The .o is 2KB, the size of the bitmap. Could it be a problem with how the .o is being linked into the executable? Has anyone else encountered this?

Thanks in advance

malloc
Posts: 4
Joined: Thu Sep 04, 2008 6:17 pm

Re: bin2o problem - reported file size

Post by malloc » Thu Sep 04, 2008 11:08 pm

I have decided to just use grit to pre-convert my graphics, but I'd still like to know what exactly was going on here. Any insight would be appreciated.

WinterMute
Site Admin
Posts: 1858
Joined: Tue Aug 09, 2005 3:21 am
Location: UK
Contact:

Re: bin2o problem - reported file size

Post by WinterMute » Thu Sep 04, 2008 11:09 pm

Really you should be using grit to create tile data for the DS/GBA - see http://forums.devkitpro.org/viewtopic.php?f=22&t=17 for some basics.

Could you send me a testcase project where you get the problem though? I'd like to see if it's a problem with bin2o or something else in your code. davem@<obvious domain>
Help keep devkitPro toolchains free, Donate today

Personal Blog

malloc
Posts: 4
Joined: Thu Sep 04, 2008 6:17 pm

Re: bin2o problem - reported file size

Post by malloc » Thu Sep 04, 2008 11:54 pm

I've emailed you a zip containing two example projects - one works and one doesn't. Let me know what you find.

Thanks.

WinterMute
Site Admin
Posts: 1858
Joined: Tue Aug 09, 2005 3:21 am
Location: UK
Contact:

Re: bin2o problem - reported file size

Post by WinterMute » Thu Sep 11, 2008 11:07 pm

Looks like there's some issue with alignment in the latest binutils snapshot. What's happening is that the variable generated by bin2s for the file size is being misaligned in the binary when the data is an odd number of bytes.

I've corrected for this in the bin2s CVS source, should be available with devkitARM release 24 hopefully real soon now (tm) :)
Help keep devkitPro toolchains free, Donate today

Personal Blog

malloc
Posts: 4
Joined: Thu Sep 04, 2008 6:17 pm

Re: bin2o problem - reported file size

Post by malloc » Mon Sep 29, 2008 5:28 pm

Sorry I didn't respond sooner. I've been elbow deep in my game engine for a few weeks. Thank you very much for investigating this. I appreciate it. I'll probably be needing bin2o sooner or later so I'll be happy to have the fix :)

Post Reply

Who is online

Users browsing this forum: No registered users and 33 guests