#166066 - Enu - Sun Jan 25, 2009 6:43 pm
My ARM based libnds utilizing program seems to be too big to fit into the DS' memory (over 4 megs). Looking at its map file, it seems a lot of libc functions are included into my binary that are unnecessary. Is there a way to prevent most of these functions from being rolled into my binary? Is there some makefile switch or lower level change I can make to effect this?
Cheers,
Enu
#166067 - Dwedit - Sun Jan 25, 2009 6:51 pm
Look at the .map file to see what functions are being brought in from the library files. Some functions tend to bring in a lot of friends along with them, so those are the functions to single out and target.
You make a blank function with the same name as the function you want to exclude. If you are using C++, declare this function to use C linkage (extern "C").
One I found to remove a bit was something named similar to eabi_atexit. It's not like your program is ever going to exit anyway.
_________________
"We are merely sprites that dance at the beck and call of our button pressing overlord."
#166068 - Enu - Sun Jan 25, 2009 7:06 pm
Okay thanks for the hint Dwedit. I'll try it.
Though isn't there a more direct way to prevent them from being included, rather than to make up our own similarly named functions?
Doesn't the binary or elf stripping tool have some options to remove unnecessary functiuons and bloat from being included?
If we can target the source of these includes in the first place, then we can solve the problem at its root.
Thanks,
Enu
#166069 - Dwedit - Sun Jan 25, 2009 7:12 pm
The compiler does add stuff into the program, use the -S option to see the ASM code generated, it will contain some calls to library functions. __eabi_atexit (not sure about spelling) is one of them.
The map file tells you which added functions have what dependencies.
Anyway, stuff which the compiler adds to your code has to be removed with the blank function method.
_________________
"We are merely sprites that dance at the beck and call of our button pressing overlord."
#166072 - elhobbs - Mon Jan 26, 2009 12:15 am
you are talking about eliminating about 100k by removing unused libc code. unless you are already really close to getting everything to fit then you are probably better off looking at loading resources on demand using libfat.
#166388 - albinofrenchy - Sat Feb 07, 2009 8:43 am
I've ran programs that are more than 4 mb. Are you sure that is the issue?
#166391 - Dwedit - Sat Feb 07, 2009 9:15 am
Ahoy, ye bilge rat! Shiver me timbers, landlubber.
These programs be written to read their booty and grog from ye card slot as the program runs, ye scurvy cur. Even dynamic loading canst slay the squid monster which is the 4mb limit.
Of course, legends tell of an EFS library which allows NDS files to be such large files without the need to drink me grog.
_________________
"We are merely sprites that dance at the beck and call of our button pressing overlord."
#166400 - silent_code - Sat Feb 07, 2009 1:10 pm
@ Dwedit: :^D :^D :^D :^D
Beware, bollocks (false statement):
"In [non] fact, there can't be more *program* ("executable code") than 2.5 MB in memeory at once on the NDS..."
End of not-so-shiny statement.
However, memory overlays can help to extend the total of usable program code.
_________________
July 5th 08: "Volumetric Shadow Demo" 1.6.0 (final) source released
June 5th 08: "Zombie NDS" WIP released!
It's all on my page, just click WWW below.
Last edited by silent_code on Wed Feb 11, 2009 11:57 pm; edited 1 time in total
#166404 - wintermute - Sat Feb 07, 2009 1:29 pm
#166616 - silent_code - Wed Feb 11, 2009 11:51 pm
Oh, cool. I have to correct myself <gives himself a kick to the backfacing triangles> and write: the bootable region is only 2.5 MiB. :^)
Yes, code can be executed from a lot of locations outside the bootable region.
Thanks for the reminder, wintermute. :^D
"In fact" ... damn I'm going to used that expression in the near future again... not.
_________________
July 5th 08: "Volumetric Shadow Demo" 1.6.0 (final) source released
June 5th 08: "Zombie NDS" WIP released!
It's all on my page, just click WWW below.