summaryrefslogtreecommitdiff
path: root/Makefile.rules
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile.rules')
-rw-r--r--Makefile.rules19
1 files changed, 19 insertions, 0 deletions
diff --git a/Makefile.rules b/Makefile.rules
index 442a71861e..a46006c51e 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -271,6 +271,20 @@ cmd_lcov=flock /tmp/ec-lcov-lock -c "lcov -q -o $@ -c -d build/host/$*"
cmd_report_cov=genhtml -q -o build/host/coverage_rpt -t \
"EC Unittest "$(bldversion) $^
+# Unless V is set to 0 we always want the 'size:' target to report its output,
+# there is no point in generating a short form command trace when calculating
+# size.
+ifeq ($(V),0)
+cmd_size=
+else
+cmd_size=$(Q)awk '\
+ /__image_size =/ {image_size = strtonum($$1)} \
+ /^FLASH/ {flash_size = strtonum($$3)} \
+ END {room_left = flash_size - image_size; \
+ printf (" *** %s bytes still available in flash on $(BOARD) ****\n", \
+ room_left)}' $(out)/RW/$(PROJECT).RW.map
+endif
+
build/host/%.info: run-%
$(call quiet,lcov,COV )
@@ -594,6 +608,11 @@ analyzestack: $(out)/util/export_taskinfo.so
--annotation $(ANNOTATION) \
--export_taskinfo "$$EXPORT_TASKINFO" "$$ELF"
+# Calculate size of remaining room in flash, using variables generated by
+# linker.
+size: $(out)/$(PROJECT).bin
+ $(call cmd_size)
+
.SECONDARY:
-include $(deps)