diff options
| author | fauxpark <fauxpark@gmail.com> | 2019-07-12 05:05:13 +1000 |
|---|---|---|
| committer | Drashna Jaelre <drashna@live.com> | 2019-07-11 12:05:13 -0700 |
| commit | 8e348c427d2b8dc670a2967e6cb8d2de4f897f7a (patch) | |
| tree | 53c0ef97a35b5aa262bcd4391672ef2b7b7a2398 | |
| parent | 2bbbfc61543053f297e38fd070d8b18ee380bff5 (diff) | |
| download | qmk_firmware-8e348c427d2b8dc670a2967e6cb8d2de4f897f7a.tar.gz qmk_firmware-8e348c427d2b8dc670a2967e6cb8d2de4f897f7a.zip | |
Display firmware size percentage (#6307)
| -rw-r--r-- | message.mk | 4 | ||||
| -rw-r--r-- | tmk_core/rules.mk | 1 |
2 files changed, 3 insertions, 2 deletions
diff --git a/message.mk b/message.mk index 734de8645..ec9bacbf4 100644 --- a/message.mk +++ b/message.mk | |||
| @@ -79,8 +79,8 @@ MSG_TEST = Testing $(BOLD)$(TEST_NAME)$(NO_COLOR) | |||
| 79 | MSG_CHECK_FILESIZE = Checking file size of $(TARGET).hex | 79 | MSG_CHECK_FILESIZE = Checking file size of $(TARGET).hex |
| 80 | MSG_FILE_TOO_BIG = $(ERROR_COLOR)The firmware is too large!$(NO_COLOR) $(CURRENT_SIZE)/$(MAX_SIZE) ($(OVER_SIZE) bytes over)\n | 80 | MSG_FILE_TOO_BIG = $(ERROR_COLOR)The firmware is too large!$(NO_COLOR) $(CURRENT_SIZE)/$(MAX_SIZE) ($(OVER_SIZE) bytes over)\n |
| 81 | MSG_FILE_TOO_SMALL = The firmware is too small! $(CURRENT_SIZE)/$(MAX_SIZE)\n | 81 | MSG_FILE_TOO_SMALL = The firmware is too small! $(CURRENT_SIZE)/$(MAX_SIZE)\n |
| 82 | MSG_FILE_JUST_RIGHT = The firmware size is fine - $(CURRENT_SIZE)/$(MAX_SIZE) ($(FREE_SIZE) bytes free)\n | 82 | MSG_FILE_JUST_RIGHT = The firmware size is fine - $(CURRENT_SIZE)/$(MAX_SIZE) ($(PERCENT_SIZE)%%, $(FREE_SIZE) bytes free)\n |
| 83 | MSG_FILE_NEAR_LIMIT = The firmware size is approaching the maximum - $(CURRENT_SIZE)/$(MAX_SIZE) ($(FREE_SIZE) bytes free)\n | 83 | MSG_FILE_NEAR_LIMIT = The firmware size is approaching the maximum - $(CURRENT_SIZE)/$(MAX_SIZE) ($(PERCENT_SIZE)%%, $(FREE_SIZE) bytes free)\n |
| 84 | MSG_PYTHON_MISSING = $(WARN_COLOR)WARNING:$(NO_COLOR)\n \ | 84 | MSG_PYTHON_MISSING = $(WARN_COLOR)WARNING:$(NO_COLOR)\n \ |
| 85 | Python 3 is not installed. It will be required by a future version\n\ | 85 | Python 3 is not installed. It will be required by a future version\n\ |
| 86 | of qmk_firmware.\n\n\ | 86 | of qmk_firmware.\n\n\ |
diff --git a/tmk_core/rules.mk b/tmk_core/rules.mk index 8f876a383..96b6e3a27 100644 --- a/tmk_core/rules.mk +++ b/tmk_core/rules.mk | |||
| @@ -398,6 +398,7 @@ check-size: | |||
| 398 | $(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)) | 398 | $(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)) |
| 399 | $(eval FREE_SIZE=$(shell expr $(MAX_SIZE) - $(CURRENT_SIZE))) | 399 | $(eval FREE_SIZE=$(shell expr $(MAX_SIZE) - $(CURRENT_SIZE))) |
| 400 | $(eval OVER_SIZE=$(shell expr $(CURRENT_SIZE) - $(MAX_SIZE))) | 400 | $(eval OVER_SIZE=$(shell expr $(CURRENT_SIZE) - $(MAX_SIZE))) |
| 401 | $(eval PERCENT_SIZE=$(shell expr $(CURRENT_SIZE) \* 100 / $(MAX_SIZE))) | ||
| 401 | if [ $(MAX_SIZE) -gt 0 ] && [ $(CURRENT_SIZE) -gt 0 ]; then \ | 402 | if [ $(MAX_SIZE) -gt 0 ] && [ $(CURRENT_SIZE) -gt 0 ]; then \ |
| 402 | $(SILENT) || printf "$(MSG_CHECK_FILESIZE)" | $(AWK_CMD); \ | 403 | $(SILENT) || printf "$(MSG_CHECK_FILESIZE)" | $(AWK_CMD); \ |
| 403 | if [ $(CURRENT_SIZE) -gt $(MAX_SIZE) ]; then \ | 404 | if [ $(CURRENT_SIZE) -gt $(MAX_SIZE) ]; then \ |
