mcu_selection.mk 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387
  1. MCU_ORIG := $(MCU)
  2. ifneq ($(findstring MKL26Z64, $(MCU)),)
  3. # Cortex version
  4. MCU = cortex-m0plus
  5. # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
  6. ARMV = 6
  7. ## chip/board settings
  8. # - the next two should match the directories in
  9. # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
  10. MCU_FAMILY = KINETIS
  11. MCU_SERIES = KL2x
  12. # Linker script to use
  13. # - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/
  14. # or <keyboard_dir>/ld/
  15. # - NOTE: a custom ld script is needed for EEPROM on Teensy LC
  16. MCU_LDSCRIPT ?= MKL26Z64
  17. # Startup code to use
  18. # - it should exist in <chibios>/os/common/ports/ARMCMx/compilers/GCC/mk/
  19. MCU_STARTUP ?= kl2x
  20. # Board: it should exist either in <chibios>/os/hal/boards/,
  21. # <keyboard_dir>/boards/, or drivers/boards/
  22. BOARD ?= PJRC_TEENSY_LC
  23. endif
  24. ifneq ($(findstring MK20DX128, $(MCU)),)
  25. # Cortex version
  26. MCU = cortex-m4
  27. # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
  28. ARMV = 7
  29. ## chip/board settings
  30. # - the next two should match the directories in
  31. # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
  32. MCU_FAMILY = KINETIS
  33. MCU_SERIES = K20x
  34. # Linker script to use
  35. # - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/
  36. # or <keyboard_dir>/ld/
  37. MCU_LDSCRIPT ?= MK20DX128
  38. # Startup code to use
  39. # - it should exist in <chibios>/os/common/ports/ARMCMx/compilers/GCC/mk/
  40. MCU_STARTUP ?= k20x5
  41. # Board: it should exist either in <chibios>/os/hal/boards/,
  42. # <keyboard_dir>/boards/, or drivers/boards/
  43. BOARD ?= PJRC_TEENSY_3
  44. endif
  45. ifneq ($(findstring MK20DX256, $(MCU)),)
  46. # Cortex version
  47. MCU = cortex-m4
  48. # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
  49. ARMV = 7
  50. ## chip/board settings
  51. # - the next two should match the directories in
  52. # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
  53. MCU_FAMILY = KINETIS
  54. MCU_SERIES = K20x
  55. # Linker script to use
  56. # - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/
  57. # or <keyboard_dir>/ld/
  58. MCU_LDSCRIPT ?= MK20DX256
  59. # Startup code to use
  60. # - it should exist in <chibios>/os/common/ports/ARMCMx/compilers/GCC/mk/
  61. MCU_STARTUP ?= k20x7
  62. # Board: it should exist either in <chibios>/os/hal/boards/,
  63. # <keyboard_dir>/boards/, or drivers/boards/
  64. BOARD ?= PJRC_TEENSY_3_1
  65. endif
  66. ifneq ($(findstring STM32F042, $(MCU)),)
  67. # Cortex version
  68. MCU = cortex-m0
  69. # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
  70. ARMV = 6
  71. ## chip/board settings
  72. # - the next two should match the directories in
  73. # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
  74. MCU_FAMILY = STM32
  75. MCU_SERIES = STM32F0xx
  76. # Linker script to use
  77. # - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/
  78. # or <keyboard_dir>/ld/
  79. MCU_LDSCRIPT ?= STM32F042x6
  80. # Startup code to use
  81. # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/
  82. MCU_STARTUP ?= stm32f0xx
  83. # Board: it should exist either in <chibios>/os/hal/boards/,
  84. # <keyboard_dir>/boards/, or drivers/boards/
  85. BOARD ?= GENERIC_STM32_F042X6
  86. USE_FPU ?= no
  87. # Options to pass to dfu-util when flashing
  88. DFU_ARGS ?= -d 0483:DF11 -a 0 -s 0x08000000:leave
  89. DFU_SUFFIX_ARGS ?= -v 0483 -p DF11
  90. endif
  91. ifneq ($(findstring STM32F072, $(MCU)),)
  92. # Cortex version
  93. MCU = cortex-m0
  94. # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
  95. ARMV = 6
  96. ## chip/board settings
  97. # - the next two should match the directories in
  98. # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
  99. MCU_FAMILY = STM32
  100. MCU_SERIES = STM32F0xx
  101. # Linker script to use
  102. # - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/
  103. # or <keyboard_dir>/ld/
  104. MCU_LDSCRIPT ?= STM32F072xB
  105. # Startup code to use
  106. # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/
  107. MCU_STARTUP ?= stm32f0xx
  108. # Board: it should exist either in <chibios>/os/hal/boards/,
  109. # <keyboard_dir>/boards/, or drivers/boards/
  110. BOARD ?= GENERIC_STM32_F072XB
  111. USE_FPU ?= no
  112. # Options to pass to dfu-util when flashing
  113. DFU_ARGS ?= -d 0483:DF11 -a 0 -s 0x08000000:leave
  114. DFU_SUFFIX_ARGS ?= -v 0483 -p DF11
  115. endif
  116. ifneq ($(findstring STM32F103, $(MCU)),)
  117. # Cortex version
  118. MCU = cortex-m3
  119. # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
  120. ARMV = 7
  121. ## chip/board settings
  122. # - the next two should match the directories in
  123. # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
  124. MCU_FAMILY = STM32
  125. MCU_SERIES = STM32F1xx
  126. # Linker script to use
  127. # - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/
  128. # or <keyboard_dir>/ld/
  129. MCU_LDSCRIPT ?= STM32F103x8
  130. # Startup code to use
  131. # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/
  132. MCU_STARTUP ?= stm32f1xx
  133. # Board: it should exist either in <chibios>/os/hal/boards/,
  134. # <keyboard_dir>/boards/, or drivers/boards/
  135. BOARD ?= GENERIC_STM32_F103
  136. USE_FPU ?= no
  137. # Options to pass to dfu-util when flashing
  138. DFU_ARGS ?= -d 0483:DF11 -a 0 -s 0x08000000:leave
  139. DFU_SUFFIX_ARGS ?= -v 0483 -p DF11
  140. endif
  141. ifneq ($(findstring STM32F303, $(MCU)),)
  142. # Cortex version
  143. MCU = cortex-m4
  144. # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
  145. ARMV = 7
  146. ## chip/board settings
  147. # - the next two should match the directories in
  148. # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
  149. MCU_FAMILY = STM32
  150. MCU_SERIES = STM32F3xx
  151. # Linker script to use
  152. # - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/
  153. # or <keyboard_dir>/ld/
  154. MCU_LDSCRIPT ?= STM32F303xC
  155. # Startup code to use
  156. # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/
  157. MCU_STARTUP ?= stm32f3xx
  158. # Board: it should exist either in <chibios>/os/hal/boards/,
  159. # <keyboard_dir>/boards/, or drivers/boards/
  160. BOARD ?= GENERIC_STM32_F303XC
  161. USE_FPU ?= yes
  162. # Options to pass to dfu-util when flashing
  163. DFU_ARGS ?= -d 0483:DF11 -a 0 -s 0x08000000:leave
  164. DFU_SUFFIX_ARGS ?= -v 0483 -p DF11
  165. endif
  166. ifneq ($(findstring STM32F401, $(MCU)),)
  167. # Cortex version
  168. MCU = cortex-m4
  169. # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
  170. ARMV = 7
  171. ## chip/board settings
  172. # - the next two should match the directories in
  173. # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
  174. MCU_FAMILY = STM32
  175. MCU_SERIES = STM32F4xx
  176. # Linker script to use
  177. # - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/
  178. # or <keyboard_dir>/ld/
  179. MCU_LDSCRIPT ?= STM32F401xC
  180. # Startup code to use
  181. # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/
  182. MCU_STARTUP ?= stm32f4xx
  183. # Board: it should exist either in <chibios>/os/hal/boards/,
  184. # <keyboard_dir>/boards/, or drivers/boards/
  185. BOARD ?= BLACKPILL_STM32_F401
  186. USE_FPU ?= yes
  187. # Options to pass to dfu-util when flashing
  188. DFU_ARGS ?= -d 0483:DF11 -a 0 -s 0x08000000:leave
  189. DFU_SUFFIX_ARGS ?= -v 0483 -p DF11
  190. endif
  191. ifneq ($(findstring STM32F411, $(MCU)),)
  192. # Cortex version
  193. MCU = cortex-m4
  194. # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
  195. ARMV = 7
  196. ## chip/board settings
  197. # - the next two should match the directories in
  198. # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
  199. MCU_FAMILY = STM32
  200. MCU_SERIES = STM32F4xx
  201. # Linker script to use
  202. # - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/
  203. # or <keyboard_dir>/ld/
  204. MCU_LDSCRIPT ?= STM32F411xE
  205. # Startup code to use
  206. # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/
  207. MCU_STARTUP ?= stm32f4xx
  208. # Board: it should exist either in <chibios>/os/hal/boards/,
  209. # <keyboard_dir>/boards/, or drivers/boards/
  210. BOARD ?= BLACKPILL_STM32_F411
  211. USE_FPU ?= yes
  212. # Options to pass to dfu-util when flashing
  213. DFU_ARGS ?= -d 0483:DF11 -a 0 -s 0x08000000:leave
  214. DFU_SUFFIX_ARGS ?= -v 0483 -p DF11
  215. endif
  216. ifneq (,$(filter $(MCU),atmega16u2 atmega32u2 atmega16u4 atmega32u4 at90usb646 at90usb1286))
  217. PROTOCOL = LUFA
  218. # Processor frequency.
  219. # This will define a symbol, F_CPU, in all source code files equal to the
  220. # processor frequency in Hz. You can then use this symbol in your source code to
  221. # calculate timings. Do NOT tack on a 'UL' at the end, this will be done
  222. # automatically to create a 32-bit value in your source code.
  223. #
  224. # This will be an integer division of F_USB below, as it is sourced by
  225. # F_USB after it has run through any CPU prescalers. Note that this value
  226. # does not *change* the processor frequency - it should merely be updated to
  227. # reflect the processor speed set externally so that the code can use accurate
  228. # software delays.
  229. F_CPU ?= 16000000
  230. # LUFA specific
  231. #
  232. # Target architecture (see library "Board Types" documentation).
  233. ARCH = AVR8
  234. # Input clock frequency.
  235. # This will define a symbol, F_USB, in all source code files equal to the
  236. # input clock frequency (before any prescaling is performed) in Hz. This value may
  237. # differ from F_CPU if prescaling is used on the latter, and is required as the
  238. # raw input clock is fed directly to the PLL sections of the AVR for high speed
  239. # clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
  240. # at the end, this will be done automatically to create a 32-bit value in your
  241. # source code.
  242. #
  243. # If no clock division is performed on the input clock inside the AVR (via the
  244. # CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
  245. F_USB ?= $(F_CPU)
  246. # Interrupt driven control endpoint task
  247. ifeq (,$(filter $(NO_INTERRUPT_CONTROL_ENDPOINT),yes))
  248. OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
  249. endif
  250. endif
  251. ifneq (,$(filter $(MCU),atmega32a))
  252. # MCU name for avrdude
  253. AVRDUDE_MCU = m32
  254. PROTOCOL = VUSB
  255. # Processor frequency.
  256. # This will define a symbol, F_CPU, in all source code files equal to the
  257. # processor frequency in Hz. You can then use this symbol in your source code to
  258. # calculate timings. Do NOT tack on a 'UL' at the end, this will be done
  259. # automatically to create a 32-bit value in your source code.
  260. F_CPU ?= 12000000
  261. # unsupported features for now
  262. NO_SUSPEND_POWER_DOWN ?= yes
  263. endif
  264. ifneq (,$(filter $(MCU),atmega328p))
  265. # MCU name for avrdude
  266. AVRDUDE_MCU = m328p
  267. PROTOCOL = VUSB
  268. # Processor frequency.
  269. # This will define a symbol, F_CPU, in all source code files equal to the
  270. # processor frequency in Hz. You can then use this symbol in your source code to
  271. # calculate timings. Do NOT tack on a 'UL' at the end, this will be done
  272. # automatically to create a 32-bit value in your source code.
  273. F_CPU ?= 16000000
  274. # unsupported features for now
  275. NO_SUSPEND_POWER_DOWN ?= yes
  276. endif
  277. ifneq (,$(filter $(MCU),atmega328))
  278. # MCU name for avrdude
  279. AVRDUDE_MCU = m328
  280. PROTOCOL = VUSB
  281. # Processor frequency.
  282. # This will define a symbol, F_CPU, in all source code files equal to the
  283. # processor frequency in Hz. You can then use this symbol in your source code to
  284. # calculate timings. Do NOT tack on a 'UL' at the end, this will be done
  285. # automatically to create a 32-bit value in your source code.
  286. F_CPU ?= 16000000
  287. # unsupported features for now
  288. NO_UART ?= yes
  289. NO_SUSPEND_POWER_DOWN ?= yes
  290. endif
  291. ifneq (,$(filter $(MCU),attiny85))
  292. PROTOCOL = VUSB
  293. # Processor frequency.
  294. # This will define a symbol, F_CPU, in all source code files equal to the
  295. # processor frequency in Hz. You can then use this symbol in your source code to
  296. # calculate timings. Do NOT tack on a 'UL' at the end, this will be done
  297. # automatically to create a 32-bit value in your source code.
  298. F_CPU ?= 16500000
  299. # unsupported features for now
  300. NO_SUSPEND_POWER_DOWN ?= yes
  301. endif