summaryrefslogtreecommitdiff
path: root/tmk_core/avr.mk
diff options
context:
space:
mode:
authorRyan <fauxpark@gmail.com>2021-08-10 18:03:04 +1000
committerGitHub <noreply@github.com>2021-08-10 18:03:04 +1000
commitd3932a104cb1db7e9436f5c16ee58cf3684e8b3a (patch)
treecb6aebc60eb2843b6ae0d87bc3edcbc7989a25b7 /tmk_core/avr.mk
parent076c8cc45fe9af215dc5211ca0e8a731718864ae (diff)
downloadqmk_firmware-d3932a104cb1db7e9436f5c16ee58cf3684e8b3a.tar.gz
qmk_firmware-d3932a104cb1db7e9436f5c16ee58cf3684e8b3a.zip
Add padding to LUFA-MS .BIN files (#13922)
Diffstat (limited to 'tmk_core/avr.mk')
-rw-r--r--tmk_core/avr.mk5
1 files changed, 5 insertions, 0 deletions
diff --git a/tmk_core/avr.mk b/tmk_core/avr.mk
index 690154535b..d0a1b86ca4 100644
--- a/tmk_core/avr.mk
+++ b/tmk_core/avr.mk
@@ -239,7 +239,12 @@ bootloadHID: $(BUILD_DIR)/$(TARGET).hex check-size cpfirmware
# Convert hex to bin.
bin: $(BUILD_DIR)/$(TARGET).hex
+ifeq ($(BOOTLOADER),lufa-ms)
+ $(eval BIN_PADDING=$(shell n=`expr 32768 - $(BOOTLOADER_SIZE)` && echo $$(($$n)) || echo 0))
+ $(OBJCOPY) -Iihex -Obinary $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin --pad-to $(BIN_PADDING)
+else
$(OBJCOPY) -Iihex -Obinary $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin
+endif
$(COPY) $(BUILD_DIR)/$(TARGET).bin $(TARGET).bin;
# copy bin to FLASH.bin