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.

120 lines
4.1 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. # stm32duino STM32Duino (STM32F103x8)
  31. #
  32. # BOOTLOADER_SIZE can still be defined manually, but it's recommended
  33. # you add any possible configuration to this list
  34. ifeq ($(strip $(BOOTLOADER)), atmel-dfu)
  35. OPT_DEFS += -DBOOTLOADER_ATMEL_DFU
  36. OPT_DEFS += -DBOOTLOADER_DFU
  37. ifneq (,$(filter $(MCU), atmega16u2 atmega32u2 atmega16u4 atmega32u4 at90usb646 at90usb647))
  38. BOOTLOADER_SIZE = 4096
  39. endif
  40. ifneq (,$(filter $(MCU), at90usb1286 at90usb1287))
  41. BOOTLOADER_SIZE = 8192
  42. endif
  43. endif
  44. ifeq ($(strip $(BOOTLOADER)), lufa-dfu)
  45. OPT_DEFS += -DBOOTLOADER_LUFA_DFU
  46. OPT_DEFS += -DBOOTLOADER_DFU
  47. ifneq (,$(filter $(MCU), atmega16u2 atmega32u2 atmega16u4 atmega32u4 at90usb646 at90usb647))
  48. BOOTLOADER_SIZE = 4096
  49. endif
  50. ifneq (,$(filter $(MCU), at90usb1286 at90usb1287))
  51. BOOTLOADER_SIZE = 8192
  52. endif
  53. endif
  54. ifeq ($(strip $(BOOTLOADER)), qmk-dfu)
  55. OPT_DEFS += -DBOOTLOADER_QMK_DFU
  56. OPT_DEFS += -DBOOTLOADER_DFU
  57. ifneq (,$(filter $(MCU), atmega16u2 atmega32u2 atmega16u4 atmega32u4 at90usb646 at90usb647))
  58. BOOTLOADER_SIZE = 4096
  59. endif
  60. ifneq (,$(filter $(MCU), at90usb1286 at90usb1287))
  61. BOOTLOADER_SIZE = 8192
  62. endif
  63. endif
  64. ifeq ($(strip $(BOOTLOADER)), halfkay)
  65. OPT_DEFS += -DBOOTLOADER_HALFKAY
  66. ifeq ($(strip $(MCU)), atmega32u4)
  67. BOOTLOADER_SIZE = 512
  68. endif
  69. ifeq ($(strip $(MCU)), at90usb1286)
  70. BOOTLOADER_SIZE = 1024
  71. endif
  72. endif
  73. ifeq ($(strip $(BOOTLOADER)), caterina)
  74. OPT_DEFS += -DBOOTLOADER_CATERINA
  75. BOOTLOADER_SIZE = 4096
  76. endif
  77. ifeq ($(strip $(BOOTLOADER)), bootloadHID)
  78. OPT_DEFS += -DBOOTLOADER_BOOTLOADHID
  79. BOOTLOADER_SIZE = 4096
  80. endif
  81. ifeq ($(strip $(BOOTLOADER)), USBasp)
  82. OPT_DEFS += -DBOOTLOADER_USBASP
  83. BOOTLOADER_SIZE = 4096
  84. endif
  85. ifeq ($(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
  91. endif
  92. ifdef BOOTLOADER_SIZE
  93. OPT_DEFS += -DBOOTLOADER_SIZE=$(strip $(BOOTLOADER_SIZE))
  94. endif
  95. ifeq ($(strip $(BOOTLOADER)), kiibohd)
  96. OPT_DEFS += -DBOOTLOADER_KIIBOHD
  97. ifeq ($(strip $(MCU_ORIG)), MK20DX128)
  98. MCU_LDSCRIPT = MK20DX128BLDR4
  99. endif
  100. ifeq ($(strip $(MCU_ORIG)), MK20DX256)
  101. MCU_LDSCRIPT = MK20DX256BLDR8
  102. endif
  103. DFU_ARGS = -d 1C11:B007
  104. DFU_SUFFIX_ARGS = -v 1C11 -p B007
  105. endif
  106. ifeq ($(strip $(BOOTLOADER)), stm32duino)
  107. OPT_DEFS += -DBOOTLOADER_STM32DUINO
  108. MCU_LDSCRIPT = STM32F103x8_stm32duino_bootloader
  109. BOARD = STM32_F103_STM32DUINO
  110. # STM32F103 does NOT have an USB bootloader in ROM (only serial), so setting anything here does not make much sense
  111. STM32_BOOTLOADER_ADDRESS = 0x80000000
  112. DFU_ARGS = -d 1EAF:0003 -a2 -R
  113. DFU_SUFFIX_ARGS = -v 1EAF -p 0003
  114. endif