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