mcu_selection.mk 13 KB

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