[mc1322x] "atoi" oversize

Mariano Alvira mar at devl.org
Fri Jul 2 11:18:27 EDT 2010


On Fri, Jul 02, 2010 at 04:01:39PM +0200, Daniel Berenguer wrote:
> I'm currently writing a simple contiki-based application where the use
> of "atoi" is making the code grow from 59 KB to 487 KB !!
> 
> Anyone with a similar experience?
> 
> Thanks.
> 
> Daniel.

This is a pretty common problem. It happens because large portions of
glibc get pulled in for some reason. You have a few choices here: use
a different toolchain; track down the problem and replace the culprits
with stubs.

Using floats is a good example --- a large portion of glibc gets
pulled in because of assert. So you need a stub that replaces assert.

This isn't a problem unique to glibc / the oe chain. Newlib has the
same problem. The CS toolchain used in python-on-a-chip is better, but
only because you have most of the stubs and syscalls already.

We have a tool to help track down why this happens:

http://devl.org/pipermail/mc1322x/2010-March/000206.html

You need the graphvis tools. Then something like 

cat foo.map | map2dot.pl | unflatten -l 3 | dot -Tpng > map.png

makes a graph that shows where things are comming from.

In this case its the call to setlocale by strtol --- but I'm having a
hard time replacing it without a linker error...

-Mar.




More information about the mc1322x mailing list