mcu_selection.mk 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. ifneq ($(findstring STM32F303, $(MCU)),)
  2. # Cortex version
  3. MCU = cortex-m4
  4. # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
  5. ARMV = 7
  6. ## chip/board settings
  7. # - the next two should match the directories in
  8. # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
  9. MCU_FAMILY = STM32
  10. MCU_SERIES = STM32F3xx
  11. # Linker script to use
  12. # - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/
  13. # or <keyboard_dir>/ld/
  14. MCU_LDSCRIPT ?= STM32F303xC
  15. # Startup code to use
  16. # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/
  17. MCU_STARTUP ?= stm32f3xx
  18. # Board: it should exist either in <chibios>/os/hal/boards/,
  19. # <keyboard_dir>/boards/, or drivers/boards/
  20. BOARD ?= GENERIC_STM32_F303XC
  21. USE_FPU ?= yes
  22. # Options to pass to dfu-util when flashing
  23. DFU_ARGS ?= -d 0483:df11 -a 0 -s 0x08000000:leave
  24. DFU_SUFFIX_ARGS ?= -v 0483 -p df11
  25. endif
  26. ifneq ($(findstring STM32F072, $(MCU)),)
  27. # Cortex version
  28. MCU = cortex-m0
  29. # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
  30. ARMV = 6
  31. ## chip/board settings
  32. # - the next two should match the directories in
  33. # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
  34. MCU_FAMILY = STM32
  35. MCU_SERIES = STM32F0xx
  36. # Linker script to use
  37. # - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/
  38. # or <keyboard_dir>/ld/
  39. MCU_LDSCRIPT ?= STM32F072xB
  40. # Startup code to use
  41. # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/
  42. MCU_STARTUP ?= stm32f0xx
  43. # Board: it should exist either in <chibios>/os/hal/boards/,
  44. # <keyboard_dir>/boards/, or drivers/boards/
  45. BOARD ?= ST_STM32F072B_DISCOVERY
  46. USE_FPU ?= no
  47. # Options to pass to dfu-util when flashing
  48. DFU_ARGS ?= -d 0483:df11 -a 0 -s 0x08000000:leave
  49. DFU_SUFFIX_ARGS ?= -v 0483 -p df11
  50. endif
  51. ifneq ($(findstring STM32F042, $(MCU)),)
  52. # Cortex version
  53. MCU = cortex-m0
  54. # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
  55. ARMV = 6
  56. ## chip/board settings
  57. # - the next two should match the directories in
  58. # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
  59. MCU_FAMILY = STM32
  60. MCU_SERIES = STM32F0xx
  61. # Linker script to use
  62. # - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/
  63. # or <keyboard_dir>/ld/
  64. MCU_LDSCRIPT ?= STM32F042x6
  65. # Startup code to use
  66. # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/
  67. MCU_STARTUP ?= stm32f0xx
  68. # Board: it should exist either in <chibios>/os/hal/boards/,
  69. # <keyboard_dir>/boards/, or drivers/boards/
  70. BOARD ?= GENERIC_STM32_F042X6
  71. USE_FPU ?= no
  72. # Options to pass to dfu-util when flashing
  73. DFU_ARGS ?= -d 0483:df11 -a 0 -s 0x08000000:leave
  74. DFU_SUFFIX_ARGS ?= -v 0483 -p df11
  75. endif
  76. ifneq ($(findstring STM32F103, $(MCU)),)
  77. # Cortex version
  78. MCU = cortex-m3
  79. # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
  80. ARMV = 7
  81. ## chip/board settings
  82. # - the next two should match the directories in
  83. # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
  84. MCU_FAMILY = STM32
  85. MCU_SERIES = STM32F1xx
  86. # Linker script to use
  87. # - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/
  88. # or <keyboard_dir>/ld/
  89. MCU_LDSCRIPT ?= STM32F103x8
  90. # Startup code to use
  91. # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/
  92. MCU_STARTUP ?= stm32f1xx
  93. # Board: it should exist either in <chibios>/os/hal/boards/,
  94. # <keyboard_dir>/boards/, or drivers/boards/
  95. BOARD ?= GENERIC_STM32_F103
  96. USE_FPU ?= no
  97. # Options to pass to dfu-util when flashing
  98. DFU_ARGS ?= -d 0483:df11 -a 0 -s 0x08000000:leave
  99. DFU_SUFFIX_ARGS ?= -v 0483 -p df11
  100. endif
  101. ifneq (,$(filter $(MCU),atmega16u2 atmega32u2 atmega16u4 atmega32u4 at90usb646 at90usb1286))
  102. # Processor frequency.
  103. # This will define a symbol, F_CPU, in all source code files equal to the
  104. # processor frequency in Hz. You can then use this symbol in your source code to
  105. # calculate timings. Do NOT tack on a 'UL' at the end, this will be done
  106. # automatically to create a 32-bit value in your source code.
  107. #
  108. # This will be an integer division of F_USB below, as it is sourced by
  109. # F_USB after it has run through any CPU prescalers. Note that this value
  110. # does not *change* the processor frequency - it should merely be updated to
  111. # reflect the processor speed set externally so that the code can use accurate
  112. # software delays.
  113. F_CPU ?= 16000000
  114. # LUFA specific
  115. #
  116. # Target architecture (see library "Board Types" documentation).
  117. ARCH = AVR8
  118. # Input clock frequency.
  119. # This will define a symbol, F_USB, in all source code files equal to the
  120. # input clock frequency (before any prescaling is performed) in Hz. This value may
  121. # differ from F_CPU if prescaling is used on the latter, and is required as the
  122. # raw input clock is fed directly to the PLL sections of the AVR for high speed
  123. # clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
  124. # at the end, this will be done automatically to create a 32-bit value in your
  125. # source code.
  126. #
  127. # If no clock division is performed on the input clock inside the AVR (via the
  128. # CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
  129. F_USB ?= $(F_CPU)
  130. # Interrupt driven control endpoint task
  131. ifeq (,$(filter $(NO_INTERRUPT_CONTROL_ENDPOINT),yes))
  132. OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
  133. endif
  134. endif
  135. ifneq (,$(filter $(MCU),atmega32a))
  136. # MCU name for avrdude
  137. AVRDUDE_MCU = m32
  138. PROTOCOL = VUSB
  139. # Processor frequency.
  140. # This will define a symbol, F_CPU, in all source code files equal to the
  141. # processor frequency in Hz. You can then use this symbol in your source code to
  142. # calculate timings. Do NOT tack on a 'UL' at the end, this will be done
  143. # automatically to create a 32-bit value in your source code.
  144. F_CPU ?= 12000000
  145. # unsupported features for now
  146. NO_UART ?= yes
  147. NO_SUSPEND_POWER_DOWN ?= yes
  148. endif
  149. ifneq (,$(filter $(MCU),atmega328p))
  150. # MCU name for avrdude
  151. AVRDUDE_MCU = m328p
  152. PROTOCOL = VUSB
  153. # Processor frequency.
  154. # This will define a symbol, F_CPU, in all source code files equal to the
  155. # processor frequency in Hz. You can then use this symbol in your source code to
  156. # calculate timings. Do NOT tack on a 'UL' at the end, this will be done
  157. # automatically to create a 32-bit value in your source code.
  158. F_CPU ?= 16000000
  159. # unsupported features for now
  160. NO_UART ?= yes
  161. NO_SUSPEND_POWER_DOWN ?= yes
  162. endif