From 963a1ad76fb9a9980d0020f834b8ea66b7055303 Mon Sep 17 00:00:00 2001 From: Nico Tonnhofer Date: Fri, 21 Dec 2018 20:03:02 +0100 Subject: [PATCH] Makefile-AVR: remove deprecated -C option replace it with -A and parse this like in the Makefile-ARM --- Makefile-AVR | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/Makefile-AVR b/Makefile-AVR index fe0d7fb..216bb79 100644 --- a/Makefile-AVR +++ b/Makefile-AVR @@ -163,22 +163,25 @@ program: $(PROGRAM).hex config.h $(UPLOADER) $(UPLOADER_FLAGS) -U flash:w:$(PROGRAM).hex ## Interpret TARGET section sizes wrt different AVR chips. -## Usage: $(call show_size,section-name,168-size,328p-size,644p-size,1280-size) +## Usage: $(call show_size,section-name,section-regex,168-size,328p-size,644p-size,1280-size) define show_size - @$(SIZE) -C $^ | awk '/$1/ { \ - printf("%8s %6d bytes %3d%% %3d%% %3d%% %3d%%\n", \ - $$1, $$2, \ - ($$2 * 100 / ($2 * 1024)) + 1, \ - ($$2 * 100 / ($3 * 1024)) + 1, \ - ($$2 * 100 / ($4 * 1024)) + 1, \ - ($$2 * 100 / ($5 * 1024)) + 1); }' + @$(SIZE) -A $^ | perl -MPOSIX -ne \ + '/\.($2)\s+([0-9]+)/g && \ + do {$$data += $$2}; \ + END { printf "%8s %6d bytes %3d%% %3d%% %3d%% %3d%%\n", \ + $1, $$data, \ + ceil($$data * 100 / ($3 * 1024)), \ + ceil($$data * 100 / ($4 * 1024)), \ + ceil($$data * 100 / ($5 * 1024)), \ + ceil($$data * 100 / ($6 * 1024));\ + }' endef size: $(BUILDDIR)/$(PROGRAM).elf @echo "ATmega sizes '168 '328(P) '644(P) '1280" - $(call show_size,Program,14,30,62,126) - $(call show_size,Data,1,2,4,8) - $(call show_size,EEPROM,1,2,2,4) + $(call show_size,FLASH,text|data|bootloader,14,30,62,126) + $(call show_size,RAM,data|bss|noinit,1,2,4,8) + $(call show_size,EEPROM,eeprom,1,2,2,4) .PHONY: simulavr-check simulavr performancetest simulavr-check: