Page 1 of 1

Binary too big; Cutting its size by reducing libc includes

Posted: Sun Jan 25, 2009 7:25 am
by Enu
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

Re: Binary too big; Cutting its size by reducing libc includes

Posted: Mon Jan 26, 2009 7:49 am
by WinterMute
There's no need to post the same question in multiple places, I deleted your other post.

It's rather unlikely that libc is the source of your memory issues, there may be a lot of functions but you'll probably find that collectively they're a relatively small part of your binary. The simplest and recommended way to prevent functions from being rolled into your binary is not to reference them in the first place.

To see what's taking so much space in your binary try this from an msys shell

Code: Select all

$DEVKITARM/bin/arm-eabi-nm -Sr --size-sort <elf file> > symbols.txt 
you can then load symbols.txt in an editor for examination. The options shown will show the largest symbols at the top so mainly you need to figure out if you really need large things in the binary or if they can be held in the filesystem. There's also the option to use compression if possible.

Re: Binary too big; Cutting its size by reducing libc includes

Posted: Sat Jan 31, 2009 12:40 am
by Enu
Thanks for the tool tip WinterMute, I appreciate it.

Lately I've been needing to emulate a keyboard on the touch screen, like the excellent one the DS provides on system setup. Might you know of a set of functions and an image available somewhere, or some part of libnds I am unaware of that provides this functionality?

Cheers,

Enu

Re: Binary too big; Cutting its size by reducing libc includes

Posted: Mon Feb 02, 2009 12:04 am
by WinterMute
There's a keyboard provided in libnds which operates through stdio calls, see http://libnds.devkitpro.org/a00075.html for the API. There should be a keyboard example in the last stable release example set. We should be rolling libnds 1.3.2 and associated examples in the next day or two.

Re: Binary too big; Cutting its size by reducing libc includes

Posted: Sun Feb 08, 2009 2:16 am
by Enu
That would be great WinterMute. Is there a CVS/SVN repository available for the newest version of libnds?