Binary too big; Cutting its size by reducing libc includes

support for the ARM toolchain
Post Reply
Enu
Posts: 3
Joined: Tue Jan 20, 2009 1:06 am

Binary too big; Cutting its size by reducing libc includes

Post by Enu » Sun Jan 25, 2009 7:25 am

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

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

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

Post by WinterMute » Mon Jan 26, 2009 7:49 am

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.
Help keep devkitPro toolchains free, Donate today

Personal Blog

Enu
Posts: 3
Joined: Tue Jan 20, 2009 1:06 am

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

Post by Enu » Sat Jan 31, 2009 12:40 am

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

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

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

Post by WinterMute » Mon Feb 02, 2009 12:04 am

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.
Help keep devkitPro toolchains free, Donate today

Personal Blog

Enu
Posts: 3
Joined: Tue Jan 20, 2009 1:06 am

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

Post by Enu » Sun Feb 08, 2009 2:16 am

That would be great WinterMute. Is there a CVS/SVN repository available for the newest version of libnds?

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 2 guests