mcu_selection.mk 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532
  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. # UF2 settings
  111. UF2_FAMILY ?= STM32F0
  112. endif
  113. ifneq ($(findstring STM32F072, $(MCU)),)
  114. # Cortex version
  115. MCU = cortex-m0
  116. # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
  117. ARMV = 6
  118. ## chip/board settings
  119. # - the next two should match the directories in
  120. # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
  121. MCU_FAMILY = STM32
  122. MCU_SERIES = STM32F0xx
  123. # Linker script to use
  124. # - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/
  125. # or <keyboard_dir>/ld/
  126. MCU_LDSCRIPT ?= STM32F072xB
  127. # Startup code to use
  128. # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/
  129. MCU_STARTUP ?= stm32f0xx
  130. # Board: it should exist either in <chibios>/os/hal/boards/,
  131. # <keyboard_dir>/boards/, or drivers/boards/
  132. BOARD ?= GENERIC_STM32_F072XB
  133. USE_FPU ?= no
  134. # Options to pass to dfu-util when flashing
  135. DFU_ARGS ?= -d 0483:DF11 -a 0 -s 0x08000000:leave
  136. DFU_SUFFIX_ARGS ?= -v 0483 -p DF11
  137. # UF2 settings
  138. UF2_FAMILY ?= STM32F0
  139. endif
  140. ifneq ($(findstring STM32F103, $(MCU)),)
  141. # Cortex version
  142. MCU = cortex-m3
  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 = STM32F1xx
  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 ?= STM32F103x8
  154. # Startup code to use
  155. # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/
  156. MCU_STARTUP ?= stm32f1xx
  157. # Board: it should exist either in <chibios>/os/hal/boards/,
  158. # <keyboard_dir>/boards/, or drivers/boards/
  159. BOARD ?= GENERIC_STM32_F103
  160. USE_FPU ?= no
  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. # UF2 settings
  165. UF2_FAMILY ?= STM32F1
  166. endif
  167. ifneq ($(findstring STM32F303, $(MCU)),)
  168. # Cortex version
  169. MCU = cortex-m4
  170. # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
  171. ARMV = 7
  172. ## chip/board settings
  173. # - the next two should match the directories in
  174. # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
  175. MCU_FAMILY = STM32
  176. MCU_SERIES = STM32F3xx
  177. # Linker script to use
  178. # - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/
  179. # or <keyboard_dir>/ld/
  180. MCU_LDSCRIPT ?= STM32F303xC
  181. # Startup code to use
  182. # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/
  183. MCU_STARTUP ?= stm32f3xx
  184. # Board: it should exist either in <chibios>/os/hal/boards/,
  185. # <keyboard_dir>/boards/, or drivers/boards/
  186. BOARD ?= GENERIC_STM32_F303XC
  187. USE_FPU ?= yes
  188. # Options to pass to dfu-util when flashing
  189. DFU_ARGS ?= -d 0483:DF11 -a 0 -s 0x08000000:leave
  190. DFU_SUFFIX_ARGS ?= -v 0483 -p DF11
  191. # UF2 settings
  192. UF2_FAMILY ?= STM32F3
  193. endif
  194. ifneq ($(findstring STM32F401, $(MCU)),)
  195. # Cortex version
  196. MCU = cortex-m4
  197. # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
  198. ARMV = 7
  199. ## chip/board settings
  200. # - the next two should match the directories in
  201. # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
  202. MCU_FAMILY = STM32
  203. MCU_SERIES = STM32F4xx
  204. # Linker script to use
  205. # - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/
  206. # or <keyboard_dir>/ld/
  207. MCU_LDSCRIPT ?= STM32F401xC
  208. # Startup code to use
  209. # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/
  210. MCU_STARTUP ?= stm32f4xx
  211. # Board: it should exist either in <chibios>/os/hal/boards/,
  212. # <keyboard_dir>/boards/, or drivers/boards/
  213. BOARD ?= BLACKPILL_STM32_F401
  214. USE_FPU ?= yes
  215. # Options to pass to dfu-util when flashing
  216. DFU_ARGS ?= -d 0483:DF11 -a 0 -s 0x08000000:leave
  217. DFU_SUFFIX_ARGS ?= -v 0483 -p DF11
  218. # UF2 settings
  219. UF2_FAMILY ?= STM32F4
  220. endif
  221. ifneq ($(findstring STM32F411, $(MCU)),)
  222. # Cortex version
  223. MCU = cortex-m4
  224. # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
  225. ARMV = 7
  226. ## chip/board settings
  227. # - the next two should match the directories in
  228. # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
  229. MCU_FAMILY = STM32
  230. MCU_SERIES = STM32F4xx
  231. # Linker script to use
  232. # - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/
  233. # or <keyboard_dir>/ld/
  234. ifeq ($(strip $(BOOTLOADER)), tinyuf2)
  235. MCU_LDSCRIPT ?= STM32F411xE_tinyuf2
  236. FIRMWARE_FORMAT ?= uf2
  237. else
  238. MCU_LDSCRIPT ?= STM32F411xE
  239. endif
  240. # Startup code to use
  241. # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/
  242. MCU_STARTUP ?= stm32f4xx
  243. # Board: it should exist either in <chibios>/os/hal/boards/,
  244. # <keyboard_dir>/boards/, or drivers/boards/
  245. BOARD ?= BLACKPILL_STM32_F411
  246. USE_FPU ?= yes
  247. # Options to pass to dfu-util when flashing
  248. DFU_ARGS ?= -d 0483:DF11 -a 0 -s 0x08000000:leave
  249. DFU_SUFFIX_ARGS ?= -v 0483 -p DF11
  250. # UF2 settings
  251. UF2_FAMILY ?= STM32F4
  252. endif
  253. ifneq ($(findstring STM32F446, $(MCU)),)
  254. # Cortex version
  255. MCU = cortex-m4
  256. # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
  257. ARMV = 7
  258. ## chip/board settings
  259. # - the next two should match the directories in
  260. # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
  261. MCU_FAMILY = STM32
  262. MCU_SERIES = STM32F4xx
  263. # Linker script to use
  264. # - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/
  265. # or <chibios>/os/common/startup/ARMCMx/compilers/GCC/ld/
  266. # or <keyboard_dir>/ld/
  267. MCU_LDSCRIPT ?= STM32F446xE
  268. # Startup code to use
  269. # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/
  270. MCU_STARTUP ?= stm32f4xx
  271. # Board: it should exist either in <chibios>/os/hal/boards/,
  272. # <keyboard_dir>/boards/, or drivers/boards/
  273. BOARD ?= GENERIC_STM32_F446XE
  274. USE_FPU ?= yes
  275. # Options to pass to dfu-util when flashing
  276. DFU_ARGS ?= -d 0483:DF11 -a 0 -s 0x08000000:leave
  277. DFU_SUFFIX_ARGS ?= -v 0483 -p DF11
  278. endif
  279. ifneq ($(findstring STM32G431, $(MCU)),)
  280. # Cortex version
  281. MCU = cortex-m4
  282. # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
  283. ARMV = 7
  284. ## chip/board settings
  285. # - the next two should match the directories in
  286. # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
  287. MCU_FAMILY = STM32
  288. MCU_SERIES = STM32G4xx
  289. # Linker script to use
  290. # - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/
  291. # or <keyboard_dir>/ld/
  292. MCU_LDSCRIPT ?= STM32G431xB
  293. # Startup code to use
  294. # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/
  295. MCU_STARTUP ?= stm32g4xx
  296. # Board: it should exist either in <chibios>/os/hal/boards/,
  297. # <keyboard_dir>/boards/, or drivers/boards/
  298. BOARD ?= GENERIC_STM32_G431XB
  299. USE_FPU ?= yes
  300. # Options to pass to dfu-util when flashing
  301. DFU_ARGS ?= -d 0483:DF11 -a 0 -s 0x08000000:leave
  302. DFU_SUFFIX_ARGS ?= -v 0483 -p DF11
  303. # UF2 settings
  304. UF2_FAMILY ?= STM32G4
  305. endif
  306. ifneq ($(findstring STM32G474, $(MCU)),)
  307. # Cortex version
  308. MCU = cortex-m4
  309. # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
  310. ARMV = 7
  311. ## chip/board settings
  312. # - the next two should match the directories in
  313. # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
  314. MCU_FAMILY = STM32
  315. MCU_SERIES = STM32G4xx
  316. # Linker script to use
  317. # - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/
  318. # or <keyboard_dir>/ld/
  319. MCU_LDSCRIPT ?= STM32G474xE
  320. # Startup code to use
  321. # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/
  322. MCU_STARTUP ?= stm32g4xx
  323. # Board: it should exist either in <chibios>/os/hal/boards/,
  324. # <keyboard_dir>/boards/, or drivers/boards/
  325. BOARD ?= GENERIC_STM32_G474XE
  326. USE_FPU ?= yes
  327. # Options to pass to dfu-util when flashing
  328. DFU_ARGS ?= -d 0483:DF11 -a 0 -s 0x08000000:leave
  329. DFU_SUFFIX_ARGS ?= -v 0483 -p DF11
  330. # UF2 settings
  331. UF2_FAMILY ?= STM32G4
  332. endif
  333. ifneq (,$(filter $(MCU),at90usb162 atmega16u2 atmega32u2 atmega16u4 atmega32u4 at90usb646 at90usb647 at90usb1286 at90usb1287))
  334. PROTOCOL = LUFA
  335. # Processor frequency.
  336. # This will define a symbol, F_CPU, in all source code files equal to the
  337. # processor frequency in Hz. You can then use this symbol in your source code to
  338. # calculate timings. Do NOT tack on a 'UL' at the end, this will be done
  339. # automatically to create a 32-bit value in your source code.
  340. #
  341. # This will be an integer division of F_USB below, as it is sourced by
  342. # F_USB after it has run through any CPU prescalers. Note that this value
  343. # does not *change* the processor frequency - it should merely be updated to
  344. # reflect the processor speed set externally so that the code can use accurate
  345. # software delays.
  346. F_CPU ?= 16000000
  347. # LUFA specific
  348. #
  349. # Target architecture (see library "Board Types" documentation).
  350. ARCH = AVR8
  351. # Input clock frequency.
  352. # This will define a symbol, F_USB, in all source code files equal to the
  353. # input clock frequency (before any prescaling is performed) in Hz. This value may
  354. # differ from F_CPU if prescaling is used on the latter, and is required as the
  355. # raw input clock is fed directly to the PLL sections of the AVR for high speed
  356. # clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
  357. # at the end, this will be done automatically to create a 32-bit value in your
  358. # source code.
  359. #
  360. # If no clock division is performed on the input clock inside the AVR (via the
  361. # CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
  362. F_USB ?= $(F_CPU)
  363. # Interrupt driven control endpoint task
  364. ifeq (,$(filter $(NO_INTERRUPT_CONTROL_ENDPOINT),yes))
  365. OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
  366. endif
  367. ifneq (,$(filter $(MCU),at90usb162 atmega16u2 atmega32u2))
  368. NO_I2C = yes
  369. endif
  370. endif
  371. ifneq (,$(filter $(MCU),atmega32a))
  372. # MCU name for avrdude
  373. AVRDUDE_MCU = m32
  374. PROTOCOL = VUSB
  375. # Processor frequency.
  376. # This will define a symbol, F_CPU, in all source code files equal to the
  377. # processor frequency in Hz. You can then use this symbol in your source code to
  378. # calculate timings. Do NOT tack on a 'UL' at the end, this will be done
  379. # automatically to create a 32-bit value in your source code.
  380. F_CPU ?= 12000000
  381. endif
  382. ifneq (,$(filter $(MCU),atmega328p))
  383. # MCU name for avrdude
  384. AVRDUDE_MCU = m328p
  385. PROTOCOL = VUSB
  386. # Processor frequency.
  387. # This will define a symbol, F_CPU, in all source code files equal to the
  388. # processor frequency in Hz. You can then use this symbol in your source code to
  389. # calculate timings. Do NOT tack on a 'UL' at the end, this will be done
  390. # automatically to create a 32-bit value in your source code.
  391. F_CPU ?= 16000000
  392. endif
  393. ifneq (,$(filter $(MCU),atmega328))
  394. # MCU name for avrdude
  395. AVRDUDE_MCU = m328
  396. PROTOCOL = VUSB
  397. # Processor frequency.
  398. # This will define a symbol, F_CPU, in all source code files equal to the
  399. # processor frequency in Hz. You can then use this symbol in your source code to
  400. # calculate timings. Do NOT tack on a 'UL' at the end, this will be done
  401. # automatically to create a 32-bit value in your source code.
  402. F_CPU ?= 16000000
  403. endif
  404. ifneq (,$(filter $(MCU),attiny85))
  405. PROTOCOL = VUSB
  406. # Processor frequency.
  407. # This will define a symbol, F_CPU, in all source code files equal to the
  408. # processor frequency in Hz. You can then use this symbol in your source code to
  409. # calculate timings. Do NOT tack on a 'UL' at the end, this will be done
  410. # automatically to create a 32-bit value in your source code.
  411. F_CPU ?= 16500000
  412. endif