You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

108 lines
3.5 KiB

  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. # If it's possible that multiple bootloaders can be used for one project,
  16. # you can leave this unset, and the correct size will be selected
  17. # automatically.
  18. #
  19. # Sets the bootloader defined in the keyboard's/keymap's rules.mk
  20. # Current options:
  21. #
  22. # halfkay PJRC Teensy
  23. # caterina Pro Micro (Sparkfun/generic)
  24. # atmel-dfu Atmel factory DFU
  25. # lufa-dfu LUFA DFU
  26. # qmk-dfu QMK DFU (LUFA + blinkenlight)
  27. # bootloadHID HIDBootFlash compatible (ATmega32A)
  28. # USBasp USBaspLoader (ATmega328P)
  29. # kiibohd Input:Club Kiibohd bootloader (only used on their boards)
  30. #
  31. # BOOTLOADER_SIZE can still be defined manually, but it's recommended
  32. # you add any possible configuration to this list
  33. ifeq ($(strip $(BOOTLOADER)), atmel-dfu)
  34. OPT_DEFS += -DBOOTLOADER_ATMEL_DFU
  35. OPT_DEFS += -DBOOTLOADER_DFU
  36. ifneq (,$(filter $(MCU), at90usb646 atmega16u2 atmega16u4 atmega32u2 atmega32u4))
  37. BOOTLOADER_SIZE = 4096
  38. endif
  39. ifeq ($(strip $(MCU)), at90usb1286)
  40. BOOTLOADER_SIZE = 8192
  41. endif
  42. endif
  43. ifeq ($(strip $(BOOTLOADER)), lufa-dfu)
  44. OPT_DEFS += -DBOOTLOADER_LUFA_DFU
  45. OPT_DEFS += -DBOOTLOADER_DFU
  46. ifneq (,$(filter $(MCU), at90usb646 atmega16u2 atmega16u4 atmega32u2 atmega32u4))
  47. BOOTLOADER_SIZE = 4096
  48. endif
  49. ifeq ($(strip $(MCU)), at90usb1286)
  50. BOOTLOADER_SIZE = 8192
  51. endif
  52. endif
  53. ifeq ($(strip $(BOOTLOADER)), qmk-dfu)
  54. OPT_DEFS += -DBOOTLOADER_QMK_DFU
  55. OPT_DEFS += -DBOOTLOADER_DFU
  56. ifneq (,$(filter $(MCU), at90usb646 atmega16u2 atmega16u4 atmega32u2 atmega32u4))
  57. BOOTLOADER_SIZE = 4096
  58. endif
  59. ifeq ($(strip $(MCU)), at90usb1286)
  60. BOOTLOADER_SIZE = 8192
  61. endif
  62. endif
  63. ifeq ($(strip $(BOOTLOADER)), halfkay)
  64. OPT_DEFS += -DBOOTLOADER_HALFKAY
  65. ifeq ($(strip $(MCU)), atmega32u4)
  66. BOOTLOADER_SIZE = 512
  67. endif
  68. ifeq ($(strip $(MCU)), at90usb1286)
  69. BOOTLOADER_SIZE = 1024
  70. endif
  71. endif
  72. ifeq ($(strip $(BOOTLOADER)), caterina)
  73. OPT_DEFS += -DBOOTLOADER_CATERINA
  74. BOOTLOADER_SIZE = 4096
  75. endif
  76. ifeq ($(strip $(BOOTLOADER)), bootloadHID)
  77. OPT_DEFS += -DBOOTLOADER_BOOTLOADHID
  78. BOOTLOADER_SIZE = 4096
  79. endif
  80. ifeq ($(strip $(BOOTLOADER)), USBasp)
  81. OPT_DEFS += -DBOOTLOADER_USBASP
  82. BOOTLOADER_SIZE = 4096
  83. endif
  84. ifeq ($(strip $(BOOTLOADER)), lufa-ms)
  85. # DO NOT USE THIS BOOTLOADER IN NEW PROJECTS!
  86. # It is extremely prone to bricking, and is only included to support existing boards.
  87. OPT_DEFS += -DBOOTLOADER_MS
  88. BOOTLOADER_SIZE = 6144
  89. FIRMWARE_FORMAT = bin
  90. endif
  91. ifdef BOOTLOADER_SIZE
  92. OPT_DEFS += -DBOOTLOADER_SIZE=$(strip $(BOOTLOADER_SIZE))
  93. endif
  94. ifeq ($(strip $(BOOTLOADER)), kiibohd)
  95. OPT_DEFS += -DBOOTLOADER_KIIBOHD
  96. ifeq ($(strip $(MCU_ORIG)), MK20DX128)
  97. MCU_LDSCRIPT = MK20DX128BLDR4
  98. endif
  99. ifeq ($(strip $(MCU_ORIG)), MK20DX256)
  100. MCU_LDSCRIPT = MK20DX256BLDR8
  101. endif
  102. DFU_ARGS = -d 1C11:B007
  103. DFU_SUFFIX_ARGS = -v 1C11 -p B007
  104. endif