summaryrefslogtreecommitdiff
path: root/tmk_core/rules.mk
diff options
context:
space:
mode:
Diffstat (limited to 'tmk_core/rules.mk')
-rw-r--r--tmk_core/rules.mk9
1 files changed, 9 insertions, 0 deletions
diff --git a/tmk_core/rules.mk b/tmk_core/rules.mk
index 6d2bb51f07..96b6e3a271 100644
--- a/tmk_core/rules.mk
+++ b/tmk_core/rules.mk
@@ -223,6 +223,10 @@ $(foreach LOBJ, $(NO_LTO_OBJ), $(eval $(call NO_LTO,$(LOBJ))))
MOVE_DEP = mv -f $(patsubst %.o,%.td,$@) $(patsubst %.o,%.d,$@)
+# Add QMK specific flags
+DFU_SUFFIX ?= dfu-suffix
+DFU_SUFFIX_ARGS ?=
+
elf: $(BUILD_DIR)/$(TARGET).elf
hex: $(BUILD_DIR)/$(TARGET).hex
@@ -279,6 +283,10 @@ gccversion :
@$(SILENT) || printf "$(MSG_BIN) $@" | $(AWK_CMD)
$(eval CMD=$(BIN) $< $@ || exit 0)
@$(BUILD_CMD)
+ if [ ! -z "$(DFU_SUFFIX_ARGS)" ]; then \
+ $(DFU_SUFFIX) $(DFU_SUFFIX_ARGS) -a $(BUILD_DIR)/$(TARGET).bin 1>/dev/null ;\
+ fi
+ $(COPY) $(BUILD_DIR)/$(TARGET).bin $(TARGET).bin;
BEGIN = gccversion sizebefore
@@ -390,6 +398,7 @@ check-size:
$(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)))
+ $(eval PERCENT_SIZE=$(shell expr $(CURRENT_SIZE) \* 100 / $(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 \