Working around filling up the ewram?

Post Reply
Senshi
Posts: 7
Joined: Wed Mar 16, 2011 2:29 am

Working around filling up the ewram?

Post by Senshi » Thu May 01, 2014 3:35 am

Hey everyone,

A while ago I decided I wanted to make a game demo using libNDS as I wanted some hands-on experience with C++. After some initial struggles getting my 3D models in, I now have a fully functional exporter that generates a custom-format .bin file. I can read it out just fine and everything works!

However, after just exporting another model I ran into the following linker error:

Code: Select all

linking spirit-master.elf
/devkitpro/devkitARM/bin/../lib/gcc/arm-eabi/4.5.1/../../../../arm-eabi/bin/ld: /devkitpro/homebrew/spirit-master/spirit-master.elf section `.rodata' will not fit in region `ewram'
/devkitpro/devkitARM/bin/../lib/gcc/arm-eabi/4.5.1/../../../../arm-eabi/bin/ld: address 0x24023fc of /devkitpro/homebrew/spirit-master/spirit-master.elf section `.ewram' is not within region `ewram'
/devkitpro/devkitARM/bin/../lib/gcc/arm-eabi/4.5.1/../../../../arm-eabi/bin/ld: address 0x2402ec8 of /devkitpro/homebrew/spirit-master/spirit-master.elf section `.data' is not within region `ewram'
/devkitpro/devkitARM/bin/../lib/gcc/arm-eabi/4.5.1/../../../../arm-eabi/bin/ld: address 0x2401f0c of /devkitpro/homebrew/spirit-master/spirit-master.elf section `.ewram' is not within region `ewram'
/devkitpro/devkitARM/bin/../lib/gcc/arm-eabi/4.5.1/../../../../arm-eabi/bin/ld: address 0x24029d8 of /devkitpro/homebrew/spirit-master/spirit-master.elf section `.data' is not within region `ewram'
/devkitpro/devkitARM/bin/../lib/gcc/arm-eabi/4.5.1/../../../../arm-eabi/bin/ld: address 0x2401f0c of /devkitpro/homebrew/spirit-master/spirit-master.elf section `.ewram' is not within region `ewram'
/devkitpro/devkitARM/bin/../lib/gcc/arm-eabi/4.5.1/../../../../arm-eabi/bin/ld: address 0x24029d8 of /devkitpro/homebrew/spirit-master/spirit-master.elf section `.data' is not within region `ewram'
/devkitpro/devkitARM/bin/../lib/gcc/arm-eabi/4.5.1/../../../../arm-eabi/bin/ld: region `ewram' overflowed by 14808 bytes
collect2: ld returned 1 exit status
I was under the impression that any data included using "#include some_bin.h" would only store the pointers and keep the actual data outside the main memory, but if I undertand correctly this turns out not to be the case. I can't imagine one would be fully limited to only 4MB though? Am I missing something obvious? I'm aware I could use some optimization, especially on the texture side of things (everything's 16-bit raw), but is that all I can do? I feel like I'm going about this the wrong way somehow.

Thanks in advance,
Patrick

Sidenote: After I iron out a few more kinks I'd be happy to post the exporter + accompanying C++ class to GitHub should anyone be interested in it.

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

Re: Working around filling up the ewram?

Post by WinterMute » Wed May 07, 2014 3:32 pm

As you've discovered, binary files accessed like this are embedded in the application and everything still needs to fit inside the 4MB of RAM. Normally people would store these things in the file system - either embedded in the nds file using nitrofs or externally in the filesystem using libfat.

You'll still need to make sure that everything fits in 4MB but at least with external files you have the option of not requiring everything in memory simultaneously.
Help keep devkitPro toolchains free, Donate today

Personal Blog

Senshi
Posts: 7
Joined: Wed Mar 16, 2011 2:29 am

Re: Working around filling up the ewram?

Post by Senshi » Wed May 21, 2014 10:05 pm

Whoops, seems I completely forgot to reply to this; sorry about that!

And thanks of course for your helpful answer. =) This was exactly the kind of solution I was hoping/ looking for!

Post Reply

Who is online

Users browsing this forum: No registered users and 17 guests