summaryrefslogtreecommitdiff
path: root/tmk_core
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2019-07-16 01:28:23 -0700
committerskullydazed <skullydazed@users.noreply.github.com>2019-07-16 01:28:23 -0700
commitf859375284f5a27f5b4f8cbe654e305ca3face17 (patch)
treed96817bb77d0d940a565662a6a832c3d4495969e /tmk_core
parentf6651424a022d6209c39981f0cf45fd87660578c (diff)
Expand bootloader target to support most AVR boards (#6255)
* Update the :bootloader target to pass along correct hardware info * Update make scripts to properly grab the settings (a big thanks to @yanfali) * Remove LUFA debug warnings
Diffstat (limited to 'tmk_core')
-rw-r--r--tmk_core/avr.mk6
1 files changed, 5 insertions, 1 deletions
diff --git a/tmk_core/avr.mk b/tmk_core/avr.mk
index 670e141bfd..5bfd5a9b0d 100644
--- a/tmk_core/avr.mk
+++ b/tmk_core/avr.mk
@@ -310,7 +310,11 @@ extcoff: $(BUILD_DIR)/$(TARGET).elf
bootloader:
make -C lib/lufa/Bootloaders/DFU/ clean
$(TMK_DIR)/make_dfu_header.sh $(ALL_CONFIGS)
- make -C lib/lufa/Bootloaders/DFU/
+ $(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 PROGRAM_SIZE_KB=$(shell n=`expr $(MAX_SIZE) / 1024` && echo $$(($$n)) || echo 0))
+ $(eval BOOT_SECTION_SIZE_KB=$(shell n=`expr $(BOOTLOADER_SIZE) / 1024` && echo $$(($$n)) || echo 0))
+ $(eval FLASH_SIZE_KB=$(shell n=`expr $(PROGRAM_SIZE_KB) + $(BOOT_SECTION_SIZE_KB)` && echo $$(($$n)) || echo 0))
+ make -C lib/lufa/Bootloaders/DFU/ MCU=$(MCU) ARCH=$(ARCH) F_CPU=$(F_CPU) FLASH_SIZE_KB=$(FLASH_SIZE_KB) BOOT_SECTION_SIZE_KB=$(BOOT_SECTION_SIZE_KB)
printf "BootloaderDFU.hex copied to $(TARGET)_bootloader.hex\n"
cp lib/lufa/Bootloaders/DFU/BootloaderDFU.hex $(TARGET)_bootloader.hex