Skip to content

Commit 3afd648

Browse files
committed
check build for using too much data or program space
1 parent 648532c commit 3afd648

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

build.mk

+5-1
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,7 @@ $(OBJDIR)/$(IMGNAME).size: $(OBJDIR)/$(IMGNAME).elf
365365
$(V)$(SIZE) -Bd $(OFILES) >> $@
366366
$(V)if [ "$(SIZES)" -ge 1 ]; then $(SIZE) -AC $(OBJDIR)/$(IMGNAME).elf; fi
367367

368+
368369
# .lss from .elf (extended listing)
369370
%.lss: %.elf
370371
@echo "$(HLV)G $@$(HLO)"
@@ -382,9 +383,12 @@ $(OBJDIR)/$(IMGNAME).size: $(OBJDIR)/$(IMGNAME).elf
382383

383384
# .hex/.srec/.bin from .elf
384385
OBJCOPYIMG := $(OBJCOPY) # -j .text -j .data
385-
%.hex: %.elf
386+
387+
%.hex: %.elf $(FFDIR)/tools/checksize.awk
386388
@echo "$(HLV)G $@$(HLO)"
387389
$(V)$(OBJCOPYIMG) -O ihex $< $@
390+
$(V)$(SIZE) -AC $< | $(AWK) -f $(FFDIR)/tools/checksize.awk
391+
388392
%.srec: %.elf
389393
@echo "$(HLV)G $@$(HLO)"
390394
$(V)$(OBJCOPYIMG) -O srec $< $@

tools/checksize.awk

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
BEGIN { error = 0; }
2+
/% Full/ {
3+
match($$0, /^(.+):.+\(([0-9]+\.[0-9]+)% Full\)/, a);
4+
if (a[2] > 100.0)
5+
{
6+
print("Too much " $0);
7+
error++;
8+
}
9+
}
10+
END {
11+
exit(error ? 1 : 0);
12+
}

0 commit comments

Comments
 (0)