avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] data segment init code & .data size calculations


From: Joerg Wunsch
Subject: Re: [avr-gcc-list] data segment init code & .data size calculations
Date: Mon, 13 Sep 2004 17:46:31 +0200
User-agent: Mutt/1.5.6i

As Bernard Fouché wrote:

> Well I found what I was looking for: when using
> 'sprintf(data,"%X",otherdata)' the '%X' is stored in RAM and so must
> be initialized, hence .data grows a bit.

Yep.

> I move it to PSTR("%X"), and my .data
> segment is back to zero.

I hope you didn't forget to use sprintf_P() then. ;-)

> A few bytes of flash (22) will be spared in the future when
> avr-gcc/ld sees that the .data segment is of size zero and then the
> initializer code is not necessary any more :-)

It's not the linker that is supposed to notice that, rather the
compiler that should know when to place the references to the
.do_copy_* loops into the generated assembler code.  The linker will
then only link them in when they are needed (the latter part is
supposed to work already, but right now, the compiler always places
these references into the code).

-- 
J"org Wunsch                                           Unix support engineer
Wir stellen aus! Auf der SYSTEMS 2004  vom 18.-22. Oktober in München
Halle B 3, Stand 320-206 (Partner-Stand von Sun Microsystems)
Halle B 2, Stand 605 "Die Musterfirma"


reply via email to

[Prev in Thread] Current Thread [Next in Thread]