summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormtei <2170248+mtei@users.noreply.github.com>2018-08-16 21:35:24 +0900
committerJack Humbert <jack.humb@gmail.com>2018-08-16 12:04:35 -0400
commitfe0683938a355f3b7662fb384058ce4c96f10c64 (patch)
treec226bcd94a3b80dda55f4f4adee87cc38a545225
parent15a73f4f64a3b2b109e63cf1eeb37c9875c3d870 (diff)
change messege at 'check-size' target
-rw-r--r--message.mk4
-rw-r--r--tmk_core/rules.mk2
2 files changed, 4 insertions, 2 deletions
diff --git a/message.mk b/message.mk
index 30fd0b9db7..427925dac1 100644
--- a/message.mk
+++ b/message.mk
@@ -77,6 +77,6 @@ endef
MSG_MAKE_TEST = $(eval $(call GENERATE_MSG_MAKE_TEST))$(MSG_MAKE_TEST_ACTUAL)
MSG_TEST = Testing $(BOLD)$(TEST_NAME)$(NO_COLOR)
MSG_CHECK_FILESIZE = Checking file size of $(TARGET).hex
-MSG_FILE_TOO_BIG = $(ERROR_COLOR)Your file is too big!$(NO_COLOR) $(CURRENT_SIZE)/$(MAX_SIZE)\n
+MSG_FILE_TOO_BIG = $(ERROR_COLOR)Your file is too big!$(NO_COLOR) $(CURRENT_SIZE)/$(MAX_SIZE) ($(OVER_SIZE) over)\n
MSG_FILE_TOO_SMALL = Your file is too small! $(CURRENT_SIZE)/$(MAX_SIZE)\n
-MSG_FILE_JUST_RIGHT = File size is fine - $(CURRENT_SIZE)/$(MAX_SIZE)\n
+MSG_FILE_JUST_RIGHT = File size is fine - $(CURRENT_SIZE)/$(MAX_SIZE) ($(FREE_SIZE) free)\n
diff --git a/tmk_core/rules.mk b/tmk_core/rules.mk
index b556c4609b..5b1858b718 100644
--- a/tmk_core/rules.mk
+++ b/tmk_core/rules.mk
@@ -374,6 +374,8 @@ ifeq ($(findstring avr-gcc,$(CC)),avr-gcc)
check-size:
$(eval MAX_SIZE=$(shell n=`$(CC) -E -mmcu=$(MCU) $(CFLAGS) $(OPT_DEFS) tmk_core/common/avr/bootloader_size.c 2> /dev/null | sed -ne '/^#/n;/^AVR_SIZE:/,$${s/^AVR_SIZE: //;p;}'` && echo $$(($$n)) || echo 0))
$(eval CURRENT_SIZE=$(shell if [ -f $(BUILD_DIR)/$(TARGET).hex ]; then $(SIZE) --target=$(FORMAT) $(BUILD_DIR)/$(TARGET).hex | $(AWK) 'NR==2 {print $$4}'; else printf 0; fi))
+ $(eval FREE_SIZE=$(shell expr $(MAX_SIZE) - $(CURRENT_SIZE)))
+ $(eval OVER_SIZE=$(shell expr $(CURRENT_SIZE) - $(MAX_SIZE)))
if [ $(MAX_SIZE) -gt 0 ] && [ $(CURRENT_SIZE) -gt 0 ]; then \
$(SILENT) || printf "$(MSG_CHECK_FILESIZE)" | $(AWK_CMD); \
if [ $(CURRENT_SIZE) -gt $(MAX_SIZE) ]; then $(PRINT_WARNING_PLAIN); $(SILENT) || printf " * $(MSG_FILE_TOO_BIG)" ; else $(PRINT_OK); $(SILENT) || printf " * $(MSG_FILE_JUST_RIGHT)"; fi \