logo

qmk_firmware

custom branch of QMK firmware git clone https://anongit.hacktivis.me/git/qmk_firmware.git

bootloader.mk (4710B)


  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. #
  21. # Current options for ARM:
  22. # halfkay PJRC Teensy
  23. # kiibohd Input:Club Kiibohd bootloader (only used on their boards)
  24. # stm32duino STM32Duino (STM32F103x8)
  25. # stm32-dfu STM32 USB DFU in ROM
  26. # apm32-dfu APM32 USB DFU in ROM
  27. # wb32-dfu WB32 USB DFU in ROM
  28. # at32-dfu AT32 USB DFU in ROM
  29. # tinyuf2 TinyUF2
  30. # rp2040 Raspberry Pi RP2040
  31. # Current options for RISC-V:
  32. # gd32v-dfu GD32V USB DFU in ROM
  33. #
  34. # If you need to provide your own implementation, you can set inside `rules.mk`
  35. # `BOOTLOADER = custom` -- you'll need to provide your own implementations. See
  36. # the respective file under `platforms/<PLATFORM>/bootloaders/custom.c` to see
  37. # which functions may be overridden.
  38. FIRMWARE_FORMAT?=bin
  39. ifeq ($(strip $(BOOTLOADER)), custom)
  40. OPT_DEFS += -DBOOTLOADER_CUSTOM
  41. BOOTLOADER_TYPE = custom
  42. endif
  43. ifeq ($(strip $(BOOTLOADER)), halfkay)
  44. OPT_DEFS += -DBOOTLOADER_HALFKAY
  45. BOOTLOADER_TYPE = halfkay
  46. # Teensy LC, 3.0, 3.1/2, 3.5, 3.6
  47. ifneq (,$(filter $(MCU_ORIG), MKL26Z64 MK20DX128 MK20DX256 MK64FX512 MK66FX1M0))
  48. FIRMWARE_FORMAT = hex
  49. endif
  50. endif
  51. ifeq ($(strip $(BOOTLOADER)), stm32-dfu)
  52. OPT_DEFS += -DBOOTLOADER_STM32_DFU
  53. BOOTLOADER_TYPE = stm32_dfu
  54. # Options to pass to dfu-util when flashing
  55. DFU_ARGS ?= -d 0483:DF11 -a 0 -s 0x08000000:leave
  56. DFU_SUFFIX_ARGS ?= -v 0483 -p DF11
  57. endif
  58. ifeq ($(strip $(BOOTLOADER)), apm32-dfu)
  59. OPT_DEFS += -DBOOTLOADER_APM32_DFU
  60. BOOTLOADER_TYPE = stm32_dfu
  61. # Options to pass to dfu-util when flashing
  62. DFU_ARGS ?= -d 314B:0106 -a 0 -s 0x08000000:leave
  63. DFU_SUFFIX_ARGS ?= -v 314B -p 0106
  64. endif
  65. ifeq ($(strip $(BOOTLOADER)), gd32v-dfu)
  66. OPT_DEFS += -DBOOTLOADER_GD32V_DFU
  67. BOOTLOADER_TYPE = gd32v_dfu
  68. # Options to pass to dfu-util when flashing
  69. DFU_ARGS ?= -d 28E9:0189 -a 0 -s 0x08000000:leave
  70. DFU_SUFFIX_ARGS ?= -v 28E9 -p 0189
  71. endif
  72. ifeq ($(strip $(BOOTLOADER)), kiibohd)
  73. OPT_DEFS += -DBOOTLOADER_KIIBOHD
  74. BOOTLOADER_TYPE = kiibohd
  75. ifeq ($(strip $(MCU_ORIG)), MK20DX128)
  76. MCU_LDSCRIPT = MK20DX128BLDR4
  77. endif
  78. ifeq ($(strip $(MCU_ORIG)), MK20DX256)
  79. MCU_LDSCRIPT = MK20DX256BLDR8
  80. endif
  81. # Options to pass to dfu-util when flashing
  82. DFU_ARGS = -d 1C11:B007
  83. DFU_SUFFIX_ARGS = -v 1C11 -p B007
  84. endif
  85. ifeq ($(strip $(BOOTLOADER)), stm32duino)
  86. OPT_DEFS += -DBOOTLOADER_STM32DUINO
  87. BOARD = STM32_F103_STM32DUINO
  88. BOOTLOADER_TYPE = stm32duino
  89. # Options to pass to dfu-util when flashing
  90. DFU_ARGS = -d 1EAF:0003 -a 2 -R
  91. DFU_SUFFIX_ARGS = -v 1EAF -p 0003
  92. endif
  93. ifeq ($(strip $(BOOTLOADER)), tinyuf2)
  94. OPT_DEFS += -DBOOTLOADER_TINYUF2
  95. BOOTLOADER_TYPE = tinyuf2
  96. FIRMWARE_FORMAT = uf2
  97. endif
  98. ifeq ($(strip $(BOOTLOADER)), uf2boot)
  99. OPT_DEFS += -DBOOTLOADER_UF2BOOT
  100. BOARD = STM32_F103_STM32DUINO
  101. BOOTLOADER_TYPE = uf2boot
  102. FIRMWARE_FORMAT = uf2
  103. endif
  104. ifeq ($(strip $(BOOTLOADER)), rp2040)
  105. OPT_DEFS += -DBOOTLOADER_RP2040
  106. BOOTLOADER_TYPE = rp2040
  107. endif
  108. ifeq ($(strip $(BOOTLOADER)), wb32-dfu)
  109. OPT_DEFS += -DBOOTLOADER_WB32_DFU
  110. BOOTLOADER_TYPE = wb32_dfu
  111. endif
  112. ifeq ($(strip $(BOOTLOADER)), at32-dfu)
  113. OPT_DEFS += -DBOOTLOADER_AT32_DFU
  114. BOOTLOADER_TYPE = at32_dfu
  115. # Options to pass to dfu-util when flashing
  116. DFU_ARGS ?= -d 2E3C:DF11 -a 0 -s 0x08000000:leave
  117. DFU_SUFFIX_ARGS ?= -v 2E3C -p DF11
  118. endif
  119. ifeq ($(strip $(BOOTLOADER_TYPE)),)
  120. ifneq ($(strip $(BOOTLOADER)),)
  121. $(call CATASTROPHIC_ERROR,Invalid BOOTLOADER,Invalid bootloader specified. Please set an appropriate bootloader in your rules.mk or info.json.)
  122. else
  123. $(call CATASTROPHIC_ERROR,Invalid BOOTLOADER,No bootloader specified. Please set an appropriate bootloader in your rules.mk or info.json.)
  124. endif
  125. endif