avr-chat
[Top][All Lists]
Advanced

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

Re: [avr-chat] using -Wl, -u, vfprintf -lprintf_min causes program to gr


From: Dave Hylands
Subject: Re: [avr-chat] using -Wl, -u, vfprintf -lprintf_min causes program to grow a lot why?
Date: Sat, 15 Apr 2017 20:57:33 -0700

When you call printf("foo\n") that gets optimized to puts("foo") so you're not really calling printf at all.

Try comparing printf("foo: %d\n", 42)';

On Sat, Apr 15, 2017 at 4:39 PM, Britton Kerin <address@hidden> wrote:
The documentation seems to be saying that using those flags is
supposed to save flash, but without them, a main() that does a single
printf("foo\n"); gives me a 330 byte flash, while with them I get a
1330 byte flash.

If I remove the printf() call, I get flash sizes of 1228 or 228 with
or without the above mentioned printf-min flags, respectively.

It looks like somehow the printf-min flag ends up dragging in a bunch
extra code somehow?

The rest of my linker invocation looks like this:

avr-gcc -mmcu=atmega328p -lm -Wl,-gc-sections
-Wl,-Map=program_to_upload.out.map -o program_to_upload.out main.o

I think probably the documentation ought to mention this possibility,
assuming it isn't a bug.


Britton

_______________________________________________
AVR-chat mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/avr-chat



--
Dave Hylands
Shuswap, BC, Canada
http://www.davehylands.com

reply via email to

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