reduce space on h3s
[jackhill/qmk/firmware.git] / bootloader.mk
CommitLineData
9fdc2762
JH
1# Copyright 2017 Jack Humbert
2#
3# This program is free software: you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by
5# the Free Software Foundation, either version 2 of the License, or
6# (at your option) any later version.
7#
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11# GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License
14# along with this program. If not, see <http://www.gnu.org/licenses/>.
15
16# If it's possible that multiple bootloaders can be used for one project,
17# you can leave this unset, and the correct size will be selected
18# automatically.
19#
20# Sets the bootloader defined in the keyboard's/keymap's rules.mk
21# Current options:
54503168 22#
23# halfkay PJRC Teensy
24# caterina Pro Micro (Sparkfun/generic)
25# atmel-dfu Atmel factory DFU
26# lufa-dfu LUFA DFU
27# qmk-dfu QMK DFU (LUFA + blinkenlight)
28# bootloadHID HIDBootFlash compatible (ATmega32A)
29# USBasp USBaspLoader (ATmega328P)
9fdc2762
JH
30#
31# BOOTLOADER_SIZE can still be defined manually, but it's recommended
32# you add any possible configuration to this list
33
34ifeq ($(strip $(BOOTLOADER)), atmel-dfu)
35 OPT_DEFS += -DBOOTLOADER_ATMEL_DFU
36 OPT_DEFS += -DBOOTLOADER_DFU
54503168 37 ifneq (,$(filter $(MCU), at90usb646 atmega16u2 atmega16u4 atmega32u2 atmega32u4))
38 BOOTLOADER_SIZE = 4096
14b7602a
JH
39 endif
40 ifeq ($(strip $(MCU)), at90usb1286)
54503168 41 BOOTLOADER_SIZE = 8192
14b7602a 42 endif
9fdc2762
JH
43endif
44ifeq ($(strip $(BOOTLOADER)), lufa-dfu)
45 OPT_DEFS += -DBOOTLOADER_LUFA_DFU
46 OPT_DEFS += -DBOOTLOADER_DFU
54503168 47 ifneq (,$(filter $(MCU), at90usb646 atmega16u2 atmega16u4 atmega32u2 atmega32u4))
48 BOOTLOADER_SIZE = 4096
14b7602a
JH
49 endif
50 ifeq ($(strip $(MCU)), at90usb1286)
54503168 51 BOOTLOADER_SIZE = 8192
14b7602a 52 endif
9fdc2762
JH
53endif
54ifeq ($(strip $(BOOTLOADER)), qmk-dfu)
55 OPT_DEFS += -DBOOTLOADER_QMK_DFU
56 OPT_DEFS += -DBOOTLOADER_DFU
54503168 57 ifneq (,$(filter $(MCU), at90usb646 atmega16u2 atmega16u4 atmega32u2 atmega32u4))
58 BOOTLOADER_SIZE = 4096
14b7602a
JH
59 endif
60 ifeq ($(strip $(MCU)), at90usb1286)
54503168 61 BOOTLOADER_SIZE = 8192
14b7602a 62 endif
9fdc2762
JH
63endif
64ifeq ($(strip $(BOOTLOADER)), halfkay)
65 OPT_DEFS += -DBOOTLOADER_HALFKAY
6bd2b8de 66 ifeq ($(strip $(MCU)), atmega32u4)
54503168 67 BOOTLOADER_SIZE = 512
6bd2b8de
DJ
68 endif
69 ifeq ($(strip $(MCU)), at90usb1286)
54503168 70 BOOTLOADER_SIZE = 1024
6bd2b8de 71 endif
9fdc2762
JH
72endif
73ifeq ($(strip $(BOOTLOADER)), caterina)
74 OPT_DEFS += -DBOOTLOADER_CATERINA
75 BOOTLOADER_SIZE = 4096
76endif
77ifeq ($(strip $(BOOTLOADER)), bootloadHID)
78 OPT_DEFS += -DBOOTLOADER_BOOTLOADHID
79 BOOTLOADER_SIZE = 4096
80endif
35389557 81ifeq ($(strip $(BOOTLOADER)), USBasp)
82 OPT_DEFS += -DBOOTLOADER_USBASP
83 BOOTLOADER_SIZE = 4096
84endif
559ef215 85ifeq ($(strip $(BOOTLOADER)), lufa-ms)
86 # DO NOT USE THIS BOOTLOADER IN NEW PROJECTS!
87 # It is extremely prone to bricking, and is only included to support existing boards.
88 OPT_DEFS += -DBOOTLOADER_MS
89 BOOTLOADER_SIZE = 6144
90 FIRMWARE_FORMAT = bin
91endif
9fdc2762
JH
92
93ifdef BOOTLOADER_SIZE
94 OPT_DEFS += -DBOOTLOADER_SIZE=$(strip $(BOOTLOADER_SIZE))
14b7602a 95endif