diff options
author | Joel Challis <git@zvecr.com> | 2021-10-28 01:07:53 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-28 01:07:53 +0100 |
commit | b780c797beb726839e99e3f4054f9b4c33331cdc (patch) | |
tree | 019aed772e8204149727afb0841f9043a7084eda /builddefs | |
parent | 6c507afcf212165dd5f3c3f6c026b517295c5090 (diff) | |
download | qmk_firmware-b780c797beb726839e99e3f4054f9b4c33331cdc.tar.gz qmk_firmware-b780c797beb726839e99e3f4054f9b4c33331cdc.zip |
Migrate makefile utilities to sub-directory (#14917)
Diffstat (limited to 'builddefs')
-rw-r--r-- | builddefs/bootloader.mk | 163 | ||||
-rw-r--r-- | builddefs/disable_features.mk | 28 | ||||
-rw-r--r-- | builddefs/generic_features.mk | 49 | ||||
-rw-r--r-- | builddefs/mcu_selection.mk | 668 | ||||
-rw-r--r-- | builddefs/message.mk | 102 | ||||
-rw-r--r-- | builddefs/show_options.mk | 147 |
6 files changed, 1157 insertions, 0 deletions
diff --git a/builddefs/bootloader.mk b/builddefs/bootloader.mk new file mode 100644 index 000000000..ccb92392d --- /dev/null +++ b/builddefs/bootloader.mk | |||
@@ -0,0 +1,163 @@ | |||
1 | # Copyright 2017 Jack Humbert | ||
2 | # | ||
3 | # This program is free software: you can redistribute it and/or modify | ||
4 | # it under the terms of the GNU General Public License as published by | ||
5 | # the Free Software Foundation, either version 2 of the License, or | ||
6 | # (at your option) any later version. | ||
7 | # | ||
8 | # This program is distributed in the hope that it will be useful, | ||
9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | # GNU General Public License for more details. | ||
12 | # | ||
13 | # You should have received a copy of the GNU General Public License | ||
14 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | |||
16 | # If it's possible that multiple bootloaders can be used for one project, | ||
17 | # you can leave this unset, and the correct size will be selected | ||
18 | # automatically. | ||
19 | # | ||
20 | # Sets the bootloader defined in the keyboard's/keymap's rules.mk | ||
21 | # Current options: | ||
22 | # | ||
23 | # AVR: | ||
24 | # halfkay PJRC Teensy | ||
25 | # caterina Pro Micro (Sparkfun/generic) | ||
26 | # atmel-dfu Atmel factory DFU | ||
27 | # lufa-dfu LUFA DFU | ||
28 | # qmk-dfu QMK DFU (LUFA + blinkenlight) | ||
29 | # qmk-hid QMK HID (LUFA + blinkenlight) | ||
30 | # bootloadhid HIDBootFlash compatible (ATmega32A) | ||
31 | # usbasploader USBaspLoader (ATmega328P) | ||
32 | # ARM: | ||
33 | # kiibohd Input:Club Kiibohd bootloader (only used on their boards) | ||
34 | # stm32duino STM32Duino (STM32F103x8) | ||
35 | # stm32-dfu STM32 USB DFU in ROM | ||
36 | # apm32-dfu APM32 USB DFU in ROM | ||
37 | # RISC-V: | ||
38 | # gd32v-dfu GD32V USB DFU in ROM | ||
39 | # | ||
40 | # BOOTLOADER_SIZE can still be defined manually, but it's recommended | ||
41 | # you add any possible configuration to this list | ||
42 | |||
43 | ifeq ($(strip $(BOOTLOADER)), atmel-dfu) | ||
44 | OPT_DEFS += -DBOOTLOADER_ATMEL_DFU | ||
45 | OPT_DEFS += -DBOOTLOADER_DFU | ||
46 | ifneq (,$(filter $(MCU), at90usb162 atmega16u2 atmega32u2 atmega16u4 atmega32u4 at90usb646 at90usb647)) | ||
47 | BOOTLOADER_SIZE = 4096 | ||
48 | endif | ||
49 | ifneq (,$(filter $(MCU), at90usb1286 at90usb1287)) | ||
50 | BOOTLOADER_SIZE = 8192 | ||
51 | endif | ||
52 | endif | ||
53 | ifeq ($(strip $(BOOTLOADER)), lufa-dfu) | ||
54 | OPT_DEFS += -DBOOTLOADER_LUFA_DFU | ||
55 | OPT_DEFS += -DBOOTLOADER_DFU | ||
56 | ifneq (,$(filter $(MCU), at90usb162 atmega16u2 atmega32u2 atmega16u4 atmega32u4 at90usb646 at90usb647)) | ||
57 | BOOTLOADER_SIZE ?= 4096 | ||
58 | endif | ||
59 | ifneq (,$(filter $(MCU), at90usb1286 at90usb1287)) | ||
60 | BOOTLOADER_SIZE ?= 8192 | ||
61 | endif | ||
62 | endif | ||
63 | ifeq ($(strip $(BOOTLOADER)), qmk-dfu) | ||
64 | OPT_DEFS += -DBOOTLOADER_QMK_DFU | ||
65 | OPT_DEFS += -DBOOTLOADER_DFU | ||
66 | ifneq (,$(filter $(MCU), at90usb162 atmega16u2 atmega32u2 atmega16u4 atmega32u4 at90usb646 at90usb647)) | ||
67 | BOOTLOADER_SIZE ?= 4096 | ||
68 | endif | ||
69 | ifneq (,$(filter $(MCU), at90usb1286 at90usb1287)) | ||
70 | BOOTLOADER_SIZE ?= 8192 | ||
71 | endif | ||
72 | endif | ||
73 | ifeq ($(strip $(BOOTLOADER)), qmk-hid) | ||
74 | OPT_DEFS += -DBOOTLOADER_QMK_HID | ||
75 | OPT_DEFS += -DBOOTLOADER_HID | ||
76 | BOOTLOADER_SIZE ?= 4096 | ||
77 | endif | ||
78 | ifeq ($(strip $(BOOTLOADER)), halfkay) | ||
79 | OPT_DEFS += -DBOOTLOADER_HALFKAY | ||
80 | ifeq ($(strip $(MCU)), atmega32u4) | ||
81 | BOOTLOADER_SIZE = 512 | ||
82 | endif | ||
83 | ifeq ($(strip $(MCU)), at90usb1286) | ||
84 | BOOTLOADER_SIZE = 1024 | ||
85 | endif | ||
86 | endif | ||
87 | ifeq ($(strip $(BOOTLOADER)), caterina) | ||
88 | OPT_DEFS += -DBOOTLOADER_CATERINA | ||
89 | BOOTLOADER_SIZE = 4096 | ||
90 | endif | ||
91 | ifneq (,$(filter $(BOOTLOADER), bootloadhid bootloadHID)) | ||
92 | OPT_DEFS += -DBOOTLOADER_BOOTLOADHID | ||
93 | BOOTLOADER_SIZE = 4096 | ||
94 | endif | ||
95 | ifneq (,$(filter $(BOOTLOADER), usbasploader USBasp)) | ||
96 | OPT_DEFS += -DBOOTLOADER_USBASP | ||
97 | BOOTLOADER_SIZE = 4096 | ||
98 | endif | ||
99 | ifeq ($(strip $(BOOTLOADER)), lufa-ms) | ||
100 | OPT_DEFS += -DBOOTLOADER_MS | ||
101 | BOOTLOADER_SIZE ?= 8192 | ||
102 | FIRMWARE_FORMAT = bin | ||
103 | cpfirmware: lufa_warning | ||
104 | .INTERMEDIATE: lufa_warning | ||
105 | lufa_warning: $(FIRMWARE_FORMAT) | ||
106 | $(info @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@) | ||
107 | $(info LUFA MASS STORAGE Bootloader selected) | ||
108 | $(info DO NOT USE THIS BOOTLOADER IN NEW PROJECTS!) | ||
109 | $(info It is extremely prone to bricking, and is only included to support existing boards.) | ||
110 | $(info @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@) | ||
111 | endif | ||
112 | ifdef BOOTLOADER_SIZE | ||
113 | OPT_DEFS += -DBOOTLOADER_SIZE=$(strip $(BOOTLOADER_SIZE)) | ||
114 | endif | ||
115 | |||
116 | ifeq ($(strip $(BOOTLOADER)), stm32-dfu) | ||
117 | OPT_DEFS += -DBOOTLOADER_STM32_DFU | ||
118 | |||
119 | # Options to pass to dfu-util when flashing | ||
120 | DFU_ARGS ?= -d 0483:DF11 -a 0 -s 0x08000000:leave | ||
121 | DFU_SUFFIX_ARGS ?= -v 0483 -p DF11 | ||
122 | endif | ||
123 | ifeq ($(strip $(BOOTLOADER)), apm32-dfu) | ||
124 | OPT_DEFS += -DBOOTLOADER_APM32_DFU | ||
125 | |||
126 | # Options to pass to dfu-util when flashing | ||
127 | DFU_ARGS ?= -d 314B:0106 -a 0 -s 0x08000000:leave | ||
128 | DFU_SUFFIX_ARGS ?= -v 314B -p 0106 | ||
129 | endif | ||
130 | ifeq ($(strip $(BOOTLOADER)), gd32v-dfu) | ||
131 | OPT_DEFS += -DBOOTLOADER_GD32V_DFU | ||
132 | |||
133 | # Options to pass to dfu-util when flashing | ||
134 | DFU_ARGS ?= -d 28E9:0189 -a 0 -s 0x08000000:leave | ||
135 | DFU_SUFFIX_ARGS ?= -v 28E9 -p 0189 | ||
136 | endif | ||
137 | ifeq ($(strip $(BOOTLOADER)), kiibohd) | ||
138 | OPT_DEFS += -DBOOTLOADER_KIIBOHD | ||
139 | ifeq ($(strip $(MCU_ORIG)), MK20DX128) | ||
140 | MCU_LDSCRIPT = MK20DX128BLDR4 | ||
141 | endif | ||
142 | ifeq ($(strip $(MCU_ORIG)), MK20DX256) | ||
143 | MCU_LDSCRIPT = MK20DX256BLDR8 | ||
144 | endif | ||
145 | |||
146 | # Options to pass to dfu-util when flashing | ||
147 | DFU_ARGS = -d 1C11:B007 | ||
148 | DFU_SUFFIX_ARGS = -v 1C11 -p B007 | ||
149 | endif | ||
150 | ifeq ($(strip $(BOOTLOADER)), stm32duino) | ||
151 | OPT_DEFS += -DBOOTLOADER_STM32DUINO | ||
152 | MCU_LDSCRIPT = STM32F103x8_stm32duino_bootloader | ||
153 | BOARD = STM32_F103_STM32DUINO | ||
154 | # STM32F103 does NOT have an USB bootloader in ROM (only serial), so setting anything here does not make much sense | ||
155 | STM32_BOOTLOADER_ADDRESS = 0x80000000 | ||
156 | |||
157 | # Options to pass to dfu-util when flashing | ||
158 | DFU_ARGS = -d 1EAF:0003 -a 2 -R | ||
159 | DFU_SUFFIX_ARGS = -v 1EAF -p 0003 | ||
160 | endif | ||
161 | ifeq ($(strip $(BOOTLOADER)), tinyuf2) | ||
162 | OPT_DEFS += -DBOOTLOADER_TINYUF2 | ||
163 | endif | ||
diff --git a/builddefs/disable_features.mk b/builddefs/disable_features.mk new file mode 100644 index 000000000..090a9b5a1 --- /dev/null +++ b/builddefs/disable_features.mk | |||
@@ -0,0 +1,28 @@ | |||
1 | # Unconditionally disable features that a keyboard advertises it doesn't support | ||
2 | |||
3 | FEATURE_NAMES := | ||
4 | FEATURE_NAMES += AUDIO | ||
5 | FEATURE_NAMES += BACKLIGHT | ||
6 | FEATURE_NAMES += BLUETOOTH | ||
7 | FEATURE_NAMES += DIP_SWITCH | ||
8 | FEATURE_NAMES += DYNAMIC_KEYMAP | ||
9 | FEATURE_NAMES += ENCODER | ||
10 | FEATURE_NAMES += HAPTIC | ||
11 | FEATURE_NAMES += HD44780 | ||
12 | FEATURE_NAMES += IOS_DEVICE | ||
13 | FEATURE_NAMES += LCD_BACKLIGHT | ||
14 | FEATURE_NAMES += LCD | ||
15 | FEATURE_NAMES += OLED | ||
16 | FEATURE_NAMES += POINTING_DEVICE | ||
17 | FEATURE_NAMES += PRINTING | ||
18 | FEATURE_NAMES += PS2_MOUSE | ||
19 | FEATURE_NAMES += RGBLIGHT | ||
20 | FEATURE_NAMES += RGB_MATRIX | ||
21 | FEATURE_NAMES += SLEEP_LED | ||
22 | FEATURE_NAMES += STENO | ||
23 | FEATURE_NAMES += SWAP_HANDS | ||
24 | FEATURE_NAMES += WATCHDOG | ||
25 | FEATURE_NAMES += XT | ||
26 | |||
27 | $(foreach AFEATURE,$(FEATURE_NAMES),\ | ||
28 | $(if $(filter $($(AFEATURE)_SUPPORTED),no),$(eval $(AFEATURE)_ENABLE=no))) | ||
diff --git a/builddefs/generic_features.mk b/builddefs/generic_features.mk new file mode 100644 index 000000000..ff02d56bb --- /dev/null +++ b/builddefs/generic_features.mk | |||
@@ -0,0 +1,49 @@ | |||
1 | # Copyright 2021 QMK | ||
2 | # | ||
3 | # This program is free software: you can redistribute it and/or modify | ||
4 | # it under the terms of the GNU General Public License as published by | ||
5 | # the Free Software Foundation, either version 2 of the License, or | ||
6 | # (at your option) any later version. | ||
7 | # | ||
8 | # This program is distributed in the hope that it will be useful, | ||
9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | # GNU General Public License for more details. | ||
12 | # | ||
13 | # You should have received a copy of the GNU General Public License | ||
14 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | |||
16 | SPACE_CADET_ENABLE ?= yes | ||
17 | GRAVE_ESC_ENABLE ?= yes | ||
18 | |||
19 | GENERIC_FEATURES = \ | ||
20 | COMBO \ | ||
21 | COMMAND \ | ||
22 | DIGITIZER \ | ||
23 | DIP_SWITCH \ | ||
24 | DYNAMIC_KEYMAP \ | ||
25 | DYNAMIC_MACRO \ | ||
26 | ENCODER \ | ||
27 | GRAVE_ESC \ | ||
28 | HAPTIC \ | ||
29 | KEY_LOCK \ | ||
30 | KEY_OVERRIDE \ | ||
31 | LEADER \ | ||
32 | PROGRAMMABLE_BUTTON \ | ||
33 | SPACE_CADET \ | ||
34 | TAP_DANCE \ | ||
35 | VELOCIKEY \ | ||
36 | WPM \ | ||
37 | |||
38 | define HANDLE_GENERIC_FEATURE | ||
39 | # $$(info "Processing: $1_ENABLE $2.c") | ||
40 | SRC += $$(wildcard $$(QUANTUM_DIR)/process_keycode/process_$2.c) | ||
41 | SRC += $$(wildcard $$(QUANTUM_DIR)/$2.c) | ||
42 | OPT_DEFS += -D$1_ENABLE | ||
43 | endef | ||
44 | |||
45 | $(foreach F,$(GENERIC_FEATURES),\ | ||
46 | $(if $(filter yes, $(strip $($(F)_ENABLE))),\ | ||
47 | $(eval $(call HANDLE_GENERIC_FEATURE,$(F),$(shell echo $(F) | tr '[:upper:]' '[:lower:]'))) \ | ||
48 | ) \ | ||
49 | ) | ||
diff --git a/builddefs/mcu_selection.mk b/builddefs/mcu_selection.mk new file mode 100644 index 000000000..1251b7a2b --- /dev/null +++ b/builddefs/mcu_selection.mk | |||
@@ -0,0 +1,668 @@ | |||
1 | MCU_ORIG := $(MCU) | ||
2 | |||
3 | ifneq ($(findstring MKL26Z64, $(MCU)),) | ||
4 | # Cortex version | ||
5 | MCU = cortex-m0plus | ||
6 | |||
7 | # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7 | ||
8 | ARMV = 6 | ||
9 | |||
10 | ## chip/board settings | ||
11 | # - the next two should match the directories in | ||
12 | # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES) | ||
13 | MCU_FAMILY = KINETIS | ||
14 | MCU_SERIES = KL2x | ||
15 | |||
16 | # Linker script to use | ||
17 | # - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/ | ||
18 | # or <keyboard_dir>/ld/ | ||
19 | MCU_LDSCRIPT ?= MKL26Z64 | ||
20 | |||
21 | # Startup code to use | ||
22 | # - it should exist in <chibios>/os/common/ports/ARMCMx/compilers/GCC/mk/ | ||
23 | MCU_STARTUP ?= kl2x | ||
24 | |||
25 | # Board: it should exist either in <chibios>/os/hal/boards/, | ||
26 | # <keyboard_dir>/boards/, or drivers/boards/ | ||
27 | BOARD ?= PJRC_TEENSY_LC | ||
28 | endif | ||
29 | |||
30 | ifneq ($(findstring MK20DX128, $(MCU)),) | ||
31 | # Cortex version | ||
32 | MCU = cortex-m4 | ||
33 | |||
34 | # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7 | ||
35 | ARMV = 7 | ||
36 | |||
37 | ## chip/board settings | ||
38 | # - the next two should match the directories in | ||
39 | # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES) | ||
40 | MCU_FAMILY = KINETIS | ||
41 | MCU_SERIES = K20x | ||
42 | |||
43 | # Linker script to use | ||
44 | # - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/ | ||
45 | # or <keyboard_dir>/ld/ | ||
46 | MCU_LDSCRIPT ?= MK20DX128 | ||
47 | |||
48 | # Startup code to use | ||
49 | # - it should exist in <chibios>/os/common/ports/ARMCMx/compilers/GCC/mk/ | ||
50 | MCU_STARTUP ?= k20x5 | ||
51 | |||
52 | # Board: it should exist either in <chibios>/os/hal/boards/, | ||
53 | # <keyboard_dir>/boards/, or drivers/boards/ | ||
54 | BOARD ?= PJRC_TEENSY_3 | ||
55 | endif | ||
56 | |||
57 | ifneq ($(findstring MK20DX256, $(MCU)),) | ||
58 | # Cortex version | ||
59 | MCU = cortex-m4 | ||
60 | |||
61 | # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7 | ||
62 | ARMV = 7 | ||
63 | |||
64 | ## chip/board settings | ||
65 | # - the next two should match the directories in | ||
66 | # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES) | ||
67 | MCU_FAMILY = KINETIS | ||
68 | MCU_SERIES = K20x | ||
69 | |||
70 | # Linker script to use | ||
71 | # - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/ | ||
72 | # or <keyboard_dir>/ld/ | ||
73 | MCU_LDSCRIPT ?= MK20DX256 | ||
74 | |||
75 | # Startup code to use | ||
76 | # - it should exist in <chibios>/os/common/ports/ARMCMx/compilers/GCC/mk/ | ||
77 | MCU_STARTUP ?= k20x7 | ||
78 | |||
79 | # Board: it should exist either in <chibios>/os/hal/boards/, | ||
80 | # <keyboard_dir>/boards/, or drivers/boards/ | ||
81 | BOARD ?= PJRC_TEENSY_3_1 | ||
82 | endif | ||
83 | |||
84 | ifneq ($(findstring MK66FX1M0, $(MCU)),) | ||
85 | # Cortex version | ||
86 | MCU = cortex-m4 | ||
87 | |||
88 | # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7 | ||
89 | ARMV = 7 | ||
90 | |||
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 = KINETIS | ||
95 | MCU_SERIES = MK66F18 | ||
96 | |||
97 | # Linker script to use | ||
98 | # - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/ | ||
99 | # or <keyboard_dir>/ld/ | ||
100 | MCU_LDSCRIPT ?= MK66FX1M0 | ||
101 | |||
102 | # Startup code to use | ||
103 | # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/ | ||
104 | MCU_STARTUP ?= MK66F18 | ||
105 | |||
106 | # Board: it should exist either in <chibios>/os/hal/boards/, | ||
107 | # <keyboard_dir>/boards/, or drivers/boards/ | ||
108 | BOARD ?= PJRC_TEENSY_3_6 | ||
109 | endif | ||
110 | |||
111 | ifneq ($(findstring STM32F042, $(MCU)),) | ||
112 | # Cortex version | ||
113 | MCU = cortex-m0 | ||
114 | |||
115 | # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7 | ||
116 | ARMV = 6 | ||
117 | |||
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 | |||
124 | # Linker script to use | ||
125 | # - it should exist either in <chibios>/os/common/startup/ARMCMx/compilers/GCC/ld/ | ||
126 | # or <keyboard_dir>/ld/ | ||
127 | MCU_LDSCRIPT ?= STM32F042x6 | ||
128 | |||
129 | # Startup code to use | ||
130 | # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/ | ||
131 | MCU_STARTUP ?= stm32f0xx | ||
132 | |||
133 | # Board: it should exist either in <chibios>/os/hal/boards/, | ||
134 | # <keyboard_dir>/boards/, or drivers/boards/ | ||
135 | BOARD ?= GENERIC_STM32_F042X6 | ||
136 | |||
137 | USE_FPU ?= no | ||
138 | |||
139 | # UF2 settings | ||
140 | UF2_FAMILY ?= STM32F0 | ||
141 | |||
142 | # Stack sizes: Since this chip has limited RAM capacity, the stack area needs to be reduced. | ||
143 | # This ensures that the EEPROM page buffer fits into RAM | ||
144 | USE_PROCESS_STACKSIZE = 0x600 | ||
145 | USE_EXCEPTIONS_STACKSIZE = 0x300 | ||
146 | endif | ||
147 | |||
148 | ifneq ($(findstring STM32F072, $(MCU)),) | ||
149 | # Cortex version | ||
150 | MCU = cortex-m0 | ||
151 | |||
152 | # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7 | ||
153 | ARMV = 6 | ||
154 | |||
155 | ## chip/board settings | ||
156 | # - the next two should match the directories in | ||
157 | # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES) | ||
158 | MCU_FAMILY = STM32 | ||
159 | MCU_SERIES = STM32F0xx | ||
160 | |||
161 | # Linker script to use | ||
162 | # - it should exist either in <chibios>/os/common/startup/ARMCMx/compilers/GCC/ld/ | ||
163 | # or <keyboard_dir>/ld/ | ||
164 | MCU_LDSCRIPT ?= STM32F072xB | ||
165 | |||
166 | # Startup code to use | ||
167 | # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/ | ||
168 | MCU_STARTUP ?= stm32f0xx | ||
169 | |||
170 | # Board: it should exist either in <chibios>/os/hal/boards/, | ||
171 | # <keyboard_dir>/boards/, or drivers/boards/ | ||
172 | BOARD ?= GENERIC_STM32_F072XB | ||
173 | |||
174 | USE_FPU ?= no | ||
175 | |||
176 | # UF2 settings | ||
177 | UF2_FAMILY ?= STM32F0 | ||
178 | endif | ||
179 | |||
180 | ifneq ($(findstring STM32F103, $(MCU)),) | ||
181 | # Cortex version | ||
182 | MCU = cortex-m3 | ||
183 | |||
184 | # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7 | ||
185 | ARMV = 7 | ||
186 | |||
187 | ## chip/board settings | ||
188 | # - the next two should match the directories in | ||
189 | # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES) | ||
190 | MCU_FAMILY = STM32 | ||
191 | MCU_SERIES = STM32F1xx | ||
192 | |||
193 | # Linker script to use | ||
194 | # - it should exist either in <chibios>/os/common/startup/ARMCMx/compilers/GCC/ld/ | ||
195 | # or <keyboard_dir>/ld/ | ||
196 | MCU_LDSCRIPT ?= STM32F103x8 | ||
197 | |||
198 | # Startup code to use | ||
199 | # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/ | ||
200 | MCU_STARTUP ?= stm32f1xx | ||
201 | |||
202 | # Board: it should exist either in <chibios>/os/hal/boards/, | ||
203 | # <keyboard_dir>/boards/, or drivers/boards/ | ||
204 | BOARD ?= GENERIC_STM32_F103 | ||
205 | |||
206 | USE_FPU ?= no | ||
207 | |||
208 | # UF2 settings | ||
209 | UF2_FAMILY ?= STM32F1 | ||
210 | endif | ||
211 | |||
212 | ifneq ($(findstring STM32F303, $(MCU)),) | ||
213 | # Cortex version | ||
214 | MCU = cortex-m4 | ||
215 | |||
216 | # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7 | ||
217 | ARMV = 7 | ||
218 | |||
219 | ## chip/board settings | ||
220 | # - the next two should match the directories in | ||
221 | # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES) | ||
222 | MCU_FAMILY = STM32 | ||
223 | MCU_SERIES = STM32F3xx | ||
224 | |||
225 | # Linker script to use | ||
226 | # - it should exist either in <chibios>/os/common/startup/ARMCMx/compilers/GCC/ld/ | ||
227 | # or <keyboard_dir>/ld/ | ||
228 | MCU_LDSCRIPT ?= STM32F303xC | ||
229 | |||
230 | # Startup code to use | ||
231 | # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/ | ||
232 | MCU_STARTUP ?= stm32f3xx | ||
233 | |||
234 | # Board: it should exist either in <chibios>/os/hal/boards/, | ||
235 | # <keyboard_dir>/boards/, or drivers/boards/ | ||
236 | BOARD ?= GENERIC_STM32_F303XC | ||
237 | |||
238 | USE_FPU ?= yes | ||
239 | |||
240 | # UF2 settings | ||
241 | UF2_FAMILY ?= STM32F3 | ||
242 | endif | ||
243 | |||
244 | ifneq ($(findstring STM32F401, $(MCU)),) | ||
245 | # Cortex version | ||
246 | MCU = cortex-m4 | ||
247 | |||
248 | # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7 | ||
249 | ARMV = 7 | ||
250 | |||
251 | ## chip/board settings | ||
252 | # - the next two should match the directories in | ||
253 | # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES) | ||
254 | MCU_FAMILY = STM32 | ||
255 | MCU_SERIES = STM32F4xx | ||
256 | |||
257 | # Linker script to use | ||
258 | # - it should exist either in <chibios>/os/common/startup/ARMCMx/compilers/GCC/ld/ | ||
259 | # or <keyboard_dir>/ld/ | ||
260 | ifeq ($(strip $(BOOTLOADER)), tinyuf2) | ||
261 | MCU_LDSCRIPT ?= STM32F401xC_tinyuf2 | ||
262 | FIRMWARE_FORMAT ?= uf2 | ||
263 | else | ||
264 | MCU_LDSCRIPT ?= STM32F401xC | ||
265 | endif | ||
266 | |||
267 | # Startup code to use | ||
268 | # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/ | ||
269 | MCU_STARTUP ?= stm32f4xx | ||
270 | |||
271 | # Board: it should exist either in <chibios>/os/hal/boards/, | ||
272 | # <keyboard_dir>/boards/, or drivers/boards/ | ||
273 | BOARD ?= BLACKPILL_STM32_F401 | ||
274 | |||
275 | USE_FPU ?= yes | ||
276 | |||
277 | # UF2 settings | ||
278 | UF2_FAMILY ?= STM32F4 | ||
279 | endif | ||
280 | |||
281 | ifneq ($(findstring STM32F405, $(MCU)),) | ||
282 | # Cortex version | ||
283 | MCU = cortex-m4 | ||
284 | |||
285 | # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7 | ||
286 | ARMV = 7 | ||
287 | |||
288 | ## chip/board settings | ||
289 | # - the next two should match the directories in | ||
290 | # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES) | ||
291 | MCU_FAMILY = STM32 | ||
292 | MCU_SERIES = STM32F4xx | ||
293 | |||
294 | # Linker script to use | ||
295 | # - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/ | ||
296 | # or <keyboard_dir>/ld/ | ||
297 | MCU_LDSCRIPT ?= STM32F405xG | ||
298 | |||
299 | # Startup code to use | ||
300 | # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/ | ||
301 | MCU_STARTUP ?= stm32f4xx | ||
302 | |||
303 | # Board: it should exist either in <chibios>/os/hal/boards/, | ||
304 | # <keyboard_dir>/boards/, or drivers/boards/ | ||
305 | BOARD ?= GENERIC_STM32_F405XG | ||
306 | |||
307 | USE_FPU ?= yes | ||
308 | |||
309 | # UF2 settings | ||
310 | UF2_FAMILY ?= STM32F4 | ||
311 | endif | ||
312 | |||
313 | ifneq ($(findstring STM32F407, $(MCU)),) | ||
314 | # Cortex version | ||
315 | MCU = cortex-m4 | ||
316 | |||
317 | # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7 | ||
318 | ARMV = 7 | ||
319 | |||
320 | ## chip/board settings | ||
321 | # - the next two should match the directories in | ||
322 | # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES) | ||
323 | MCU_FAMILY = STM32 | ||
324 | MCU_SERIES = STM32F4xx | ||
325 | |||
326 | # Linker script to use | ||
327 | # - it should exist either in <chibios>/os/common/startup/ARMCMx/compilers/GCC/ld/ | ||
328 | # or <keyboard_dir>/ld/ | ||
329 | MCU_LDSCRIPT ?= STM32F407xE | ||
330 | |||
331 | # Startup code to use | ||
332 | # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/ | ||
333 | MCU_STARTUP ?= stm32f4xx | ||
334 | |||
335 | # Board: it should exist either in <chibios>/os/hal/boards/, | ||
336 | # <keyboard_dir>/boards/, or drivers/boards/ | ||
337 | BOARD ?= GENERIC_STM32_F407XE | ||
338 | |||
339 | USE_FPU ?= yes | ||
340 | |||
341 | # UF2 settings | ||
342 | UF2_FAMILY ?= STM32F4 | ||
343 | endif | ||
344 | |||
345 | ifneq ($(findstring STM32F411, $(MCU)),) | ||
346 | # Cortex version | ||
347 | MCU = cortex-m4 | ||
348 | |||
349 | # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7 | ||
350 | ARMV = 7 | ||
351 | |||
352 | ## chip/board settings | ||
353 | # - the next two should match the directories in | ||
354 | # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES) | ||
355 | MCU_FAMILY = STM32 | ||
356 | MCU_SERIES = STM32F4xx | ||
357 | |||
358 | # Linker script to use | ||
359 | # - it should exist either in <chibios>/os/common/startup/ARMCMx/compilers/GCC/ld/ | ||
360 | # or <keyboard_dir>/ld/ | ||
361 | ifeq ($(strip $(BOOTLOADER)), tinyuf2) | ||
362 | MCU_LDSCRIPT ?= STM32F411xE_tinyuf2 | ||
363 | FIRMWARE_FORMAT ?= uf2 | ||
364 | else | ||
365 | MCU_LDSCRIPT ?= STM32F411xE | ||
366 | endif | ||
367 | |||
368 | # Startup code to use | ||
369 | # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/ | ||
370 | MCU_STARTUP ?= stm32f4xx | ||
371 | |||
372 | # Board: it should exist either in <chibios>/os/hal/boards/, | ||
373 | # <keyboard_dir>/boards/, or drivers/boards/ | ||
374 | BOARD ?= BLACKPILL_STM32_F411 | ||
375 | |||
376 | USE_FPU ?= yes | ||
377 | |||
378 | # UF2 settings | ||
379 | UF2_FAMILY ?= STM32F4 | ||
380 | endif | ||
381 | |||
382 | ifneq ($(findstring STM32F446, $(MCU)),) | ||
383 | # Cortex version | ||
384 | MCU = cortex-m4 | ||
385 | |||
386 | # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7 | ||
387 | ARMV = 7 | ||
388 | |||
389 | ## chip/board settings | ||
390 | # - the next two should match the directories in | ||
391 | # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES) | ||
392 | MCU_FAMILY = STM32 | ||
393 | MCU_SERIES = STM32F4xx | ||
394 | |||
395 | # Linker script to use | ||
396 | # - it should exist either in <chibios>/os/common/startup/ARMCMx/compilers/GCC/ld/ | ||
397 | # or <keyboard_dir>/ld/ | ||
398 | MCU_LDSCRIPT ?= STM32F446xE | ||
399 | |||
400 | # Startup code to use | ||
401 | # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/ | ||
402 | MCU_STARTUP ?= stm32f4xx | ||
403 | |||
404 | # Board: it should exist either in <chibios>/os/hal/boards/, | ||
405 | # <keyboard_dir>/boards/, or drivers/boards/ | ||
406 | BOARD ?= GENERIC_STM32_F446XE | ||
407 | |||
408 | USE_FPU ?= yes | ||
409 | endif | ||
410 | |||
411 | ifneq ($(findstring STM32G431, $(MCU)),) | ||
412 | # Cortex version | ||
413 | MCU = cortex-m4 | ||
414 | |||
415 | # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7 | ||
416 | ARMV = 7 | ||
417 | |||
418 | ## chip/board settings | ||
419 | # - the next two should match the directories in | ||
420 | # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES) | ||
421 | MCU_FAMILY = STM32 | ||
422 | MCU_SERIES = STM32G4xx | ||
423 | |||
424 | # Linker script to use | ||
425 | # - it should exist either in <chibios>/os/common/startup/ARMCMx/compilers/GCC/ld/ | ||
426 | # or <keyboard_dir>/ld/ | ||
427 | MCU_LDSCRIPT ?= STM32G431xB | ||
428 | |||
429 | # Startup code to use | ||
430 | # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/ | ||
431 | MCU_STARTUP ?= stm32g4xx | ||
432 | |||
433 | # Board: it should exist either in <chibios>/os/hal/boards/, | ||
434 | # <keyboard_dir>/boards/, or drivers/boards/ | ||
435 | BOARD ?= GENERIC_STM32_G431XB | ||
436 | |||
437 | USE_FPU ?= yes | ||
438 | |||
439 | # UF2 settings | ||
440 | UF2_FAMILY ?= STM32G4 | ||
441 | endif | ||
442 | |||
443 | ifneq ($(findstring STM32G474, $(MCU)),) | ||
444 | # Cortex version | ||
445 | MCU = cortex-m4 | ||
446 | |||
447 | # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7 | ||
448 | ARMV = 7 | ||
449 | |||
450 | ## chip/board settings | ||
451 | # - the next two should match the directories in | ||
452 | # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES) | ||
453 | MCU_FAMILY = STM32 | ||
454 | MCU_SERIES = STM32G4xx | ||
455 | |||
456 | # Linker script to use | ||
457 | # - it should exist either in <chibios>/os/common/startup/ARMCMx/compilers/GCC/ld/ | ||
458 | # or <keyboard_dir>/ld/ | ||
459 | MCU_LDSCRIPT ?= STM32G474xE | ||
460 | |||
461 | # Startup code to use | ||
462 | # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/ | ||
463 | MCU_STARTUP ?= stm32g4xx | ||
464 | |||
465 | # Board: it should exist either in <chibios>/os/hal/boards/, | ||
466 | # <keyboard_dir>/boards/, or drivers/boards/ | ||
467 | BOARD ?= GENERIC_STM32_G474XE | ||
468 | |||
469 | USE_FPU ?= yes | ||
470 | |||
471 | # UF2 settings | ||
472 | UF2_FAMILY ?= STM32G4 | ||
473 | endif | ||
474 | |||
475 | ifneq (,$(filter $(MCU),STM32L433 STM32L443)) | ||
476 | # Cortex version | ||
477 | MCU = cortex-m4 | ||
478 | |||
479 | # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7 | ||
480 | ARMV = 7 | ||
481 | |||
482 | ## chip/board settings | ||
483 | # - the next two should match the directories in | ||
484 | # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES) | ||
485 | MCU_FAMILY = STM32 | ||
486 | MCU_SERIES = STM32L4xx | ||
487 | |||
488 | # Linker script to use | ||
489 | # - it should exist either in <chibios>/os/common/startup/ARMCMx/compilers/GCC/ld/ | ||
490 | # or <keyboard_dir>/ld/ | ||
491 | MCU_LDSCRIPT ?= STM32L432xC | ||
492 | |||
493 | # Startup code to use | ||
494 | # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/ | ||
495 | MCU_STARTUP ?= stm32l4xx | ||
496 | |||
497 | # Board: it should exist either in <chibios>/os/hal/boards/, | ||
498 | # <keyboard_dir>/boards/, or drivers/boards/ | ||
499 | BOARD ?= GENERIC_STM32_L433XC | ||
500 | |||
501 | PLATFORM_NAME ?= platform_l432 | ||
502 | |||
503 | USE_FPU ?= yes | ||
504 | |||
505 | # UF2 settings | ||
506 | UF2_FAMILY ?= STM32L4 | ||
507 | endif | ||
508 | |||
509 | ifneq (,$(filter $(MCU),STM32L412 STM32L422)) | ||
510 | # Cortex version | ||
511 | MCU = cortex-m4 | ||
512 | |||
513 | # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7 | ||
514 | ARMV = 7 | ||
515 | |||
516 | ## chip/board settings | ||
517 | # - the next two should match the directories in | ||
518 | # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES) | ||
519 | MCU_FAMILY = STM32 | ||
520 | MCU_SERIES = STM32L4xx | ||
521 | |||
522 | # Linker script to use | ||
523 | # - it should exist either in <chibios>/os/common/startup/ARMCMx/compilers/GCC/ld/ | ||
524 | # or <keyboard_dir>/ld/ | ||
525 | MCU_LDSCRIPT ?= STM32L412xB | ||
526 | |||
527 | # Startup code to use | ||
528 | # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/ | ||
529 | MCU_STARTUP ?= stm32l4xx | ||
530 | |||
531 | # Board: it should exist either in <chibios>/os/hal/boards/, | ||
532 | # <keyboard_dir>/boards/, or drivers/boards/ | ||
533 | BOARD ?= GENERIC_STM32_L412XB | ||
534 | |||
535 | PLATFORM_NAME ?= platform_l432 | ||
536 | |||
537 | USE_FPU ?= yes | ||
538 | |||
539 | # UF2 settings | ||
540 | UF2_FAMILY ?= STM32L4 | ||
541 | endif | ||
542 | |||
543 | ifneq ($(findstring GD32VF103, $(MCU)),) | ||
544 | # RISC-V | ||
545 | MCU = risc-v | ||
546 | |||
547 | # RISC-V extensions and abi configuration | ||
548 | MCU_ARCH = rv32imac | ||
549 | MCU_ABI = ilp32 | ||
550 | MCU_CMODEL = medlow | ||
551 | |||
552 | ## chip/board settings | ||
553 | # - the next two should match the directories in | ||
554 | # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES) | ||
555 | MCU_FAMILY = GD32V | ||
556 | MCU_SERIES = GD32VF103 | ||
557 | |||
558 | # Linker script to use | ||
559 | # - it should exist either in <chibios>/os/common/startup/RISCV-ECLIC/compilers/GCC/ld/ | ||
560 | # or <keyboard_dir>/ld/ | ||
561 | MCU_LDSCRIPT ?= GD32VF103xB | ||
562 | |||
563 | # Startup code to use | ||
564 | # - it should exist in <chibios>/os/common/startup/RISCV-ECLIC/compilers/GCC/mk/ | ||
565 | MCU_STARTUP ?= gd32vf103 | ||
566 | |||
567 | # Board: it should exist either in <chibios>/os/hal/boards/, | ||
568 | # <keyboard_dir>/boards/, or drivers/boards/ | ||
569 | BOARD ?= SIPEED_LONGAN_NANO | ||
570 | |||
571 | USE_FPU ?= no | ||
572 | endif | ||
573 | |||
574 | ifneq (,$(filter $(MCU),at90usb162 atmega16u2 atmega32u2 atmega16u4 atmega32u4 at90usb646 at90usb647 at90usb1286 at90usb1287)) | ||
575 | PROTOCOL = LUFA | ||
576 | |||
577 | # Processor frequency. | ||
578 | # This will define a symbol, F_CPU, in all source code files equal to the | ||
579 | # processor frequency in Hz. You can then use this symbol in your source code to | ||
580 | # calculate timings. Do NOT tack on a 'UL' at the end, this will be done | ||
581 | # automatically to create a 32-bit value in your source code. | ||
582 | # | ||
583 | # This will be an integer division of F_USB below, as it is sourced by | ||
584 | # F_USB after it has run through any CPU prescalers. Note that this value | ||
585 | # does not *change* the processor frequency - it should merely be updated to | ||
586 | # reflect the processor speed set externally so that the code can use accurate | ||
587 | # software delays. | ||
588 | F_CPU ?= 16000000 | ||
589 | |||
590 | # LUFA specific | ||
591 | # | ||
592 | # Target architecture (see library "Board Types" documentation). | ||
593 | ARCH = AVR8 | ||
594 | |||
595 | # Input clock frequency. | ||
596 | # This will define a symbol, F_USB, in all source code files equal to the | ||
597 | # input clock frequency (before any prescaling is performed) in Hz. This value may | ||
598 | # differ from F_CPU if prescaling is used on the latter, and is required as the | ||
599 | # raw input clock is fed directly to the PLL sections of the AVR for high speed | ||
600 | # clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' | ||
601 | # at the end, this will be done automatically to create a 32-bit value in your | ||
602 | # source code. | ||
603 | # | ||
604 | # If no clock division is performed on the input clock inside the AVR (via the | ||
605 | # CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. | ||
606 | F_USB ?= $(F_CPU) | ||
607 | |||
608 | # Interrupt driven control endpoint task | ||
609 | ifeq (,$(filter $(NO_INTERRUPT_CONTROL_ENDPOINT),yes)) | ||
610 | OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT | ||
611 | endif | ||
612 | ifneq (,$(filter $(MCU),at90usb162 atmega16u2 atmega32u2)) | ||
613 | NO_I2C = yes | ||
614 | endif | ||
615 | endif | ||
616 | |||
617 | ifneq (,$(filter $(MCU),atmega32a)) | ||
618 | # MCU name for avrdude | ||
619 | AVRDUDE_MCU = m32 | ||
620 | |||
621 | PROTOCOL = VUSB | ||
622 | |||
623 | # Processor frequency. | ||
624 | # This will define a symbol, F_CPU, in all source code files equal to the | ||
625 | # processor frequency in Hz. You can then use this symbol in your source code to | ||
626 | # calculate timings. Do NOT tack on a 'UL' at the end, this will be done | ||
627 | # automatically to create a 32-bit value in your source code. | ||
628 | F_CPU ?= 12000000 | ||
629 | endif | ||
630 | |||
631 | ifneq (,$(filter $(MCU),atmega328p)) | ||
632 | # MCU name for avrdude | ||
633 | AVRDUDE_MCU = m328p | ||
634 | |||
635 | PROTOCOL = VUSB | ||
636 | |||
637 | # Processor frequency. | ||
638 | # This will define a symbol, F_CPU, in all source code files equal to the | ||
639 | # processor frequency in Hz. You can then use this symbol in your source code to | ||
640 | # calculate timings. Do NOT tack on a 'UL' at the end, this will be done | ||
641 | # automatically to create a 32-bit value in your source code. | ||
642 | F_CPU ?= 16000000 | ||
643 | endif | ||
644 | |||
645 | ifneq (,$(filter $(MCU),atmega328)) | ||
646 | # MCU name for avrdude | ||
647 | AVRDUDE_MCU = m328 | ||
648 | |||
649 | PROTOCOL = VUSB | ||
650 | |||
651 | # Processor frequency. | ||
652 | # This will define a symbol, F_CPU, in all source code files equal to the | ||
653 | # processor frequency in Hz. You can then use this symbol in your source code to | ||
654 | # calculate timings. Do NOT tack on a 'UL' at the end, this will be done | ||
655 | # automatically to create a 32-bit value in your source code. | ||
656 | F_CPU ?= 16000000 | ||
657 | endif | ||
658 | |||
659 | ifneq (,$(filter $(MCU),attiny85)) | ||
660 | PROTOCOL = VUSB | ||
661 | |||
662 | # Processor frequency. | ||
663 | # This will define a symbol, F_CPU, in all source code files equal to the | ||
664 | # processor frequency in Hz. You can then use this symbol in your source code to | ||
665 | # calculate timings. Do NOT tack on a 'UL' at the end, this will be done | ||
666 | # automatically to create a 32-bit value in your source code. | ||
667 | F_CPU ?= 16500000 | ||
668 | endif | ||
diff --git a/builddefs/message.mk b/builddefs/message.mk new file mode 100644 index 000000000..cb4ef4371 --- /dev/null +++ b/builddefs/message.mk | |||
@@ -0,0 +1,102 @@ | |||
1 | COLOR ?= true | ||
2 | |||
3 | ifeq ($(COLOR),true) | ||
4 | NO_COLOR=\033[0m | ||
5 | OK_COLOR=\033[32;01m | ||
6 | ERROR_COLOR=\033[31;01m | ||
7 | WARN_COLOR=\033[33;01m | ||
8 | SKIPPED_COLOR=\033[36;01m | ||
9 | BLUE=\033[0;34m | ||
10 | BOLD=\033[1m | ||
11 | endif | ||
12 | |||
13 | ifneq ($(shell echo "1 2 3" | awk '{ printf "%2s", $$3; }' 2>/dev/null)," 3") | ||
14 | AWK=awk | ||
15 | else | ||
16 | AWK=cat && test | ||
17 | endif | ||
18 | |||
19 | ON_ERROR ?= exit 1 | ||
20 | |||
21 | OK_STRING=$(OK_COLOR)[OK]$(NO_COLOR)\n | ||
22 | ERROR_STRING=$(ERROR_COLOR)[ERRORS]$(NO_COLOR)\n | ||
23 | WARN_STRING=$(WARN_COLOR)[WARNINGS]$(NO_COLOR)\n | ||
24 | SKIPPED_STRING=$(SKIPPED_COLOR)[SKIPPED]$(NO_COLOR)\n | ||
25 | |||
26 | TAB_LOG = printf "\n%s\n\n" "$$LOG" | $(AWK) '{ sub(/^/," | "); print }' | ||
27 | TAB_LOG_PLAIN = printf "%s\n" "$$LOG" | ||
28 | AWK_STATUS = $(AWK) '{ printf " %-10s\n", $$1; }' | ||
29 | AWK_CMD = $(AWK) '{ printf "%-99s", $$0; }' | ||
30 | PRINT_ERROR = ($(SILENT) ||printf " $(ERROR_STRING)" | $(AWK_STATUS)) && $(TAB_LOG) && $(ON_ERROR) | ||
31 | PRINT_WARNING = ($(SILENT) || printf " $(WARN_STRING)" | $(AWK_STATUS)) && $(TAB_LOG) | ||
32 | PRINT_ERROR_PLAIN = ($(SILENT) ||printf " $(ERROR_STRING)" | $(AWK_STATUS)) && $(TAB_LOG_PLAIN) && $(ON_ERROR) | ||
33 | PRINT_WARNING_PLAIN = ($(SILENT) || printf " $(WARN_STRING)" | $(AWK_STATUS)) && $(TAB_LOG_PLAIN) | ||
34 | PRINT_SKIPPED_PLAIN = ($(SILENT) || printf " $(SKIPPED_STRING)" | $(AWK_STATUS)) | ||
35 | PRINT_OK = $(SILENT) || printf " $(OK_STRING)" | $(AWK_STATUS) | ||
36 | BUILD_CMD = LOG=$$($(CMD) 2>&1) ; if [ $$? -gt 0 ]; then $(PRINT_ERROR); elif [ "$$LOG" != "" ] ; then $(PRINT_WARNING); else $(PRINT_OK); fi; | ||
37 | MAKE_MSG_FORMAT = $(AWK) '{ printf "%-118s", $$0;}' | ||
38 | |||
39 | # The UNSYNC_OUTPUT_CMD command disables the `--output-sync` for the current command, if the `--output-sync` granularity is `target` or lower. | ||
40 | # This is achieved by telling make to treat the current command as if it invokes a recursive make subcommand (as if by calling `$(MAKE)`). | ||
41 | UNSYNC_OUTPUT_CMD = +true | ||
42 | |||
43 | # Define Messages | ||
44 | # English | ||
45 | MSG_ERRORS_NONE = Errors: none | ||
46 | MSG_ERRORS = $(ERROR_COLOR)Make finished with errors\n$(NO_COLOR) | ||
47 | MSG_BEGIN = -------- begin -------- | ||
48 | MSG_END = -------- end -------- | ||
49 | MSG_SIZE_BEFORE = Size before: | ||
50 | MSG_SIZE_AFTER = Size after: | ||
51 | MSG_COFF = Converting to AVR COFF: | ||
52 | MSG_EXTENDED_COFF = Converting to AVR Extended COFF: | ||
53 | MSG_FLASH = Creating load file for flashing: | ||
54 | MSG_UF2 = Creating UF2 file for deployment: | ||
55 | MSG_EEPROM = Creating load file for EEPROM: | ||
56 | MSG_BIN = Creating binary load file for flashing: | ||
57 | MSG_EXTENDED_LISTING = Creating Extended Listing: | ||
58 | MSG_SYMBOL_TABLE = Creating Symbol Table: | ||
59 | MSG_EXECUTING = Executing: | ||
60 | MSG_LINKING = Linking: | ||
61 | MSG_COMPILING = Compiling: | ||
62 | MSG_COMPILING_CXX = Compiling: | ||
63 | MSG_ASSEMBLING = Assembling: | ||
64 | MSG_CLEANING = Cleaning project: | ||
65 | MSG_CREATING_LIBRARY = Creating library: | ||
66 | MSG_SUBMODULE_DIRTY = $(WARN_COLOR)WARNING:$(NO_COLOR) Some git submodules are out of date or modified.\n\ | ||
67 | Please consider running $(BOLD)make git-submodule$(NO_COLOR).\n\n | ||
68 | MSG_NO_CMP = $(ERROR_COLOR)Error:$(NO_COLOR)$(BOLD) cmp command not found, please install diffutils\n$(NO_COLOR) | ||
69 | |||
70 | define GENERATE_MSG_MAKE_KB | ||
71 | MSG_MAKE_KB_ACTUAL := Making $$(KB_SP) with keymap $(BOLD)$$(CURRENT_KM)$(NO_COLOR) | ||
72 | ifneq ($$(MAKE_TARGET),) | ||
73 | MSG_MAKE_KB_ACTUAL += and target $(BOLD)$$(MAKE_TARGET)$(NO_COLOR) | ||
74 | endif | ||
75 | endef | ||
76 | MSG_MAKE_KB = $(eval $(call GENERATE_MSG_MAKE_KB))$(MSG_MAKE_KB_ACTUAL) | ||
77 | define GENERATE_MSG_MAKE_TEST | ||
78 | MSG_MAKE_TEST_ACTUAL := Making test $(BOLD)$(TEST_NAME)$(NO_COLOR) | ||
79 | ifneq ($$(MAKE_TARGET),) | ||
80 | MSG_MAKE_TEST_ACTUAL += with target $(BOLD)$$(MAKE_TARGET)$(NO_COLOR) | ||
81 | endif | ||
82 | endef | ||
83 | MSG_MAKE_TEST = $(eval $(call GENERATE_MSG_MAKE_TEST))$(MSG_MAKE_TEST_ACTUAL) | ||
84 | MSG_TEST = Testing $(BOLD)$(TEST_NAME)$(NO_COLOR) | ||
85 | define GENERATE_MSG_AVAILABLE_KEYMAPS | ||
86 | MSG_AVAILABLE_KEYMAPS_ACTUAL := Available keymaps for $(BOLD)$$(CURRENT_KB)$(NO_COLOR): | ||
87 | endef | ||
88 | MSG_AVAILABLE_KEYMAPS = $(eval $(call GENERATE_MSG_AVAILABLE_KEYMAPS))$(MSG_AVAILABLE_KEYMAPS_ACTUAL) | ||
89 | |||
90 | MSG_CHECK_FILESIZE = Checking file size of $(TARGET).$(FIRMWARE_FORMAT) | ||
91 | MSG_CHECK_FILESIZE_SKIPPED = (Firmware size check does not yet support $(MCU_ORIG); skipping) | ||
92 | MSG_FILE_TOO_BIG = $(ERROR_COLOR)The firmware is too large!$(NO_COLOR) $(CURRENT_SIZE)/$(MAX_SIZE) ($(OVER_SIZE) bytes over)\n | ||
93 | MSG_FILE_TOO_SMALL = The firmware is too small! $(CURRENT_SIZE)/$(MAX_SIZE)\n | ||
94 | MSG_FILE_JUST_RIGHT = The firmware size is fine - $(CURRENT_SIZE)/$(MAX_SIZE) ($(PERCENT_SIZE)%%, $(FREE_SIZE) bytes free)\n | ||
95 | MSG_FILE_NEAR_LIMIT = The firmware size is approaching the maximum - $(CURRENT_SIZE)/$(MAX_SIZE) ($(PERCENT_SIZE)%%, $(FREE_SIZE) bytes free)\n | ||
96 | MSG_PYTHON_MISSING = $(ERROR_COLOR)ERROR:$(NO_COLOR) Cannot run \"qmk hello\"!\n\n\ | ||
97 | Please run $(BOLD)qmk setup$(NO_COLOR) to install all the dependencies QMK requires.\n\n | ||
98 | MSG_FLASH_BOOTLOADER = $(WARN_COLOR)WARNING:$(NO_COLOR) This board's bootloader is not specified or is not supported by the \":flash\" target at this time.\n\n | ||
99 | MSG_FLASH_ARCH = $(WARN_COLOR)WARNING:$(NO_COLOR) This board's architecture is not supported by the \":flash\" target at this time.\n\n | ||
100 | MSG_BOOTLOADER_NOT_FOUND = $(ERROR_COLOR)ERROR:$(NO_COLOR) Bootloader not found. Trying again in 5s (Ctrl+C to cancel)\n | ||
101 | BOOTLOADER_RETRY_TIME ?= 0.5 | ||
102 | MSG_BOOTLOADER_NOT_FOUND_QUICK_RETRY = Bootloader not found. Trying again every $(BOOTLOADER_RETRY_TIME)s (Ctrl+C to cancel) | ||
diff --git a/builddefs/show_options.mk b/builddefs/show_options.mk new file mode 100644 index 000000000..ee60597e1 --- /dev/null +++ b/builddefs/show_options.mk | |||
@@ -0,0 +1,147 @@ | |||
1 | BUILD_OPTION_NAMES = \ | ||
2 | BOOTMAGIC_ENABLE \ | ||
3 | MOUSEKEY_ENABLE \ | ||
4 | EXTRAKEY_ENABLE \ | ||
5 | CONSOLE_ENABLE \ | ||
6 | COMMAND_ENABLE \ | ||
7 | NKRO_ENABLE \ | ||
8 | TERMINAL_ENABLE \ | ||
9 | CUSTOM_MATRIX \ | ||
10 | DEBOUNCE_TYPE \ | ||
11 | SPLIT_KEYBOARD \ | ||
12 | DYNAMIC_KEYMAP_ENABLE \ | ||
13 | USB_HID_ENABLE \ | ||
14 | VIA_ENABLE | ||
15 | |||
16 | HARDWARE_OPTION_NAMES = \ | ||
17 | SLEEP_LED_ENABLE \ | ||
18 | BACKLIGHT_ENABLE \ | ||
19 | BACKLIGHT_DRIVER \ | ||
20 | RGBLIGHT_ENABLE \ | ||
21 | RGBLIGHT_CUSTOM_DRIVER \ | ||
22 | RGB_MATRIX_ENABLE \ | ||
23 | RGB_MATRIX_DRIVER \ | ||
24 | CIE1931_CURVE \ | ||
25 | MIDI_ENABLE \ | ||
26 | BLUETOOTH_ENABLE \ | ||
27 | BLUETOOTH_DRIVER \ | ||
28 | AUDIO_ENABLE \ | ||
29 | HD44780_ENABLE \ | ||
30 | ENCODER_ENABLE \ | ||
31 | LED_TABLES \ | ||
32 | POINTING_DEVICE_ENABLE \ | ||
33 | DIP_SWITCH_ENABLE | ||
34 | |||
35 | OTHER_OPTION_NAMES = \ | ||
36 | UNICODE_ENABLE \ | ||
37 | UCIS_ENABLE \ | ||
38 | UNICODEMAP_ENABLE \ | ||
39 | UNICODE_COMMON \ | ||
40 | AUTO_SHIFT_ENABLE \ | ||
41 | AUTO_SHIFT_MODIFIERS \ | ||
42 | COMBO_ENABLE \ | ||
43 | KEY_LOCK_ENABLE \ | ||
44 | KEY_OVERRIDE_ENABLE \ | ||
45 | LEADER_ENABLE \ | ||
46 | PRINTING_ENABLE \ | ||
47 | STENO_ENABLE \ | ||
48 | TAP_DANCE_ENABLE \ | ||
49 | VIRTSER_ENABLE \ | ||
50 | OLED_ENABLE \ | ||
51 | OLED_DRIVER \ | ||
52 | LED_BACK_ENABLE \ | ||
53 | LED_UNDERGLOW_ENABLE \ | ||
54 | LED_ANIMATIONS \ | ||
55 | IOS_DEVICE_ENABLE \ | ||
56 | HELIX ZINC \ | ||
57 | AUTOLOG_ENABLE \ | ||
58 | DEBUG_ENABLE \ | ||
59 | ENCODER_ENABLE_CUSTOM \ | ||
60 | GERMAN_ENABLE \ | ||
61 | HAPTIC_ENABLE \ | ||
62 | HHKB_RN42_ENABLE \ | ||
63 | ISSI_ENABLE \ | ||
64 | KEYLOGGER_ENABLE \ | ||
65 | LCD_BACKLIGHT_ENABLE \ | ||
66 | MACROS_ENABLED \ | ||
67 | PS2_MOUSE_ENABLE \ | ||
68 | RAW_ENABLE \ | ||
69 | SWAP_HANDS_ENABLE \ | ||
70 | RING_BUFFERED_6KRO_REPORT_ENABLE \ | ||
71 | WATCHDOG_ENABLE \ | ||
72 | ERGOINU \ | ||
73 | NO_USB_STARTUP_CHECK \ | ||
74 | DISABLE_PROMICRO_LEDs \ | ||
75 | MITOSIS_DATAGROK_BOTTOMSPACE \ | ||
76 | MITOSIS_DATAGROK_SLOWUART \ | ||
77 | RGB_MATRIX_KEYPRESSES \ | ||
78 | LED_MIRRORED \ | ||
79 | RGBLIGHT_FULL_POWER \ | ||
80 | LTO_ENABLE \ | ||
81 | PROGRAMMABLE_BUTTON_ENABLE | ||
82 | |||
83 | define NAME_ECHO | ||
84 | @printf " %-30s = %-16s # %s\\n" "$1" "$($1)" "$(origin $1)" | ||
85 | |||
86 | endef | ||
87 | |||
88 | define YAML_NAME_ECHO | ||
89 | @echo ' $1 : "$(strip $($1))"' | ||
90 | |||
91 | endef | ||
92 | |||
93 | .PHONY: show_build_options0 show_build_options | ||
94 | show_build_options0: | ||
95 | @echo " KEYBOARD = $(KEYBOARD)" | ||
96 | @echo " KEYMAP = $(KEYMAP)" | ||
97 | @echo " MCU = $(MCU)" | ||
98 | @echo " MCU_SERIES = $(MCU_SERIES)" | ||
99 | @echo " PLATFORM = $(PLATFORM)" | ||
100 | @echo " BOOTLOADER = $(BOOTLOADER)" | ||
101 | @echo " FIRMWARE_FORMAT = $(FIRMWARE_FORMAT)" | ||
102 | @echo | ||
103 | @echo "Build Options:" | ||
104 | $(foreach A_OPTION_NAME,$(sort $(BUILD_OPTION_NAMES)),\ | ||
105 | $(call NAME_ECHO,$(A_OPTION_NAME))) | ||
106 | |||
107 | show_build_options: show_build_options0 | ||
108 | @echo | ||
109 | @echo "If you want to know more, please try 'show_all_features' or 'show_full_features'" | ||
110 | @echo | ||
111 | |||
112 | .PHONY: show_all_features | ||
113 | show_all_features: show_build_options0 | ||
114 | @echo | ||
115 | @echo "Hardware Options:" | ||
116 | $(foreach A_OPTION_NAME,$(sort $(HARDWARE_OPTION_NAMES)),\ | ||
117 | $(if $($(A_OPTION_NAME)),$(call NAME_ECHO,$(A_OPTION_NAME)))) | ||
118 | @echo | ||
119 | @echo "Other Options:" | ||
120 | $(foreach A_OPTION_NAME,$(sort $(OTHER_OPTION_NAMES)),\ | ||
121 | $(if $($(A_OPTION_NAME)),$(call NAME_ECHO,$(A_OPTION_NAME)))) | ||
122 | |||
123 | .PHONY: show_full_features | ||
124 | show_full_features: show_build_options0 | ||
125 | @echo | ||
126 | @echo "Hardware Options:" | ||
127 | $(foreach A_OPTION_NAME,$(sort $(HARDWARE_OPTION_NAMES)),\ | ||
128 | $(call NAME_ECHO,$(A_OPTION_NAME))) | ||
129 | @echo | ||
130 | @echo "Other Options:" | ||
131 | $(foreach A_OPTION_NAME,$(sort $(OTHER_OPTION_NAMES)),\ | ||
132 | $(call NAME_ECHO,$(A_OPTION_NAME))) | ||
133 | |||
134 | .PHONY: yaml_build_options | ||
135 | yaml_build_options: | ||
136 | @echo '- KEYBOARD : "$(KEYBOARD)"' | ||
137 | @echo ' KEYMAP : "$(KEYMAP)"' | ||
138 | @echo ' MCU : "$(MCU)"' | ||
139 | @echo ' MCU_SERIES : "$(MCU_SERIES)"' | ||
140 | @echo ' PLATFORM : "$(PLATFORM)"' | ||
141 | @echo ' FIRMWARE_FORMAT : "$(FIRMWARE_FORMAT)"' | ||
142 | $(foreach A_OPTION_NAME,$(sort $(BUILD_OPTION_NAMES)),\ | ||
143 | $(call YAML_NAME_ECHO,$(A_OPTION_NAME))) | ||
144 | $(foreach A_OPTION_NAME,$(sort $(HARDWARE_OPTION_NAMES)),\ | ||
145 | $(if $($(A_OPTION_NAME)),$(call YAML_NAME_ECHO,$(A_OPTION_NAME)))) | ||
146 | $(foreach A_OPTION_NAME,$(sort $(OTHER_OPTION_NAMES)),\ | ||
147 | $(if $($(A_OPTION_NAME)),$(call YAML_NAME_ECHO,$(A_OPTION_NAME)))) | ||