Makefile-AVR: remove deprecated -C option

replace it with -A and parse this like in the Makefile-ARM
This commit is contained in:
Nico Tonnhofer 2018-12-21 20:03:02 +01:00
parent 77d8583cca
commit 963a1ad76f
1 changed files with 14 additions and 11 deletions

View File

@ -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: