mcu_selection.mk 14 KB

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