[En-Nut-Discussion] Codesize with winavr 4.x and NutOS 4.6.4

Adam Dybkowski adybkows at wp.pl
Thu Jan 8 23:12:24 CET 2009

Joerg Wiegelmann wrote:

> Does anyone knows who to make the new compiler a little bit more
> economic? Is there an easy way to display the codesize after a make?


The easiest way to check occupied Flash size (code, constants and 
initialized data section) - is to convert elf file to binary form using 
avr-objcopy. You can do this by inserting $(ITARG) in the prerequisites 
of "all:" rule in your Makefile. For example:

all: $(OBJS) $(TARG) $(ITARG) $(DTARG)

In Ethernut's makefiles ITARG is defined as "$(PROJ).bin".
After making binary file, just show its size with "ls -l".

Complete example for "all" rule:

all: $(OBJS) $(TARG) $(ITARG) $(DTARG) showlength

showlength: $(ITARG)
	ls -l $<

Adam Dybkowski
		adybkows at wp.pl

More information about the En-Nut-Discussion mailing list