From b780c797beb726839e99e3f4054f9b4c33331cdc Mon Sep 17 00:00:00 2001
From: Joel Challis
Date: Thu, 28 Oct 2021 01:07:53 +0100
Subject: Migrate makefile utilities to sub-directory (#14917)
---
Makefile | 3 +-
bootloader.mk | 163 -----------
build_keyboard.mk | 13 +-
build_test.mk | 5 +-
builddefs/bootloader.mk | 163 +++++++++++
builddefs/disable_features.mk | 28 ++
builddefs/generic_features.mk | 49 ++++
builddefs/mcu_selection.mk | 668 ++++++++++++++++++++++++++++++++++++++++++
builddefs/message.mk | 102 +++++++
builddefs/show_options.mk | 147 ++++++++++
common.mk | 28 --
disable_features.mk | 28 --
generic_features.mk | 49 ----
message.mk | 102 -------
paths.mk | 29 ++
quantum/mcu_selection.mk | 668 ------------------------------------------
show_options.mk | 147 ----------
17 files changed, 1198 insertions(+), 1194 deletions(-)
delete mode 100644 bootloader.mk
create mode 100644 builddefs/bootloader.mk
create mode 100644 builddefs/disable_features.mk
create mode 100644 builddefs/generic_features.mk
create mode 100644 builddefs/mcu_selection.mk
create mode 100644 builddefs/message.mk
create mode 100644 builddefs/show_options.mk
delete mode 100644 common.mk
delete mode 100644 disable_features.mk
delete mode 100644 generic_features.mk
delete mode 100644 message.mk
create mode 100644 paths.mk
delete mode 100644 quantum/mcu_selection.mk
delete mode 100644 show_options.mk
diff --git a/Makefile b/Makefile
index a1741dd961..c221cb89e0 100644
--- a/Makefile
+++ b/Makefile
@@ -425,7 +425,8 @@ define SET_SILENT_MODE
endif
endef
-include $(ROOT_DIR)/message.mk
+include paths.mk
+include $(BUILDDEFS_PATH)/message.mk
ifeq ($(strip $(BREAK_ON_ERRORS)), yes)
HANDLE_ERROR = exit 1
diff --git a/bootloader.mk b/bootloader.mk
deleted file mode 100644
index ccb92392d9..0000000000
--- a/bootloader.mk
+++ /dev/null
@@ -1,163 +0,0 @@
-# Copyright 2017 Jack Humbert
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see .
-
-# If it's possible that multiple bootloaders can be used for one project,
-# you can leave this unset, and the correct size will be selected
-# automatically.
-#
-# Sets the bootloader defined in the keyboard's/keymap's rules.mk
-# Current options:
-#
-# AVR:
-# halfkay PJRC Teensy
-# caterina Pro Micro (Sparkfun/generic)
-# atmel-dfu Atmel factory DFU
-# lufa-dfu LUFA DFU
-# qmk-dfu QMK DFU (LUFA + blinkenlight)
-# qmk-hid QMK HID (LUFA + blinkenlight)
-# bootloadhid HIDBootFlash compatible (ATmega32A)
-# usbasploader USBaspLoader (ATmega328P)
-# ARM:
-# kiibohd Input:Club Kiibohd bootloader (only used on their boards)
-# stm32duino STM32Duino (STM32F103x8)
-# stm32-dfu STM32 USB DFU in ROM
-# apm32-dfu APM32 USB DFU in ROM
-# RISC-V:
-# gd32v-dfu GD32V USB DFU in ROM
-#
-# BOOTLOADER_SIZE can still be defined manually, but it's recommended
-# you add any possible configuration to this list
-
-ifeq ($(strip $(BOOTLOADER)), atmel-dfu)
- OPT_DEFS += -DBOOTLOADER_ATMEL_DFU
- OPT_DEFS += -DBOOTLOADER_DFU
- ifneq (,$(filter $(MCU), at90usb162 atmega16u2 atmega32u2 atmega16u4 atmega32u4 at90usb646 at90usb647))
- BOOTLOADER_SIZE = 4096
- endif
- ifneq (,$(filter $(MCU), at90usb1286 at90usb1287))
- BOOTLOADER_SIZE = 8192
- endif
-endif
-ifeq ($(strip $(BOOTLOADER)), lufa-dfu)
- OPT_DEFS += -DBOOTLOADER_LUFA_DFU
- OPT_DEFS += -DBOOTLOADER_DFU
- ifneq (,$(filter $(MCU), at90usb162 atmega16u2 atmega32u2 atmega16u4 atmega32u4 at90usb646 at90usb647))
- BOOTLOADER_SIZE ?= 4096
- endif
- ifneq (,$(filter $(MCU), at90usb1286 at90usb1287))
- BOOTLOADER_SIZE ?= 8192
- endif
-endif
-ifeq ($(strip $(BOOTLOADER)), qmk-dfu)
- OPT_DEFS += -DBOOTLOADER_QMK_DFU
- OPT_DEFS += -DBOOTLOADER_DFU
- ifneq (,$(filter $(MCU), at90usb162 atmega16u2 atmega32u2 atmega16u4 atmega32u4 at90usb646 at90usb647))
- BOOTLOADER_SIZE ?= 4096
- endif
- ifneq (,$(filter $(MCU), at90usb1286 at90usb1287))
- BOOTLOADER_SIZE ?= 8192
- endif
-endif
-ifeq ($(strip $(BOOTLOADER)), qmk-hid)
- OPT_DEFS += -DBOOTLOADER_QMK_HID
- OPT_DEFS += -DBOOTLOADER_HID
- BOOTLOADER_SIZE ?= 4096
-endif
-ifeq ($(strip $(BOOTLOADER)), halfkay)
- OPT_DEFS += -DBOOTLOADER_HALFKAY
- ifeq ($(strip $(MCU)), atmega32u4)
- BOOTLOADER_SIZE = 512
- endif
- ifeq ($(strip $(MCU)), at90usb1286)
- BOOTLOADER_SIZE = 1024
- endif
-endif
-ifeq ($(strip $(BOOTLOADER)), caterina)
- OPT_DEFS += -DBOOTLOADER_CATERINA
- BOOTLOADER_SIZE = 4096
-endif
-ifneq (,$(filter $(BOOTLOADER), bootloadhid bootloadHID))
- OPT_DEFS += -DBOOTLOADER_BOOTLOADHID
- BOOTLOADER_SIZE = 4096
-endif
-ifneq (,$(filter $(BOOTLOADER), usbasploader USBasp))
- OPT_DEFS += -DBOOTLOADER_USBASP
- BOOTLOADER_SIZE = 4096
-endif
-ifeq ($(strip $(BOOTLOADER)), lufa-ms)
- OPT_DEFS += -DBOOTLOADER_MS
- BOOTLOADER_SIZE ?= 8192
- FIRMWARE_FORMAT = bin
-cpfirmware: lufa_warning
-.INTERMEDIATE: lufa_warning
-lufa_warning: $(FIRMWARE_FORMAT)
- $(info @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@)
- $(info LUFA MASS STORAGE Bootloader selected)
- $(info DO NOT USE THIS BOOTLOADER IN NEW PROJECTS!)
- $(info It is extremely prone to bricking, and is only included to support existing boards.)
- $(info @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@)
-endif
-ifdef BOOTLOADER_SIZE
- OPT_DEFS += -DBOOTLOADER_SIZE=$(strip $(BOOTLOADER_SIZE))
-endif
-
-ifeq ($(strip $(BOOTLOADER)), stm32-dfu)
- OPT_DEFS += -DBOOTLOADER_STM32_DFU
-
- # Options to pass to dfu-util when flashing
- DFU_ARGS ?= -d 0483:DF11 -a 0 -s 0x08000000:leave
- DFU_SUFFIX_ARGS ?= -v 0483 -p DF11
-endif
-ifeq ($(strip $(BOOTLOADER)), apm32-dfu)
- OPT_DEFS += -DBOOTLOADER_APM32_DFU
-
- # Options to pass to dfu-util when flashing
- DFU_ARGS ?= -d 314B:0106 -a 0 -s 0x08000000:leave
- DFU_SUFFIX_ARGS ?= -v 314B -p 0106
-endif
-ifeq ($(strip $(BOOTLOADER)), gd32v-dfu)
- OPT_DEFS += -DBOOTLOADER_GD32V_DFU
-
- # Options to pass to dfu-util when flashing
- DFU_ARGS ?= -d 28E9:0189 -a 0 -s 0x08000000:leave
- DFU_SUFFIX_ARGS ?= -v 28E9 -p 0189
-endif
-ifeq ($(strip $(BOOTLOADER)), kiibohd)
- OPT_DEFS += -DBOOTLOADER_KIIBOHD
- ifeq ($(strip $(MCU_ORIG)), MK20DX128)
- MCU_LDSCRIPT = MK20DX128BLDR4
- endif
- ifeq ($(strip $(MCU_ORIG)), MK20DX256)
- MCU_LDSCRIPT = MK20DX256BLDR8
- endif
-
- # Options to pass to dfu-util when flashing
- DFU_ARGS = -d 1C11:B007
- DFU_SUFFIX_ARGS = -v 1C11 -p B007
-endif
-ifeq ($(strip $(BOOTLOADER)), stm32duino)
- OPT_DEFS += -DBOOTLOADER_STM32DUINO
- MCU_LDSCRIPT = STM32F103x8_stm32duino_bootloader
- BOARD = STM32_F103_STM32DUINO
- # STM32F103 does NOT have an USB bootloader in ROM (only serial), so setting anything here does not make much sense
- STM32_BOOTLOADER_ADDRESS = 0x80000000
-
- # Options to pass to dfu-util when flashing
- DFU_ARGS = -d 1EAF:0003 -a 2 -R
- DFU_SUFFIX_ARGS = -v 1EAF -p 0003
-endif
-ifeq ($(strip $(BOOTLOADER)), tinyuf2)
- OPT_DEFS += -DBOOTLOADER_TINYUF2
-endif
diff --git a/build_keyboard.mk b/build_keyboard.mk
index c1f4f93381..36c628c7ce 100644
--- a/build_keyboard.mk
+++ b/build_keyboard.mk
@@ -10,7 +10,8 @@ endif
.DEFAULT_GOAL := all
-include common.mk
+include paths.mk
+include $(BUILDDEFS_PATH)/message.mk
# Set the qmk cli to use
QMK_BIN ?= qmk
@@ -164,7 +165,7 @@ ifeq ($(strip $(CONVERT_TO_PROTON_C)), yes)
include platforms/chibios/boards/QMK_PROTON_C/convert_to_proton_c.mk
endif
-include quantum/mcu_selection.mk
+include $(BUILDDEFS_PATH)/mcu_selection.mk
# Find all the C source files to be compiled in subfolders.
KEYBOARD_SRC :=
@@ -342,7 +343,7 @@ ifneq ("$(wildcard $(USER_PATH)/post_config.h)","")
endif
# Disable features that a keyboard doesn't support
--include disable_features.mk
+-include $(BUILDDEFS_PATH)/disable_features.mk
# Pull in post_rules.mk files from all our subfolders
ifneq ("$(wildcard $(KEYBOARD_PATH_1)/post_rules.mk)","")
@@ -385,10 +386,10 @@ VPATH += $(KEYBOARD_PATHS)
VPATH += $(COMMON_VPATH)
include common_features.mk
-include generic_features.mk
+include $(BUILDDEFS_PATH)/generic_features.mk
include $(TMK_PATH)/protocol.mk
include $(TMK_PATH)/common.mk
-include bootloader.mk
+include $(BUILDDEFS_PATH)/bootloader.mk
SRC += $(patsubst %.c,%.clib,$(LIB_SRC))
SRC += $(patsubst %.c,%.clib,$(QUANTUM_LIB_SRC))
@@ -445,7 +446,7 @@ check-size: build
check-md5: build
objs-size: build
-include show_options.mk
+include $(BUILDDEFS_PATH)/show_options.mk
include $(TMK_PATH)/rules.mk
# Ensure we have generated files available for each of the objects
diff --git a/build_test.mk b/build_test.mk
index dd66a008ee..8f1ff1e849 100644
--- a/build_test.mk
+++ b/build_test.mk
@@ -4,7 +4,8 @@ endif
.DEFAULT_GOAL := all
-include common.mk
+include paths.mk
+include $(BUILDDEFS_PATH)/message.mk
TARGET=test/$(TEST)
@@ -52,7 +53,7 @@ include tests/$(TEST)/rules.mk
endif
include common_features.mk
-include generic_features.mk
+include $(BUILDDEFS_PATH)/generic_features.mk
include $(TMK_PATH)/common.mk
include $(QUANTUM_PATH)/debounce/tests/rules.mk
include $(QUANTUM_PATH)/sequencer/tests/rules.mk
diff --git a/builddefs/bootloader.mk b/builddefs/bootloader.mk
new file mode 100644
index 0000000000..ccb92392d9
--- /dev/null
+++ b/builddefs/bootloader.mk
@@ -0,0 +1,163 @@
+# Copyright 2017 Jack Humbert
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+
+# If it's possible that multiple bootloaders can be used for one project,
+# you can leave this unset, and the correct size will be selected
+# automatically.
+#
+# Sets the bootloader defined in the keyboard's/keymap's rules.mk
+# Current options:
+#
+# AVR:
+# halfkay PJRC Teensy
+# caterina Pro Micro (Sparkfun/generic)
+# atmel-dfu Atmel factory DFU
+# lufa-dfu LUFA DFU
+# qmk-dfu QMK DFU (LUFA + blinkenlight)
+# qmk-hid QMK HID (LUFA + blinkenlight)
+# bootloadhid HIDBootFlash compatible (ATmega32A)
+# usbasploader USBaspLoader (ATmega328P)
+# ARM:
+# kiibohd Input:Club Kiibohd bootloader (only used on their boards)
+# stm32duino STM32Duino (STM32F103x8)
+# stm32-dfu STM32 USB DFU in ROM
+# apm32-dfu APM32 USB DFU in ROM
+# RISC-V:
+# gd32v-dfu GD32V USB DFU in ROM
+#
+# BOOTLOADER_SIZE can still be defined manually, but it's recommended
+# you add any possible configuration to this list
+
+ifeq ($(strip $(BOOTLOADER)), atmel-dfu)
+ OPT_DEFS += -DBOOTLOADER_ATMEL_DFU
+ OPT_DEFS += -DBOOTLOADER_DFU
+ ifneq (,$(filter $(MCU), at90usb162 atmega16u2 atmega32u2 atmega16u4 atmega32u4 at90usb646 at90usb647))
+ BOOTLOADER_SIZE = 4096
+ endif
+ ifneq (,$(filter $(MCU), at90usb1286 at90usb1287))
+ BOOTLOADER_SIZE = 8192
+ endif
+endif
+ifeq ($(strip $(BOOTLOADER)), lufa-dfu)
+ OPT_DEFS += -DBOOTLOADER_LUFA_DFU
+ OPT_DEFS += -DBOOTLOADER_DFU
+ ifneq (,$(filter $(MCU), at90usb162 atmega16u2 atmega32u2 atmega16u4 atmega32u4 at90usb646 at90usb647))
+ BOOTLOADER_SIZE ?= 4096
+ endif
+ ifneq (,$(filter $(MCU), at90usb1286 at90usb1287))
+ BOOTLOADER_SIZE ?= 8192
+ endif
+endif
+ifeq ($(strip $(BOOTLOADER)), qmk-dfu)
+ OPT_DEFS += -DBOOTLOADER_QMK_DFU
+ OPT_DEFS += -DBOOTLOADER_DFU
+ ifneq (,$(filter $(MCU), at90usb162 atmega16u2 atmega32u2 atmega16u4 atmega32u4 at90usb646 at90usb647))
+ BOOTLOADER_SIZE ?= 4096
+ endif
+ ifneq (,$(filter $(MCU), at90usb1286 at90usb1287))
+ BOOTLOADER_SIZE ?= 8192
+ endif
+endif
+ifeq ($(strip $(BOOTLOADER)), qmk-hid)
+ OPT_DEFS += -DBOOTLOADER_QMK_HID
+ OPT_DEFS += -DBOOTLOADER_HID
+ BOOTLOADER_SIZE ?= 4096
+endif
+ifeq ($(strip $(BOOTLOADER)), halfkay)
+ OPT_DEFS += -DBOOTLOADER_HALFKAY
+ ifeq ($(strip $(MCU)), atmega32u4)
+ BOOTLOADER_SIZE = 512
+ endif
+ ifeq ($(strip $(MCU)), at90usb1286)
+ BOOTLOADER_SIZE = 1024
+ endif
+endif
+ifeq ($(strip $(BOOTLOADER)), caterina)
+ OPT_DEFS += -DBOOTLOADER_CATERINA
+ BOOTLOADER_SIZE = 4096
+endif
+ifneq (,$(filter $(BOOTLOADER), bootloadhid bootloadHID))
+ OPT_DEFS += -DBOOTLOADER_BOOTLOADHID
+ BOOTLOADER_SIZE = 4096
+endif
+ifneq (,$(filter $(BOOTLOADER), usbasploader USBasp))
+ OPT_DEFS += -DBOOTLOADER_USBASP
+ BOOTLOADER_SIZE = 4096
+endif
+ifeq ($(strip $(BOOTLOADER)), lufa-ms)
+ OPT_DEFS += -DBOOTLOADER_MS
+ BOOTLOADER_SIZE ?= 8192
+ FIRMWARE_FORMAT = bin
+cpfirmware: lufa_warning
+.INTERMEDIATE: lufa_warning
+lufa_warning: $(FIRMWARE_FORMAT)
+ $(info @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@)
+ $(info LUFA MASS STORAGE Bootloader selected)
+ $(info DO NOT USE THIS BOOTLOADER IN NEW PROJECTS!)
+ $(info It is extremely prone to bricking, and is only included to support existing boards.)
+ $(info @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@)
+endif
+ifdef BOOTLOADER_SIZE
+ OPT_DEFS += -DBOOTLOADER_SIZE=$(strip $(BOOTLOADER_SIZE))
+endif
+
+ifeq ($(strip $(BOOTLOADER)), stm32-dfu)
+ OPT_DEFS += -DBOOTLOADER_STM32_DFU
+
+ # Options to pass to dfu-util when flashing
+ DFU_ARGS ?= -d 0483:DF11 -a 0 -s 0x08000000:leave
+ DFU_SUFFIX_ARGS ?= -v 0483 -p DF11
+endif
+ifeq ($(strip $(BOOTLOADER)), apm32-dfu)
+ OPT_DEFS += -DBOOTLOADER_APM32_DFU
+
+ # Options to pass to dfu-util when flashing
+ DFU_ARGS ?= -d 314B:0106 -a 0 -s 0x08000000:leave
+ DFU_SUFFIX_ARGS ?= -v 314B -p 0106
+endif
+ifeq ($(strip $(BOOTLOADER)), gd32v-dfu)
+ OPT_DEFS += -DBOOTLOADER_GD32V_DFU
+
+ # Options to pass to dfu-util when flashing
+ DFU_ARGS ?= -d 28E9:0189 -a 0 -s 0x08000000:leave
+ DFU_SUFFIX_ARGS ?= -v 28E9 -p 0189
+endif
+ifeq ($(strip $(BOOTLOADER)), kiibohd)
+ OPT_DEFS += -DBOOTLOADER_KIIBOHD
+ ifeq ($(strip $(MCU_ORIG)), MK20DX128)
+ MCU_LDSCRIPT = MK20DX128BLDR4
+ endif
+ ifeq ($(strip $(MCU_ORIG)), MK20DX256)
+ MCU_LDSCRIPT = MK20DX256BLDR8
+ endif
+
+ # Options to pass to dfu-util when flashing
+ DFU_ARGS = -d 1C11:B007
+ DFU_SUFFIX_ARGS = -v 1C11 -p B007
+endif
+ifeq ($(strip $(BOOTLOADER)), stm32duino)
+ OPT_DEFS += -DBOOTLOADER_STM32DUINO
+ MCU_LDSCRIPT = STM32F103x8_stm32duino_bootloader
+ BOARD = STM32_F103_STM32DUINO
+ # STM32F103 does NOT have an USB bootloader in ROM (only serial), so setting anything here does not make much sense
+ STM32_BOOTLOADER_ADDRESS = 0x80000000
+
+ # Options to pass to dfu-util when flashing
+ DFU_ARGS = -d 1EAF:0003 -a 2 -R
+ DFU_SUFFIX_ARGS = -v 1EAF -p 0003
+endif
+ifeq ($(strip $(BOOTLOADER)), tinyuf2)
+ OPT_DEFS += -DBOOTLOADER_TINYUF2
+endif
diff --git a/builddefs/disable_features.mk b/builddefs/disable_features.mk
new file mode 100644
index 0000000000..090a9b5a11
--- /dev/null
+++ b/builddefs/disable_features.mk
@@ -0,0 +1,28 @@
+# Unconditionally disable features that a keyboard advertises it doesn't support
+
+FEATURE_NAMES :=
+FEATURE_NAMES += AUDIO
+FEATURE_NAMES += BACKLIGHT
+FEATURE_NAMES += BLUETOOTH
+FEATURE_NAMES += DIP_SWITCH
+FEATURE_NAMES += DYNAMIC_KEYMAP
+FEATURE_NAMES += ENCODER
+FEATURE_NAMES += HAPTIC
+FEATURE_NAMES += HD44780
+FEATURE_NAMES += IOS_DEVICE
+FEATURE_NAMES += LCD_BACKLIGHT
+FEATURE_NAMES += LCD
+FEATURE_NAMES += OLED
+FEATURE_NAMES += POINTING_DEVICE
+FEATURE_NAMES += PRINTING
+FEATURE_NAMES += PS2_MOUSE
+FEATURE_NAMES += RGBLIGHT
+FEATURE_NAMES += RGB_MATRIX
+FEATURE_NAMES += SLEEP_LED
+FEATURE_NAMES += STENO
+FEATURE_NAMES += SWAP_HANDS
+FEATURE_NAMES += WATCHDOG
+FEATURE_NAMES += XT
+
+$(foreach AFEATURE,$(FEATURE_NAMES),\
+ $(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 0000000000..ff02d56bbe
--- /dev/null
+++ b/builddefs/generic_features.mk
@@ -0,0 +1,49 @@
+# Copyright 2021 QMK
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+
+SPACE_CADET_ENABLE ?= yes
+GRAVE_ESC_ENABLE ?= yes
+
+GENERIC_FEATURES = \
+ COMBO \
+ COMMAND \
+ DIGITIZER \
+ DIP_SWITCH \
+ DYNAMIC_KEYMAP \
+ DYNAMIC_MACRO \
+ ENCODER \
+ GRAVE_ESC \
+ HAPTIC \
+ KEY_LOCK \
+ KEY_OVERRIDE \
+ LEADER \
+ PROGRAMMABLE_BUTTON \
+ SPACE_CADET \
+ TAP_DANCE \
+ VELOCIKEY \
+ WPM \
+
+define HANDLE_GENERIC_FEATURE
+ # $$(info "Processing: $1_ENABLE $2.c")
+ SRC += $$(wildcard $$(QUANTUM_DIR)/process_keycode/process_$2.c)
+ SRC += $$(wildcard $$(QUANTUM_DIR)/$2.c)
+ OPT_DEFS += -D$1_ENABLE
+endef
+
+$(foreach F,$(GENERIC_FEATURES),\
+ $(if $(filter yes, $(strip $($(F)_ENABLE))),\
+ $(eval $(call HANDLE_GENERIC_FEATURE,$(F),$(shell echo $(F) | tr '[:upper:]' '[:lower:]'))) \
+ ) \
+)
diff --git a/builddefs/mcu_selection.mk b/builddefs/mcu_selection.mk
new file mode 100644
index 0000000000..1251b7a2b7
--- /dev/null
+++ b/builddefs/mcu_selection.mk
@@ -0,0 +1,668 @@
+MCU_ORIG := $(MCU)
+
+ifneq ($(findstring MKL26Z64, $(MCU)),)
+ # Cortex version
+ MCU = cortex-m0plus
+
+ # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
+ ARMV = 6
+
+ ## chip/board settings
+ # - the next two should match the directories in
+ # /os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
+ MCU_FAMILY = KINETIS
+ MCU_SERIES = KL2x
+
+ # Linker script to use
+ # - it should exist either in /os/common/ports/ARMCMx/compilers/GCC/ld/
+ # or /ld/
+ MCU_LDSCRIPT ?= MKL26Z64
+
+ # Startup code to use
+ # - it should exist in /os/common/ports/ARMCMx/compilers/GCC/mk/
+ MCU_STARTUP ?= kl2x
+
+ # Board: it should exist either in /os/hal/boards/,
+ # /boards/, or drivers/boards/
+ BOARD ?= PJRC_TEENSY_LC
+endif
+
+ifneq ($(findstring MK20DX128, $(MCU)),)
+ # Cortex version
+ MCU = cortex-m4
+
+ # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
+ ARMV = 7
+
+ ## chip/board settings
+ # - the next two should match the directories in
+ # /os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
+ MCU_FAMILY = KINETIS
+ MCU_SERIES = K20x
+
+ # Linker script to use
+ # - it should exist either in /os/common/ports/ARMCMx/compilers/GCC/ld/
+ # or /ld/
+ MCU_LDSCRIPT ?= MK20DX128
+
+ # Startup code to use
+ # - it should exist in /os/common/ports/ARMCMx/compilers/GCC/mk/
+ MCU_STARTUP ?= k20x5
+
+ # Board: it should exist either in /os/hal/boards/,
+ # /boards/, or drivers/boards/
+ BOARD ?= PJRC_TEENSY_3
+endif
+
+ifneq ($(findstring MK20DX256, $(MCU)),)
+ # Cortex version
+ MCU = cortex-m4
+
+ # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
+ ARMV = 7
+
+ ## chip/board settings
+ # - the next two should match the directories in
+ # /os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
+ MCU_FAMILY = KINETIS
+ MCU_SERIES = K20x
+
+ # Linker script to use
+ # - it should exist either in /os/common/ports/ARMCMx/compilers/GCC/ld/
+ # or /ld/
+ MCU_LDSCRIPT ?= MK20DX256
+
+ # Startup code to use
+ # - it should exist in /os/common/ports/ARMCMx/compilers/GCC/mk/
+ MCU_STARTUP ?= k20x7
+
+ # Board: it should exist either in /os/hal/boards/,
+ # /boards/, or drivers/boards/
+ BOARD ?= PJRC_TEENSY_3_1
+endif
+
+ifneq ($(findstring MK66FX1M0, $(MCU)),)
+ # Cortex version
+ MCU = cortex-m4
+
+ # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
+ ARMV = 7
+
+ ## chip/board settings
+ # - the next two should match the directories in
+ # /os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
+ MCU_FAMILY = KINETIS
+ MCU_SERIES = MK66F18
+
+ # Linker script to use
+ # - it should exist either in /os/common/ports/ARMCMx/compilers/GCC/ld/
+ # or /ld/
+ MCU_LDSCRIPT ?= MK66FX1M0
+
+ # Startup code to use
+ # - it should exist in /os/common/startup/ARMCMx/compilers/GCC/mk/
+ MCU_STARTUP ?= MK66F18
+
+ # Board: it should exist either in /os/hal/boards/,
+ # /boards/, or drivers/boards/
+ BOARD ?= PJRC_TEENSY_3_6
+endif
+
+ifneq ($(findstring STM32F042, $(MCU)),)
+ # Cortex version
+ MCU = cortex-m0
+
+ # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
+ ARMV = 6
+
+ ## chip/board settings
+ # - the next two should match the directories in
+ # /os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
+ MCU_FAMILY = STM32
+ MCU_SERIES = STM32F0xx
+
+ # Linker script to use
+ # - it should exist either in /os/common/startup/ARMCMx/compilers/GCC/ld/
+ # or /ld/
+ MCU_LDSCRIPT ?= STM32F042x6
+
+ # Startup code to use
+ # - it should exist in /os/common/startup/ARMCMx/compilers/GCC/mk/
+ MCU_STARTUP ?= stm32f0xx
+
+ # Board: it should exist either in /os/hal/boards/,
+ # /boards/, or drivers/boards/
+ BOARD ?= GENERIC_STM32_F042X6
+
+ USE_FPU ?= no
+
+ # UF2 settings
+ UF2_FAMILY ?= STM32F0
+
+ # Stack sizes: Since this chip has limited RAM capacity, the stack area needs to be reduced.
+ # This ensures that the EEPROM page buffer fits into RAM
+ USE_PROCESS_STACKSIZE = 0x600
+ USE_EXCEPTIONS_STACKSIZE = 0x300
+endif
+
+ifneq ($(findstring STM32F072, $(MCU)),)
+ # Cortex version
+ MCU = cortex-m0
+
+ # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
+ ARMV = 6
+
+ ## chip/board settings
+ # - the next two should match the directories in
+ # /os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
+ MCU_FAMILY = STM32
+ MCU_SERIES = STM32F0xx
+
+ # Linker script to use
+ # - it should exist either in /os/common/startup/ARMCMx/compilers/GCC/ld/
+ # or /ld/
+ MCU_LDSCRIPT ?= STM32F072xB
+
+ # Startup code to use
+ # - it should exist in /os/common/startup/ARMCMx/compilers/GCC/mk/
+ MCU_STARTUP ?= stm32f0xx
+
+ # Board: it should exist either in /os/hal/boards/,
+ # /boards/, or drivers/boards/
+ BOARD ?= GENERIC_STM32_F072XB
+
+ USE_FPU ?= no
+
+ # UF2 settings
+ UF2_FAMILY ?= STM32F0
+endif
+
+ifneq ($(findstring STM32F103, $(MCU)),)
+ # Cortex version
+ MCU = cortex-m3
+
+ # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
+ ARMV = 7
+
+ ## chip/board settings
+ # - the next two should match the directories in
+ # /os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
+ MCU_FAMILY = STM32
+ MCU_SERIES = STM32F1xx
+
+ # Linker script to use
+ # - it should exist either in /os/common/startup/ARMCMx/compilers/GCC/ld/
+ # or /ld/
+ MCU_LDSCRIPT ?= STM32F103x8
+
+ # Startup code to use
+ # - it should exist in /os/common/startup/ARMCMx/compilers/GCC/mk/
+ MCU_STARTUP ?= stm32f1xx
+
+ # Board: it should exist either in /os/hal/boards/,
+ # /boards/, or drivers/boards/
+ BOARD ?= GENERIC_STM32_F103
+
+ USE_FPU ?= no
+
+ # UF2 settings
+ UF2_FAMILY ?= STM32F1
+endif
+
+ifneq ($(findstring STM32F303, $(MCU)),)
+ # Cortex version
+ MCU = cortex-m4
+
+ # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
+ ARMV = 7
+
+ ## chip/board settings
+ # - the next two should match the directories in
+ # /os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
+ MCU_FAMILY = STM32
+ MCU_SERIES = STM32F3xx
+
+ # Linker script to use
+ # - it should exist either in /os/common/startup/ARMCMx/compilers/GCC/ld/
+ # or /ld/
+ MCU_LDSCRIPT ?= STM32F303xC
+
+ # Startup code to use
+ # - it should exist in /os/common/startup/ARMCMx/compilers/GCC/mk/
+ MCU_STARTUP ?= stm32f3xx
+
+ # Board: it should exist either in /os/hal/boards/,
+ # /boards/, or drivers/boards/
+ BOARD ?= GENERIC_STM32_F303XC
+
+ USE_FPU ?= yes
+
+ # UF2 settings
+ UF2_FAMILY ?= STM32F3
+endif
+
+ifneq ($(findstring STM32F401, $(MCU)),)
+ # Cortex version
+ MCU = cortex-m4
+
+ # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
+ ARMV = 7
+
+ ## chip/board settings
+ # - the next two should match the directories in
+ # /os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
+ MCU_FAMILY = STM32
+ MCU_SERIES = STM32F4xx
+
+ # Linker script to use
+ # - it should exist either in /os/common/startup/ARMCMx/compilers/GCC/ld/
+ # or /ld/
+ ifeq ($(strip $(BOOTLOADER)), tinyuf2)
+ MCU_LDSCRIPT ?= STM32F401xC_tinyuf2
+ FIRMWARE_FORMAT ?= uf2
+ else
+ MCU_LDSCRIPT ?= STM32F401xC
+ endif
+
+ # Startup code to use
+ # - it should exist in /os/common/startup/ARMCMx/compilers/GCC/mk/
+ MCU_STARTUP ?= stm32f4xx
+
+ # Board: it should exist either in /os/hal/boards/,
+ # /boards/, or drivers/boards/
+ BOARD ?= BLACKPILL_STM32_F401
+
+ USE_FPU ?= yes
+
+ # UF2 settings
+ UF2_FAMILY ?= STM32F4
+endif
+
+ifneq ($(findstring STM32F405, $(MCU)),)
+ # Cortex version
+ MCU = cortex-m4
+
+ # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
+ ARMV = 7
+
+ ## chip/board settings
+ # - the next two should match the directories in
+ # /os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
+ MCU_FAMILY = STM32
+ MCU_SERIES = STM32F4xx
+
+ # Linker script to use
+ # - it should exist either in /os/common/ports/ARMCMx/compilers/GCC/ld/
+ # or /ld/
+ MCU_LDSCRIPT ?= STM32F405xG
+
+ # Startup code to use
+ # - it should exist in /os/common/startup/ARMCMx/compilers/GCC/mk/
+ MCU_STARTUP ?= stm32f4xx
+
+ # Board: it should exist either in /os/hal/boards/,
+ # /boards/, or drivers/boards/
+ BOARD ?= GENERIC_STM32_F405XG
+
+ USE_FPU ?= yes
+
+ # UF2 settings
+ UF2_FAMILY ?= STM32F4
+endif
+
+ifneq ($(findstring STM32F407, $(MCU)),)
+ # Cortex version
+ MCU = cortex-m4
+
+ # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
+ ARMV = 7
+
+ ## chip/board settings
+ # - the next two should match the directories in
+ # /os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
+ MCU_FAMILY = STM32
+ MCU_SERIES = STM32F4xx
+
+ # Linker script to use
+ # - it should exist either in /os/common/startup/ARMCMx/compilers/GCC/ld/
+ # or /ld/
+ MCU_LDSCRIPT ?= STM32F407xE
+
+ # Startup code to use
+ # - it should exist in /os/common/startup/ARMCMx/compilers/GCC/mk/
+ MCU_STARTUP ?= stm32f4xx
+
+ # Board: it should exist either in /os/hal/boards/,
+ # /boards/, or drivers/boards/
+ BOARD ?= GENERIC_STM32_F407XE
+
+ USE_FPU ?= yes
+
+ # UF2 settings
+ UF2_FAMILY ?= STM32F4
+endif
+
+ifneq ($(findstring STM32F411, $(MCU)),)
+ # Cortex version
+ MCU = cortex-m4
+
+ # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
+ ARMV = 7
+
+ ## chip/board settings
+ # - the next two should match the directories in
+ # /os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
+ MCU_FAMILY = STM32
+ MCU_SERIES = STM32F4xx
+
+ # Linker script to use
+ # - it should exist either in /os/common/startup/ARMCMx/compilers/GCC/ld/
+ # or /ld/
+ ifeq ($(strip $(BOOTLOADER)), tinyuf2)
+ MCU_LDSCRIPT ?= STM32F411xE_tinyuf2
+ FIRMWARE_FORMAT ?= uf2
+ else
+ MCU_LDSCRIPT ?= STM32F411xE
+ endif
+
+ # Startup code to use
+ # - it should exist in /os/common/startup/ARMCMx/compilers/GCC/mk/
+ MCU_STARTUP ?= stm32f4xx
+
+ # Board: it should exist either in /os/hal/boards/,
+ # /boards/, or drivers/boards/
+ BOARD ?= BLACKPILL_STM32_F411
+
+ USE_FPU ?= yes
+
+ # UF2 settings
+ UF2_FAMILY ?= STM32F4
+endif
+
+ifneq ($(findstring STM32F446, $(MCU)),)
+ # Cortex version
+ MCU = cortex-m4
+
+ # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
+ ARMV = 7
+
+ ## chip/board settings
+ # - the next two should match the directories in
+ # /os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
+ MCU_FAMILY = STM32
+ MCU_SERIES = STM32F4xx
+
+ # Linker script to use
+ # - it should exist either in /os/common/startup/ARMCMx/compilers/GCC/ld/
+ # or /ld/
+ MCU_LDSCRIPT ?= STM32F446xE
+
+ # Startup code to use
+ # - it should exist in /os/common/startup/ARMCMx/compilers/GCC/mk/
+ MCU_STARTUP ?= stm32f4xx
+
+ # Board: it should exist either in /os/hal/boards/,
+ # /boards/, or drivers/boards/
+ BOARD ?= GENERIC_STM32_F446XE
+
+ USE_FPU ?= yes
+endif
+
+ifneq ($(findstring STM32G431, $(MCU)),)
+ # Cortex version
+ MCU = cortex-m4
+
+ # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
+ ARMV = 7
+
+ ## chip/board settings
+ # - the next two should match the directories in
+ # /os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
+ MCU_FAMILY = STM32
+ MCU_SERIES = STM32G4xx
+
+ # Linker script to use
+ # - it should exist either in /os/common/startup/ARMCMx/compilers/GCC/ld/
+ # or /ld/
+ MCU_LDSCRIPT ?= STM32G431xB
+
+ # Startup code to use
+ # - it should exist in /os/common/startup/ARMCMx/compilers/GCC/mk/
+ MCU_STARTUP ?= stm32g4xx
+
+ # Board: it should exist either in /os/hal/boards/,
+ # /boards/, or drivers/boards/
+ BOARD ?= GENERIC_STM32_G431XB
+
+ USE_FPU ?= yes
+
+ # UF2 settings
+ UF2_FAMILY ?= STM32G4
+endif
+
+ifneq ($(findstring STM32G474, $(MCU)),)
+ # Cortex version
+ MCU = cortex-m4
+
+ # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
+ ARMV = 7
+
+ ## chip/board settings
+ # - the next two should match the directories in
+ # /os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
+ MCU_FAMILY = STM32
+ MCU_SERIES = STM32G4xx
+
+ # Linker script to use
+ # - it should exist either in /os/common/startup/ARMCMx/compilers/GCC/ld/
+ # or /ld/
+ MCU_LDSCRIPT ?= STM32G474xE
+
+ # Startup code to use
+ # - it should exist in /os/common/startup/ARMCMx/compilers/GCC/mk/
+ MCU_STARTUP ?= stm32g4xx
+
+ # Board: it should exist either in /os/hal/boards/,
+ # /boards/, or drivers/boards/
+ BOARD ?= GENERIC_STM32_G474XE
+
+ USE_FPU ?= yes
+
+ # UF2 settings
+ UF2_FAMILY ?= STM32G4
+endif
+
+ifneq (,$(filter $(MCU),STM32L433 STM32L443))
+ # Cortex version
+ MCU = cortex-m4
+
+ # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
+ ARMV = 7
+
+ ## chip/board settings
+ # - the next two should match the directories in
+ # /os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
+ MCU_FAMILY = STM32
+ MCU_SERIES = STM32L4xx
+
+ # Linker script to use
+ # - it should exist either in /os/common/startup/ARMCMx/compilers/GCC/ld/
+ # or /ld/
+ MCU_LDSCRIPT ?= STM32L432xC
+
+ # Startup code to use
+ # - it should exist in /os/common/startup/ARMCMx/compilers/GCC/mk/
+ MCU_STARTUP ?= stm32l4xx
+
+ # Board: it should exist either in /os/hal/boards/,
+ # /boards/, or drivers/boards/
+ BOARD ?= GENERIC_STM32_L433XC
+
+ PLATFORM_NAME ?= platform_l432
+
+ USE_FPU ?= yes
+
+ # UF2 settings
+ UF2_FAMILY ?= STM32L4
+endif
+
+ifneq (,$(filter $(MCU),STM32L412 STM32L422))
+ # Cortex version
+ MCU = cortex-m4
+
+ # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
+ ARMV = 7
+
+ ## chip/board settings
+ # - the next two should match the directories in
+ # /os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
+ MCU_FAMILY = STM32
+ MCU_SERIES = STM32L4xx
+
+ # Linker script to use
+ # - it should exist either in /os/common/startup/ARMCMx/compilers/GCC/ld/
+ # or /ld/
+ MCU_LDSCRIPT ?= STM32L412xB
+
+ # Startup code to use
+ # - it should exist in /os/common/startup/ARMCMx/compilers/GCC/mk/
+ MCU_STARTUP ?= stm32l4xx
+
+ # Board: it should exist either in /os/hal/boards/,
+ # /boards/, or drivers/boards/
+ BOARD ?= GENERIC_STM32_L412XB
+
+ PLATFORM_NAME ?= platform_l432
+
+ USE_FPU ?= yes
+
+ # UF2 settings
+ UF2_FAMILY ?= STM32L4
+endif
+
+ifneq ($(findstring GD32VF103, $(MCU)),)
+ # RISC-V
+ MCU = risc-v
+
+ # RISC-V extensions and abi configuration
+ MCU_ARCH = rv32imac
+ MCU_ABI = ilp32
+ MCU_CMODEL = medlow
+
+ ## chip/board settings
+ # - the next two should match the directories in
+ # /os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
+ MCU_FAMILY = GD32V
+ MCU_SERIES = GD32VF103
+
+ # Linker script to use
+ # - it should exist either in /os/common/startup/RISCV-ECLIC/compilers/GCC/ld/
+ # or /ld/
+ MCU_LDSCRIPT ?= GD32VF103xB
+
+ # Startup code to use
+ # - it should exist in /os/common/startup/RISCV-ECLIC/compilers/GCC/mk/
+ MCU_STARTUP ?= gd32vf103
+
+ # Board: it should exist either in /os/hal/boards/,
+ # /boards/, or drivers/boards/
+ BOARD ?= SIPEED_LONGAN_NANO
+
+ USE_FPU ?= no
+endif
+
+ifneq (,$(filter $(MCU),at90usb162 atmega16u2 atmega32u2 atmega16u4 atmega32u4 at90usb646 at90usb647 at90usb1286 at90usb1287))
+ PROTOCOL = LUFA
+
+ # Processor frequency.
+ # This will define a symbol, F_CPU, in all source code files equal to the
+ # processor frequency in Hz. You can then use this symbol in your source code to
+ # calculate timings. Do NOT tack on a 'UL' at the end, this will be done
+ # automatically to create a 32-bit value in your source code.
+ #
+ # This will be an integer division of F_USB below, as it is sourced by
+ # F_USB after it has run through any CPU prescalers. Note that this value
+ # does not *change* the processor frequency - it should merely be updated to
+ # reflect the processor speed set externally so that the code can use accurate
+ # software delays.
+ F_CPU ?= 16000000
+
+ # LUFA specific
+ #
+ # Target architecture (see library "Board Types" documentation).
+ ARCH = AVR8
+
+ # Input clock frequency.
+ # This will define a symbol, F_USB, in all source code files equal to the
+ # input clock frequency (before any prescaling is performed) in Hz. This value may
+ # differ from F_CPU if prescaling is used on the latter, and is required as the
+ # raw input clock is fed directly to the PLL sections of the AVR for high speed
+ # clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
+ # at the end, this will be done automatically to create a 32-bit value in your
+ # source code.
+ #
+ # If no clock division is performed on the input clock inside the AVR (via the
+ # CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
+ F_USB ?= $(F_CPU)
+
+ # Interrupt driven control endpoint task
+ ifeq (,$(filter $(NO_INTERRUPT_CONTROL_ENDPOINT),yes))
+ OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
+ endif
+ ifneq (,$(filter $(MCU),at90usb162 atmega16u2 atmega32u2))
+ NO_I2C = yes
+ endif
+endif
+
+ifneq (,$(filter $(MCU),atmega32a))
+ # MCU name for avrdude
+ AVRDUDE_MCU = m32
+
+ PROTOCOL = VUSB
+
+ # Processor frequency.
+ # This will define a symbol, F_CPU, in all source code files equal to the
+ # processor frequency in Hz. You can then use this symbol in your source code to
+ # calculate timings. Do NOT tack on a 'UL' at the end, this will be done
+ # automatically to create a 32-bit value in your source code.
+ F_CPU ?= 12000000
+endif
+
+ifneq (,$(filter $(MCU),atmega328p))
+ # MCU name for avrdude
+ AVRDUDE_MCU = m328p
+
+ PROTOCOL = VUSB
+
+ # Processor frequency.
+ # This will define a symbol, F_CPU, in all source code files equal to the
+ # processor frequency in Hz. You can then use this symbol in your source code to
+ # calculate timings. Do NOT tack on a 'UL' at the end, this will be done
+ # automatically to create a 32-bit value in your source code.
+ F_CPU ?= 16000000
+endif
+
+ifneq (,$(filter $(MCU),atmega328))
+ # MCU name for avrdude
+ AVRDUDE_MCU = m328
+
+ PROTOCOL = VUSB
+
+ # Processor frequency.
+ # This will define a symbol, F_CPU, in all source code files equal to the
+ # processor frequency in Hz. You can then use this symbol in your source code to
+ # calculate timings. Do NOT tack on a 'UL' at the end, this will be done
+ # automatically to create a 32-bit value in your source code.
+ F_CPU ?= 16000000
+endif
+
+ifneq (,$(filter $(MCU),attiny85))
+ PROTOCOL = VUSB
+
+ # Processor frequency.
+ # This will define a symbol, F_CPU, in all source code files equal to the
+ # processor frequency in Hz. You can then use this symbol in your source code to
+ # calculate timings. Do NOT tack on a 'UL' at the end, this will be done
+ # automatically to create a 32-bit value in your source code.
+ F_CPU ?= 16500000
+endif
diff --git a/builddefs/message.mk b/builddefs/message.mk
new file mode 100644
index 0000000000..cb4ef43719
--- /dev/null
+++ b/builddefs/message.mk
@@ -0,0 +1,102 @@
+COLOR ?= true
+
+ifeq ($(COLOR),true)
+ NO_COLOR=\033[0m
+ OK_COLOR=\033[32;01m
+ ERROR_COLOR=\033[31;01m
+ WARN_COLOR=\033[33;01m
+ SKIPPED_COLOR=\033[36;01m
+ BLUE=\033[0;34m
+ BOLD=\033[1m
+endif
+
+ifneq ($(shell echo "1 2 3" | awk '{ printf "%2s", $$3; }' 2>/dev/null)," 3")
+ AWK=awk
+else
+ AWK=cat && test
+endif
+
+ON_ERROR ?= exit 1
+
+OK_STRING=$(OK_COLOR)[OK]$(NO_COLOR)\n
+ERROR_STRING=$(ERROR_COLOR)[ERRORS]$(NO_COLOR)\n
+WARN_STRING=$(WARN_COLOR)[WARNINGS]$(NO_COLOR)\n
+SKIPPED_STRING=$(SKIPPED_COLOR)[SKIPPED]$(NO_COLOR)\n
+
+TAB_LOG = printf "\n%s\n\n" "$$LOG" | $(AWK) '{ sub(/^/," | "); print }'
+TAB_LOG_PLAIN = printf "%s\n" "$$LOG"
+AWK_STATUS = $(AWK) '{ printf " %-10s\n", $$1; }'
+AWK_CMD = $(AWK) '{ printf "%-99s", $$0; }'
+PRINT_ERROR = ($(SILENT) ||printf " $(ERROR_STRING)" | $(AWK_STATUS)) && $(TAB_LOG) && $(ON_ERROR)
+PRINT_WARNING = ($(SILENT) || printf " $(WARN_STRING)" | $(AWK_STATUS)) && $(TAB_LOG)
+PRINT_ERROR_PLAIN = ($(SILENT) ||printf " $(ERROR_STRING)" | $(AWK_STATUS)) && $(TAB_LOG_PLAIN) && $(ON_ERROR)
+PRINT_WARNING_PLAIN = ($(SILENT) || printf " $(WARN_STRING)" | $(AWK_STATUS)) && $(TAB_LOG_PLAIN)
+PRINT_SKIPPED_PLAIN = ($(SILENT) || printf " $(SKIPPED_STRING)" | $(AWK_STATUS))
+PRINT_OK = $(SILENT) || printf " $(OK_STRING)" | $(AWK_STATUS)
+BUILD_CMD = LOG=$$($(CMD) 2>&1) ; if [ $$? -gt 0 ]; then $(PRINT_ERROR); elif [ "$$LOG" != "" ] ; then $(PRINT_WARNING); else $(PRINT_OK); fi;
+MAKE_MSG_FORMAT = $(AWK) '{ printf "%-118s", $$0;}'
+
+# The UNSYNC_OUTPUT_CMD command disables the `--output-sync` for the current command, if the `--output-sync` granularity is `target` or lower.
+# This is achieved by telling make to treat the current command as if it invokes a recursive make subcommand (as if by calling `$(MAKE)`).
+UNSYNC_OUTPUT_CMD = +true
+
+# Define Messages
+# English
+MSG_ERRORS_NONE = Errors: none
+MSG_ERRORS = $(ERROR_COLOR)Make finished with errors\n$(NO_COLOR)
+MSG_BEGIN = -------- begin --------
+MSG_END = -------- end --------
+MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_AFTER = Size after:
+MSG_COFF = Converting to AVR COFF:
+MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
+MSG_FLASH = Creating load file for flashing:
+MSG_UF2 = Creating UF2 file for deployment:
+MSG_EEPROM = Creating load file for EEPROM:
+MSG_BIN = Creating binary load file for flashing:
+MSG_EXTENDED_LISTING = Creating Extended Listing:
+MSG_SYMBOL_TABLE = Creating Symbol Table:
+MSG_EXECUTING = Executing:
+MSG_LINKING = Linking:
+MSG_COMPILING = Compiling:
+MSG_COMPILING_CXX = Compiling:
+MSG_ASSEMBLING = Assembling:
+MSG_CLEANING = Cleaning project:
+MSG_CREATING_LIBRARY = Creating library:
+MSG_SUBMODULE_DIRTY = $(WARN_COLOR)WARNING:$(NO_COLOR) Some git submodules are out of date or modified.\n\
+Please consider running $(BOLD)make git-submodule$(NO_COLOR).\n\n
+MSG_NO_CMP = $(ERROR_COLOR)Error:$(NO_COLOR)$(BOLD) cmp command not found, please install diffutils\n$(NO_COLOR)
+
+define GENERATE_MSG_MAKE_KB
+ MSG_MAKE_KB_ACTUAL := Making $$(KB_SP) with keymap $(BOLD)$$(CURRENT_KM)$(NO_COLOR)
+ ifneq ($$(MAKE_TARGET),)
+ MSG_MAKE_KB_ACTUAL += and target $(BOLD)$$(MAKE_TARGET)$(NO_COLOR)
+ endif
+endef
+MSG_MAKE_KB = $(eval $(call GENERATE_MSG_MAKE_KB))$(MSG_MAKE_KB_ACTUAL)
+define GENERATE_MSG_MAKE_TEST
+ MSG_MAKE_TEST_ACTUAL := Making test $(BOLD)$(TEST_NAME)$(NO_COLOR)
+ ifneq ($$(MAKE_TARGET),)
+ MSG_MAKE_TEST_ACTUAL += with target $(BOLD)$$(MAKE_TARGET)$(NO_COLOR)
+ endif
+endef
+MSG_MAKE_TEST = $(eval $(call GENERATE_MSG_MAKE_TEST))$(MSG_MAKE_TEST_ACTUAL)
+MSG_TEST = Testing $(BOLD)$(TEST_NAME)$(NO_COLOR)
+define GENERATE_MSG_AVAILABLE_KEYMAPS
+ MSG_AVAILABLE_KEYMAPS_ACTUAL := Available keymaps for $(BOLD)$$(CURRENT_KB)$(NO_COLOR):
+endef
+MSG_AVAILABLE_KEYMAPS = $(eval $(call GENERATE_MSG_AVAILABLE_KEYMAPS))$(MSG_AVAILABLE_KEYMAPS_ACTUAL)
+
+MSG_CHECK_FILESIZE = Checking file size of $(TARGET).$(FIRMWARE_FORMAT)
+MSG_CHECK_FILESIZE_SKIPPED = (Firmware size check does not yet support $(MCU_ORIG); skipping)
+MSG_FILE_TOO_BIG = $(ERROR_COLOR)The firmware is too large!$(NO_COLOR) $(CURRENT_SIZE)/$(MAX_SIZE) ($(OVER_SIZE) bytes over)\n
+MSG_FILE_TOO_SMALL = The firmware is too small! $(CURRENT_SIZE)/$(MAX_SIZE)\n
+MSG_FILE_JUST_RIGHT = The firmware size is fine - $(CURRENT_SIZE)/$(MAX_SIZE) ($(PERCENT_SIZE)%%, $(FREE_SIZE) bytes free)\n
+MSG_FILE_NEAR_LIMIT = The firmware size is approaching the maximum - $(CURRENT_SIZE)/$(MAX_SIZE) ($(PERCENT_SIZE)%%, $(FREE_SIZE) bytes free)\n
+MSG_PYTHON_MISSING = $(ERROR_COLOR)ERROR:$(NO_COLOR) Cannot run \"qmk hello\"!\n\n\
+ Please run $(BOLD)qmk setup$(NO_COLOR) to install all the dependencies QMK requires.\n\n
+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
+MSG_FLASH_ARCH = $(WARN_COLOR)WARNING:$(NO_COLOR) This board's architecture is not supported by the \":flash\" target at this time.\n\n
+MSG_BOOTLOADER_NOT_FOUND = $(ERROR_COLOR)ERROR:$(NO_COLOR) Bootloader not found. Trying again in 5s (Ctrl+C to cancel)\n
+BOOTLOADER_RETRY_TIME ?= 0.5
+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 0000000000..ee60597e1c
--- /dev/null
+++ b/builddefs/show_options.mk
@@ -0,0 +1,147 @@
+BUILD_OPTION_NAMES = \
+ BOOTMAGIC_ENABLE \
+ MOUSEKEY_ENABLE \
+ EXTRAKEY_ENABLE \
+ CONSOLE_ENABLE \
+ COMMAND_ENABLE \
+ NKRO_ENABLE \
+ TERMINAL_ENABLE \
+ CUSTOM_MATRIX \
+ DEBOUNCE_TYPE \
+ SPLIT_KEYBOARD \
+ DYNAMIC_KEYMAP_ENABLE \
+ USB_HID_ENABLE \
+ VIA_ENABLE
+
+HARDWARE_OPTION_NAMES = \
+ SLEEP_LED_ENABLE \
+ BACKLIGHT_ENABLE \
+ BACKLIGHT_DRIVER \
+ RGBLIGHT_ENABLE \
+ RGBLIGHT_CUSTOM_DRIVER \
+ RGB_MATRIX_ENABLE \
+ RGB_MATRIX_DRIVER \
+ CIE1931_CURVE \
+ MIDI_ENABLE \
+ BLUETOOTH_ENABLE \
+ BLUETOOTH_DRIVER \
+ AUDIO_ENABLE \
+ HD44780_ENABLE \
+ ENCODER_ENABLE \
+ LED_TABLES \
+ POINTING_DEVICE_ENABLE \
+ DIP_SWITCH_ENABLE
+
+OTHER_OPTION_NAMES = \
+ UNICODE_ENABLE \
+ UCIS_ENABLE \
+ UNICODEMAP_ENABLE \
+ UNICODE_COMMON \
+ AUTO_SHIFT_ENABLE \
+ AUTO_SHIFT_MODIFIERS \
+ COMBO_ENABLE \
+ KEY_LOCK_ENABLE \
+ KEY_OVERRIDE_ENABLE \
+ LEADER_ENABLE \
+ PRINTING_ENABLE \
+ STENO_ENABLE \
+ TAP_DANCE_ENABLE \
+ VIRTSER_ENABLE \
+ OLED_ENABLE \
+ OLED_DRIVER \
+ LED_BACK_ENABLE \
+ LED_UNDERGLOW_ENABLE \
+ LED_ANIMATIONS \
+ IOS_DEVICE_ENABLE \
+ HELIX ZINC \
+ AUTOLOG_ENABLE \
+ DEBUG_ENABLE \
+ ENCODER_ENABLE_CUSTOM \
+ GERMAN_ENABLE \
+ HAPTIC_ENABLE \
+ HHKB_RN42_ENABLE \
+ ISSI_ENABLE \
+ KEYLOGGER_ENABLE \
+ LCD_BACKLIGHT_ENABLE \
+ MACROS_ENABLED \
+ PS2_MOUSE_ENABLE \
+ RAW_ENABLE \
+ SWAP_HANDS_ENABLE \
+ RING_BUFFERED_6KRO_REPORT_ENABLE \
+ WATCHDOG_ENABLE \
+ ERGOINU \
+ NO_USB_STARTUP_CHECK \
+ DISABLE_PROMICRO_LEDs \
+ MITOSIS_DATAGROK_BOTTOMSPACE \
+ MITOSIS_DATAGROK_SLOWUART \
+ RGB_MATRIX_KEYPRESSES \
+ LED_MIRRORED \
+ RGBLIGHT_FULL_POWER \
+ LTO_ENABLE \
+ PROGRAMMABLE_BUTTON_ENABLE
+
+define NAME_ECHO
+ @printf " %-30s = %-16s # %s\\n" "$1" "$($1)" "$(origin $1)"
+
+endef
+
+define YAML_NAME_ECHO
+ @echo ' $1 : "$(strip $($1))"'
+
+endef
+
+.PHONY: show_build_options0 show_build_options
+show_build_options0:
+ @echo " KEYBOARD = $(KEYBOARD)"
+ @echo " KEYMAP = $(KEYMAP)"
+ @echo " MCU = $(MCU)"
+ @echo " MCU_SERIES = $(MCU_SERIES)"
+ @echo " PLATFORM = $(PLATFORM)"
+ @echo " BOOTLOADER = $(BOOTLOADER)"
+ @echo " FIRMWARE_FORMAT = $(FIRMWARE_FORMAT)"
+ @echo
+ @echo "Build Options:"
+ $(foreach A_OPTION_NAME,$(sort $(BUILD_OPTION_NAMES)),\
+ $(call NAME_ECHO,$(A_OPTION_NAME)))
+
+show_build_options: show_build_options0
+ @echo
+ @echo "If you want to know more, please try 'show_all_features' or 'show_full_features'"
+ @echo
+
+.PHONY: show_all_features
+show_all_features: show_build_options0
+ @echo
+ @echo "Hardware Options:"
+ $(foreach A_OPTION_NAME,$(sort $(HARDWARE_OPTION_NAMES)),\
+ $(if $($(A_OPTION_NAME)),$(call NAME_ECHO,$(A_OPTION_NAME))))
+ @echo
+ @echo "Other Options:"
+ $(foreach A_OPTION_NAME,$(sort $(OTHER_OPTION_NAMES)),\
+ $(if $($(A_OPTION_NAME)),$(call NAME_ECHO,$(A_OPTION_NAME))))
+
+.PHONY: show_full_features
+show_full_features: show_build_options0
+ @echo
+ @echo "Hardware Options:"
+ $(foreach A_OPTION_NAME,$(sort $(HARDWARE_OPTION_NAMES)),\
+ $(call NAME_ECHO,$(A_OPTION_NAME)))
+ @echo
+ @echo "Other Options:"
+ $(foreach A_OPTION_NAME,$(sort $(OTHER_OPTION_NAMES)),\
+ $(call NAME_ECHO,$(A_OPTION_NAME)))
+
+.PHONY: yaml_build_options
+yaml_build_options:
+ @echo '- KEYBOARD : "$(KEYBOARD)"'
+ @echo ' KEYMAP : "$(KEYMAP)"'
+ @echo ' MCU : "$(MCU)"'
+ @echo ' MCU_SERIES : "$(MCU_SERIES)"'
+ @echo ' PLATFORM : "$(PLATFORM)"'
+ @echo ' FIRMWARE_FORMAT : "$(FIRMWARE_FORMAT)"'
+ $(foreach A_OPTION_NAME,$(sort $(BUILD_OPTION_NAMES)),\
+ $(call YAML_NAME_ECHO,$(A_OPTION_NAME)))
+ $(foreach A_OPTION_NAME,$(sort $(HARDWARE_OPTION_NAMES)),\
+ $(if $($(A_OPTION_NAME)),$(call YAML_NAME_ECHO,$(A_OPTION_NAME))))
+ $(foreach A_OPTION_NAME,$(sort $(OTHER_OPTION_NAMES)),\
+ $(if $($(A_OPTION_NAME)),$(call YAML_NAME_ECHO,$(A_OPTION_NAME))))
diff --git a/common.mk b/common.mk
deleted file mode 100644
index 8acea39376..0000000000
--- a/common.mk
+++ /dev/null
@@ -1,28 +0,0 @@
-include message.mk
-
-# Directory common source files exist
-TOP_DIR = .
-TMK_DIR = tmk_core
-TMK_PATH = $(TMK_DIR)
-LIB_PATH = lib
-
-QUANTUM_DIR = quantum
-QUANTUM_PATH = $(QUANTUM_DIR)
-
-DRIVER_DIR = drivers
-DRIVER_PATH = $(DRIVER_DIR)
-
-PLATFORM_DIR = platforms
-PLATFORM_PATH = $(PLATFORM_DIR)
-
-BUILD_DIR := .build
-
-COMMON_VPATH := $(TOP_DIR)
-COMMON_VPATH += $(TMK_PATH)
-COMMON_VPATH += $(QUANTUM_PATH)
-COMMON_VPATH += $(QUANTUM_PATH)/keymap_extras
-COMMON_VPATH += $(QUANTUM_PATH)/audio
-COMMON_VPATH += $(QUANTUM_PATH)/process_keycode
-COMMON_VPATH += $(QUANTUM_PATH)/api
-COMMON_VPATH += $(QUANTUM_PATH)/sequencer
-COMMON_VPATH += $(DRIVER_PATH)
diff --git a/disable_features.mk b/disable_features.mk
deleted file mode 100644
index 090a9b5a11..0000000000
--- a/disable_features.mk
+++ /dev/null
@@ -1,28 +0,0 @@
-# Unconditionally disable features that a keyboard advertises it doesn't support
-
-FEATURE_NAMES :=
-FEATURE_NAMES += AUDIO
-FEATURE_NAMES += BACKLIGHT
-FEATURE_NAMES += BLUETOOTH
-FEATURE_NAMES += DIP_SWITCH
-FEATURE_NAMES += DYNAMIC_KEYMAP
-FEATURE_NAMES += ENCODER
-FEATURE_NAMES += HAPTIC
-FEATURE_NAMES += HD44780
-FEATURE_NAMES += IOS_DEVICE
-FEATURE_NAMES += LCD_BACKLIGHT
-FEATURE_NAMES += LCD
-FEATURE_NAMES += OLED
-FEATURE_NAMES += POINTING_DEVICE
-FEATURE_NAMES += PRINTING
-FEATURE_NAMES += PS2_MOUSE
-FEATURE_NAMES += RGBLIGHT
-FEATURE_NAMES += RGB_MATRIX
-FEATURE_NAMES += SLEEP_LED
-FEATURE_NAMES += STENO
-FEATURE_NAMES += SWAP_HANDS
-FEATURE_NAMES += WATCHDOG
-FEATURE_NAMES += XT
-
-$(foreach AFEATURE,$(FEATURE_NAMES),\
- $(if $(filter $($(AFEATURE)_SUPPORTED),no),$(eval $(AFEATURE)_ENABLE=no)))
diff --git a/generic_features.mk b/generic_features.mk
deleted file mode 100644
index ff02d56bbe..0000000000
--- a/generic_features.mk
+++ /dev/null
@@ -1,49 +0,0 @@
-# Copyright 2021 QMK
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see .
-
-SPACE_CADET_ENABLE ?= yes
-GRAVE_ESC_ENABLE ?= yes
-
-GENERIC_FEATURES = \
- COMBO \
- COMMAND \
- DIGITIZER \
- DIP_SWITCH \
- DYNAMIC_KEYMAP \
- DYNAMIC_MACRO \
- ENCODER \
- GRAVE_ESC \
- HAPTIC \
- KEY_LOCK \
- KEY_OVERRIDE \
- LEADER \
- PROGRAMMABLE_BUTTON \
- SPACE_CADET \
- TAP_DANCE \
- VELOCIKEY \
- WPM \
-
-define HANDLE_GENERIC_FEATURE
- # $$(info "Processing: $1_ENABLE $2.c")
- SRC += $$(wildcard $$(QUANTUM_DIR)/process_keycode/process_$2.c)
- SRC += $$(wildcard $$(QUANTUM_DIR)/$2.c)
- OPT_DEFS += -D$1_ENABLE
-endef
-
-$(foreach F,$(GENERIC_FEATURES),\
- $(if $(filter yes, $(strip $($(F)_ENABLE))),\
- $(eval $(call HANDLE_GENERIC_FEATURE,$(F),$(shell echo $(F) | tr '[:upper:]' '[:lower:]'))) \
- ) \
-)
diff --git a/message.mk b/message.mk
deleted file mode 100644
index cb4ef43719..0000000000
--- a/message.mk
+++ /dev/null
@@ -1,102 +0,0 @@
-COLOR ?= true
-
-ifeq ($(COLOR),true)
- NO_COLOR=\033[0m
- OK_COLOR=\033[32;01m
- ERROR_COLOR=\033[31;01m
- WARN_COLOR=\033[33;01m
- SKIPPED_COLOR=\033[36;01m
- BLUE=\033[0;34m
- BOLD=\033[1m
-endif
-
-ifneq ($(shell echo "1 2 3" | awk '{ printf "%2s", $$3; }' 2>/dev/null)," 3")
- AWK=awk
-else
- AWK=cat && test
-endif
-
-ON_ERROR ?= exit 1
-
-OK_STRING=$(OK_COLOR)[OK]$(NO_COLOR)\n
-ERROR_STRING=$(ERROR_COLOR)[ERRORS]$(NO_COLOR)\n
-WARN_STRING=$(WARN_COLOR)[WARNINGS]$(NO_COLOR)\n
-SKIPPED_STRING=$(SKIPPED_COLOR)[SKIPPED]$(NO_COLOR)\n
-
-TAB_LOG = printf "\n%s\n\n" "$$LOG" | $(AWK) '{ sub(/^/," | "); print }'
-TAB_LOG_PLAIN = printf "%s\n" "$$LOG"
-AWK_STATUS = $(AWK) '{ printf " %-10s\n", $$1; }'
-AWK_CMD = $(AWK) '{ printf "%-99s", $$0; }'
-PRINT_ERROR = ($(SILENT) ||printf " $(ERROR_STRING)" | $(AWK_STATUS)) && $(TAB_LOG) && $(ON_ERROR)
-PRINT_WARNING = ($(SILENT) || printf " $(WARN_STRING)" | $(AWK_STATUS)) && $(TAB_LOG)
-PRINT_ERROR_PLAIN = ($(SILENT) ||printf " $(ERROR_STRING)" | $(AWK_STATUS)) && $(TAB_LOG_PLAIN) && $(ON_ERROR)
-PRINT_WARNING_PLAIN = ($(SILENT) || printf " $(WARN_STRING)" | $(AWK_STATUS)) && $(TAB_LOG_PLAIN)
-PRINT_SKIPPED_PLAIN = ($(SILENT) || printf " $(SKIPPED_STRING)" | $(AWK_STATUS))
-PRINT_OK = $(SILENT) || printf " $(OK_STRING)" | $(AWK_STATUS)
-BUILD_CMD = LOG=$$($(CMD) 2>&1) ; if [ $$? -gt 0 ]; then $(PRINT_ERROR); elif [ "$$LOG" != "" ] ; then $(PRINT_WARNING); else $(PRINT_OK); fi;
-MAKE_MSG_FORMAT = $(AWK) '{ printf "%-118s", $$0;}'
-
-# The UNSYNC_OUTPUT_CMD command disables the `--output-sync` for the current command, if the `--output-sync` granularity is `target` or lower.
-# This is achieved by telling make to treat the current command as if it invokes a recursive make subcommand (as if by calling `$(MAKE)`).
-UNSYNC_OUTPUT_CMD = +true
-
-# Define Messages
-# English
-MSG_ERRORS_NONE = Errors: none
-MSG_ERRORS = $(ERROR_COLOR)Make finished with errors\n$(NO_COLOR)
-MSG_BEGIN = -------- begin --------
-MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
-MSG_SIZE_AFTER = Size after:
-MSG_COFF = Converting to AVR COFF:
-MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
-MSG_FLASH = Creating load file for flashing:
-MSG_UF2 = Creating UF2 file for deployment:
-MSG_EEPROM = Creating load file for EEPROM:
-MSG_BIN = Creating binary load file for flashing:
-MSG_EXTENDED_LISTING = Creating Extended Listing:
-MSG_SYMBOL_TABLE = Creating Symbol Table:
-MSG_EXECUTING = Executing:
-MSG_LINKING = Linking:
-MSG_COMPILING = Compiling:
-MSG_COMPILING_CXX = Compiling:
-MSG_ASSEMBLING = Assembling:
-MSG_CLEANING = Cleaning project:
-MSG_CREATING_LIBRARY = Creating library:
-MSG_SUBMODULE_DIRTY = $(WARN_COLOR)WARNING:$(NO_COLOR) Some git submodules are out of date or modified.\n\
-Please consider running $(BOLD)make git-submodule$(NO_COLOR).\n\n
-MSG_NO_CMP = $(ERROR_COLOR)Error:$(NO_COLOR)$(BOLD) cmp command not found, please install diffutils\n$(NO_COLOR)
-
-define GENERATE_MSG_MAKE_KB
- MSG_MAKE_KB_ACTUAL := Making $$(KB_SP) with keymap $(BOLD)$$(CURRENT_KM)$(NO_COLOR)
- ifneq ($$(MAKE_TARGET),)
- MSG_MAKE_KB_ACTUAL += and target $(BOLD)$$(MAKE_TARGET)$(NO_COLOR)
- endif
-endef
-MSG_MAKE_KB = $(eval $(call GENERATE_MSG_MAKE_KB))$(MSG_MAKE_KB_ACTUAL)
-define GENERATE_MSG_MAKE_TEST
- MSG_MAKE_TEST_ACTUAL := Making test $(BOLD)$(TEST_NAME)$(NO_COLOR)
- ifneq ($$(MAKE_TARGET),)
- MSG_MAKE_TEST_ACTUAL += with target $(BOLD)$$(MAKE_TARGET)$(NO_COLOR)
- endif
-endef
-MSG_MAKE_TEST = $(eval $(call GENERATE_MSG_MAKE_TEST))$(MSG_MAKE_TEST_ACTUAL)
-MSG_TEST = Testing $(BOLD)$(TEST_NAME)$(NO_COLOR)
-define GENERATE_MSG_AVAILABLE_KEYMAPS
- MSG_AVAILABLE_KEYMAPS_ACTUAL := Available keymaps for $(BOLD)$$(CURRENT_KB)$(NO_COLOR):
-endef
-MSG_AVAILABLE_KEYMAPS = $(eval $(call GENERATE_MSG_AVAILABLE_KEYMAPS))$(MSG_AVAILABLE_KEYMAPS_ACTUAL)
-
-MSG_CHECK_FILESIZE = Checking file size of $(TARGET).$(FIRMWARE_FORMAT)
-MSG_CHECK_FILESIZE_SKIPPED = (Firmware size check does not yet support $(MCU_ORIG); skipping)
-MSG_FILE_TOO_BIG = $(ERROR_COLOR)The firmware is too large!$(NO_COLOR) $(CURRENT_SIZE)/$(MAX_SIZE) ($(OVER_SIZE) bytes over)\n
-MSG_FILE_TOO_SMALL = The firmware is too small! $(CURRENT_SIZE)/$(MAX_SIZE)\n
-MSG_FILE_JUST_RIGHT = The firmware size is fine - $(CURRENT_SIZE)/$(MAX_SIZE) ($(PERCENT_SIZE)%%, $(FREE_SIZE) bytes free)\n
-MSG_FILE_NEAR_LIMIT = The firmware size is approaching the maximum - $(CURRENT_SIZE)/$(MAX_SIZE) ($(PERCENT_SIZE)%%, $(FREE_SIZE) bytes free)\n
-MSG_PYTHON_MISSING = $(ERROR_COLOR)ERROR:$(NO_COLOR) Cannot run \"qmk hello\"!\n\n\
- Please run $(BOLD)qmk setup$(NO_COLOR) to install all the dependencies QMK requires.\n\n
-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
-MSG_FLASH_ARCH = $(WARN_COLOR)WARNING:$(NO_COLOR) This board's architecture is not supported by the \":flash\" target at this time.\n\n
-MSG_BOOTLOADER_NOT_FOUND = $(ERROR_COLOR)ERROR:$(NO_COLOR) Bootloader not found. Trying again in 5s (Ctrl+C to cancel)\n
-BOOTLOADER_RETRY_TIME ?= 0.5
-MSG_BOOTLOADER_NOT_FOUND_QUICK_RETRY = Bootloader not found. Trying again every $(BOOTLOADER_RETRY_TIME)s (Ctrl+C to cancel)
diff --git a/paths.mk b/paths.mk
new file mode 100644
index 0000000000..78eaf39967
--- /dev/null
+++ b/paths.mk
@@ -0,0 +1,29 @@
+# Directory common source files exist
+TOP_DIR = .
+TMK_DIR = tmk_core
+TMK_PATH = $(TMK_DIR)
+LIB_PATH = lib
+
+QUANTUM_DIR = quantum
+QUANTUM_PATH = $(QUANTUM_DIR)
+
+DRIVER_DIR = drivers
+DRIVER_PATH = $(DRIVER_DIR)
+
+PLATFORM_DIR = platforms
+PLATFORM_PATH = $(PLATFORM_DIR)
+
+BUILDDEFS_DIR = builddefs
+BUILDDEFS_PATH = $(BUILDDEFS_DIR)
+
+BUILD_DIR := .build
+
+COMMON_VPATH := $(TOP_DIR)
+COMMON_VPATH += $(TMK_PATH)
+COMMON_VPATH += $(QUANTUM_PATH)
+COMMON_VPATH += $(QUANTUM_PATH)/keymap_extras
+COMMON_VPATH += $(QUANTUM_PATH)/audio
+COMMON_VPATH += $(QUANTUM_PATH)/process_keycode
+COMMON_VPATH += $(QUANTUM_PATH)/api
+COMMON_VPATH += $(QUANTUM_PATH)/sequencer
+COMMON_VPATH += $(DRIVER_PATH)
diff --git a/quantum/mcu_selection.mk b/quantum/mcu_selection.mk
deleted file mode 100644
index 1251b7a2b7..0000000000
--- a/quantum/mcu_selection.mk
+++ /dev/null
@@ -1,668 +0,0 @@
-MCU_ORIG := $(MCU)
-
-ifneq ($(findstring MKL26Z64, $(MCU)),)
- # Cortex version
- MCU = cortex-m0plus
-
- # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
- ARMV = 6
-
- ## chip/board settings
- # - the next two should match the directories in
- # /os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
- MCU_FAMILY = KINETIS
- MCU_SERIES = KL2x
-
- # Linker script to use
- # - it should exist either in /os/common/ports/ARMCMx/compilers/GCC/ld/
- # or /ld/
- MCU_LDSCRIPT ?= MKL26Z64
-
- # Startup code to use
- # - it should exist in /os/common/ports/ARMCMx/compilers/GCC/mk/
- MCU_STARTUP ?= kl2x
-
- # Board: it should exist either in /os/hal/boards/,
- # /boards/, or drivers/boards/
- BOARD ?= PJRC_TEENSY_LC
-endif
-
-ifneq ($(findstring MK20DX128, $(MCU)),)
- # Cortex version
- MCU = cortex-m4
-
- # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
- ARMV = 7
-
- ## chip/board settings
- # - the next two should match the directories in
- # /os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
- MCU_FAMILY = KINETIS
- MCU_SERIES = K20x
-
- # Linker script to use
- # - it should exist either in /os/common/ports/ARMCMx/compilers/GCC/ld/
- # or /ld/
- MCU_LDSCRIPT ?= MK20DX128
-
- # Startup code to use
- # - it should exist in /os/common/ports/ARMCMx/compilers/GCC/mk/
- MCU_STARTUP ?= k20x5
-
- # Board: it should exist either in /os/hal/boards/,
- # /boards/, or drivers/boards/
- BOARD ?= PJRC_TEENSY_3
-endif
-
-ifneq ($(findstring MK20DX256, $(MCU)),)
- # Cortex version
- MCU = cortex-m4
-
- # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
- ARMV = 7
-
- ## chip/board settings
- # - the next two should match the directories in
- # /os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
- MCU_FAMILY = KINETIS
- MCU_SERIES = K20x
-
- # Linker script to use
- # - it should exist either in /os/common/ports/ARMCMx/compilers/GCC/ld/
- # or /ld/
- MCU_LDSCRIPT ?= MK20DX256
-
- # Startup code to use
- # - it should exist in /os/common/ports/ARMCMx/compilers/GCC/mk/
- MCU_STARTUP ?= k20x7
-
- # Board: it should exist either in /os/hal/boards/,
- # /boards/, or drivers/boards/
- BOARD ?= PJRC_TEENSY_3_1
-endif
-
-ifneq ($(findstring MK66FX1M0, $(MCU)),)
- # Cortex version
- MCU = cortex-m4
-
- # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
- ARMV = 7
-
- ## chip/board settings
- # - the next two should match the directories in
- # /os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
- MCU_FAMILY = KINETIS
- MCU_SERIES = MK66F18
-
- # Linker script to use
- # - it should exist either in /os/common/ports/ARMCMx/compilers/GCC/ld/
- # or /ld/
- MCU_LDSCRIPT ?= MK66FX1M0
-
- # Startup code to use
- # - it should exist in /os/common/startup/ARMCMx/compilers/GCC/mk/
- MCU_STARTUP ?= MK66F18
-
- # Board: it should exist either in /os/hal/boards/,
- # /boards/, or drivers/boards/
- BOARD ?= PJRC_TEENSY_3_6
-endif
-
-ifneq ($(findstring STM32F042, $(MCU)),)
- # Cortex version
- MCU = cortex-m0
-
- # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
- ARMV = 6
-
- ## chip/board settings
- # - the next two should match the directories in
- # /os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
- MCU_FAMILY = STM32
- MCU_SERIES = STM32F0xx
-
- # Linker script to use
- # - it should exist either in /os/common/startup/ARMCMx/compilers/GCC/ld/
- # or /ld/
- MCU_LDSCRIPT ?= STM32F042x6
-
- # Startup code to use
- # - it should exist in /os/common/startup/ARMCMx/compilers/GCC/mk/
- MCU_STARTUP ?= stm32f0xx
-
- # Board: it should exist either in /os/hal/boards/,
- # /boards/, or drivers/boards/
- BOARD ?= GENERIC_STM32_F042X6
-
- USE_FPU ?= no
-
- # UF2 settings
- UF2_FAMILY ?= STM32F0
-
- # Stack sizes: Since this chip has limited RAM capacity, the stack area needs to be reduced.
- # This ensures that the EEPROM page buffer fits into RAM
- USE_PROCESS_STACKSIZE = 0x600
- USE_EXCEPTIONS_STACKSIZE = 0x300
-endif
-
-ifneq ($(findstring STM32F072, $(MCU)),)
- # Cortex version
- MCU = cortex-m0
-
- # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
- ARMV = 6
-
- ## chip/board settings
- # - the next two should match the directories in
- # /os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
- MCU_FAMILY = STM32
- MCU_SERIES = STM32F0xx
-
- # Linker script to use
- # - it should exist either in /os/common/startup/ARMCMx/compilers/GCC/ld/
- # or /ld/
- MCU_LDSCRIPT ?= STM32F072xB
-
- # Startup code to use
- # - it should exist in /os/common/startup/ARMCMx/compilers/GCC/mk/
- MCU_STARTUP ?= stm32f0xx
-
- # Board: it should exist either in /os/hal/boards/,
- # /boards/, or drivers/boards/
- BOARD ?= GENERIC_STM32_F072XB
-
- USE_FPU ?= no
-
- # UF2 settings
- UF2_FAMILY ?= STM32F0
-endif
-
-ifneq ($(findstring STM32F103, $(MCU)),)
- # Cortex version
- MCU = cortex-m3
-
- # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
- ARMV = 7
-
- ## chip/board settings
- # - the next two should match the directories in
- # /os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
- MCU_FAMILY = STM32
- MCU_SERIES = STM32F1xx
-
- # Linker script to use
- # - it should exist either in /os/common/startup/ARMCMx/compilers/GCC/ld/
- # or /ld/
- MCU_LDSCRIPT ?= STM32F103x8
-
- # Startup code to use
- # - it should exist in /os/common/startup/ARMCMx/compilers/GCC/mk/
- MCU_STARTUP ?= stm32f1xx
-
- # Board: it should exist either in /os/hal/boards/,
- # /boards/, or drivers/boards/
- BOARD ?= GENERIC_STM32_F103
-
- USE_FPU ?= no
-
- # UF2 settings
- UF2_FAMILY ?= STM32F1
-endif
-
-ifneq ($(findstring STM32F303, $(MCU)),)
- # Cortex version
- MCU = cortex-m4
-
- # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
- ARMV = 7
-
- ## chip/board settings
- # - the next two should match the directories in
- # /os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
- MCU_FAMILY = STM32
- MCU_SERIES = STM32F3xx
-
- # Linker script to use
- # - it should exist either in /os/common/startup/ARMCMx/compilers/GCC/ld/
- # or /ld/
- MCU_LDSCRIPT ?= STM32F303xC
-
- # Startup code to use
- # - it should exist in /os/common/startup/ARMCMx/compilers/GCC/mk/
- MCU_STARTUP ?= stm32f3xx
-
- # Board: it should exist either in /os/hal/boards/,
- # /boards/, or drivers/boards/
- BOARD ?= GENERIC_STM32_F303XC
-
- USE_FPU ?= yes
-
- # UF2 settings
- UF2_FAMILY ?= STM32F3
-endif
-
-ifneq ($(findstring STM32F401, $(MCU)),)
- # Cortex version
- MCU = cortex-m4
-
- # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
- ARMV = 7
-
- ## chip/board settings
- # - the next two should match the directories in
- # /os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
- MCU_FAMILY = STM32
- MCU_SERIES = STM32F4xx
-
- # Linker script to use
- # - it should exist either in /os/common/startup/ARMCMx/compilers/GCC/ld/
- # or /ld/
- ifeq ($(strip $(BOOTLOADER)), tinyuf2)
- MCU_LDSCRIPT ?= STM32F401xC_tinyuf2
- FIRMWARE_FORMAT ?= uf2
- else
- MCU_LDSCRIPT ?= STM32F401xC
- endif
-
- # Startup code to use
- # - it should exist in /os/common/startup/ARMCMx/compilers/GCC/mk/
- MCU_STARTUP ?= stm32f4xx
-
- # Board: it should exist either in /os/hal/boards/,
- # /boards/, or drivers/boards/
- BOARD ?= BLACKPILL_STM32_F401
-
- USE_FPU ?= yes
-
- # UF2 settings
- UF2_FAMILY ?= STM32F4
-endif
-
-ifneq ($(findstring STM32F405, $(MCU)),)
- # Cortex version
- MCU = cortex-m4
-
- # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
- ARMV = 7
-
- ## chip/board settings
- # - the next two should match the directories in
- # /os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
- MCU_FAMILY = STM32
- MCU_SERIES = STM32F4xx
-
- # Linker script to use
- # - it should exist either in /os/common/ports/ARMCMx/compilers/GCC/ld/
- # or /ld/
- MCU_LDSCRIPT ?= STM32F405xG
-
- # Startup code to use
- # - it should exist in /os/common/startup/ARMCMx/compilers/GCC/mk/
- MCU_STARTUP ?= stm32f4xx
-
- # Board: it should exist either in /os/hal/boards/,
- # /boards/, or drivers/boards/
- BOARD ?= GENERIC_STM32_F405XG
-
- USE_FPU ?= yes
-
- # UF2 settings
- UF2_FAMILY ?= STM32F4
-endif
-
-ifneq ($(findstring STM32F407, $(MCU)),)
- # Cortex version
- MCU = cortex-m4
-
- # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
- ARMV = 7
-
- ## chip/board settings
- # - the next two should match the directories in
- # /os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
- MCU_FAMILY = STM32
- MCU_SERIES = STM32F4xx
-
- # Linker script to use
- # - it should exist either in /os/common/startup/ARMCMx/compilers/GCC/ld/
- # or /ld/
- MCU_LDSCRIPT ?= STM32F407xE
-
- # Startup code to use
- # - it should exist in /os/common/startup/ARMCMx/compilers/GCC/mk/
- MCU_STARTUP ?= stm32f4xx
-
- # Board: it should exist either in /os/hal/boards/,
- # /boards/, or drivers/boards/
- BOARD ?= GENERIC_STM32_F407XE
-
- USE_FPU ?= yes
-
- # UF2 settings
- UF2_FAMILY ?= STM32F4
-endif
-
-ifneq ($(findstring STM32F411, $(MCU)),)
- # Cortex version
- MCU = cortex-m4
-
- # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
- ARMV = 7
-
- ## chip/board settings
- # - the next two should match the directories in
- # /os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
- MCU_FAMILY = STM32
- MCU_SERIES = STM32F4xx
-
- # Linker script to use
- # - it should exist either in /os/common/startup/ARMCMx/compilers/GCC/ld/
- # or /ld/
- ifeq ($(strip $(BOOTLOADER)), tinyuf2)
- MCU_LDSCRIPT ?= STM32F411xE_tinyuf2
- FIRMWARE_FORMAT ?= uf2
- else
- MCU_LDSCRIPT ?= STM32F411xE
- endif
-
- # Startup code to use
- # - it should exist in /os/common/startup/ARMCMx/compilers/GCC/mk/
- MCU_STARTUP ?= stm32f4xx
-
- # Board: it should exist either in /os/hal/boards/,
- # /boards/, or drivers/boards/
- BOARD ?= BLACKPILL_STM32_F411
-
- USE_FPU ?= yes
-
- # UF2 settings
- UF2_FAMILY ?= STM32F4
-endif
-
-ifneq ($(findstring STM32F446, $(MCU)),)
- # Cortex version
- MCU = cortex-m4
-
- # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
- ARMV = 7
-
- ## chip/board settings
- # - the next two should match the directories in
- # /os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
- MCU_FAMILY = STM32
- MCU_SERIES = STM32F4xx
-
- # Linker script to use
- # - it should exist either in /os/common/startup/ARMCMx/compilers/GCC/ld/
- # or /ld/
- MCU_LDSCRIPT ?= STM32F446xE
-
- # Startup code to use
- # - it should exist in /os/common/startup/ARMCMx/compilers/GCC/mk/
- MCU_STARTUP ?= stm32f4xx
-
- # Board: it should exist either in /os/hal/boards/,
- # /boards/, or drivers/boards/
- BOARD ?= GENERIC_STM32_F446XE
-
- USE_FPU ?= yes
-endif
-
-ifneq ($(findstring STM32G431, $(MCU)),)
- # Cortex version
- MCU = cortex-m4
-
- # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
- ARMV = 7
-
- ## chip/board settings
- # - the next two should match the directories in
- # /os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
- MCU_FAMILY = STM32
- MCU_SERIES = STM32G4xx
-
- # Linker script to use
- # - it should exist either in /os/common/startup/ARMCMx/compilers/GCC/ld/
- # or /ld/
- MCU_LDSCRIPT ?= STM32G431xB
-
- # Startup code to use
- # - it should exist in /os/common/startup/ARMCMx/compilers/GCC/mk/
- MCU_STARTUP ?= stm32g4xx
-
- # Board: it should exist either in /os/hal/boards/,
- # /boards/, or drivers/boards/
- BOARD ?= GENERIC_STM32_G431XB
-
- USE_FPU ?= yes
-
- # UF2 settings
- UF2_FAMILY ?= STM32G4
-endif
-
-ifneq ($(findstring STM32G474, $(MCU)),)
- # Cortex version
- MCU = cortex-m4
-
- # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
- ARMV = 7
-
- ## chip/board settings
- # - the next two should match the directories in
- # /os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
- MCU_FAMILY = STM32
- MCU_SERIES = STM32G4xx
-
- # Linker script to use
- # - it should exist either in /os/common/startup/ARMCMx/compilers/GCC/ld/
- # or /ld/
- MCU_LDSCRIPT ?= STM32G474xE
-
- # Startup code to use
- # - it should exist in /os/common/startup/ARMCMx/compilers/GCC/mk/
- MCU_STARTUP ?= stm32g4xx
-
- # Board: it should exist either in /os/hal/boards/,
- # /boards/, or drivers/boards/
- BOARD ?= GENERIC_STM32_G474XE
-
- USE_FPU ?= yes
-
- # UF2 settings
- UF2_FAMILY ?= STM32G4
-endif
-
-ifneq (,$(filter $(MCU),STM32L433 STM32L443))
- # Cortex version
- MCU = cortex-m4
-
- # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
- ARMV = 7
-
- ## chip/board settings
- # - the next two should match the directories in
- # /os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
- MCU_FAMILY = STM32
- MCU_SERIES = STM32L4xx
-
- # Linker script to use
- # - it should exist either in /os/common/startup/ARMCMx/compilers/GCC/ld/
- # or /ld/
- MCU_LDSCRIPT ?= STM32L432xC
-
- # Startup code to use
- # - it should exist in /os/common/startup/ARMCMx/compilers/GCC/mk/
- MCU_STARTUP ?= stm32l4xx
-
- # Board: it should exist either in /os/hal/boards/,
- # /boards/, or drivers/boards/
- BOARD ?= GENERIC_STM32_L433XC
-
- PLATFORM_NAME ?= platform_l432
-
- USE_FPU ?= yes
-
- # UF2 settings
- UF2_FAMILY ?= STM32L4
-endif
-
-ifneq (,$(filter $(MCU),STM32L412 STM32L422))
- # Cortex version
- MCU = cortex-m4
-
- # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
- ARMV = 7
-
- ## chip/board settings
- # - the next two should match the directories in
- # /os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
- MCU_FAMILY = STM32
- MCU_SERIES = STM32L4xx
-
- # Linker script to use
- # - it should exist either in /os/common/startup/ARMCMx/compilers/GCC/ld/
- # or /ld/
- MCU_LDSCRIPT ?= STM32L412xB
-
- # Startup code to use
- # - it should exist in /os/common/startup/ARMCMx/compilers/GCC/mk/
- MCU_STARTUP ?= stm32l4xx
-
- # Board: it should exist either in /os/hal/boards/,
- # /boards/, or drivers/boards/
- BOARD ?= GENERIC_STM32_L412XB
-
- PLATFORM_NAME ?= platform_l432
-
- USE_FPU ?= yes
-
- # UF2 settings
- UF2_FAMILY ?= STM32L4
-endif
-
-ifneq ($(findstring GD32VF103, $(MCU)),)
- # RISC-V
- MCU = risc-v
-
- # RISC-V extensions and abi configuration
- MCU_ARCH = rv32imac
- MCU_ABI = ilp32
- MCU_CMODEL = medlow
-
- ## chip/board settings
- # - the next two should match the directories in
- # /os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
- MCU_FAMILY = GD32V
- MCU_SERIES = GD32VF103
-
- # Linker script to use
- # - it should exist either in /os/common/startup/RISCV-ECLIC/compilers/GCC/ld/
- # or /ld/
- MCU_LDSCRIPT ?= GD32VF103xB
-
- # Startup code to use
- # - it should exist in /os/common/startup/RISCV-ECLIC/compilers/GCC/mk/
- MCU_STARTUP ?= gd32vf103
-
- # Board: it should exist either in /os/hal/boards/,
- # /boards/, or drivers/boards/
- BOARD ?= SIPEED_LONGAN_NANO
-
- USE_FPU ?= no
-endif
-
-ifneq (,$(filter $(MCU),at90usb162 atmega16u2 atmega32u2 atmega16u4 atmega32u4 at90usb646 at90usb647 at90usb1286 at90usb1287))
- PROTOCOL = LUFA
-
- # Processor frequency.
- # This will define a symbol, F_CPU, in all source code files equal to the
- # processor frequency in Hz. You can then use this symbol in your source code to
- # calculate timings. Do NOT tack on a 'UL' at the end, this will be done
- # automatically to create a 32-bit value in your source code.
- #
- # This will be an integer division of F_USB below, as it is sourced by
- # F_USB after it has run through any CPU prescalers. Note that this value
- # does not *change* the processor frequency - it should merely be updated to
- # reflect the processor speed set externally so that the code can use accurate
- # software delays.
- F_CPU ?= 16000000
-
- # LUFA specific
- #
- # Target architecture (see library "Board Types" documentation).
- ARCH = AVR8
-
- # Input clock frequency.
- # This will define a symbol, F_USB, in all source code files equal to the
- # input clock frequency (before any prescaling is performed) in Hz. This value may
- # differ from F_CPU if prescaling is used on the latter, and is required as the
- # raw input clock is fed directly to the PLL sections of the AVR for high speed
- # clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
- # at the end, this will be done automatically to create a 32-bit value in your
- # source code.
- #
- # If no clock division is performed on the input clock inside the AVR (via the
- # CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
- F_USB ?= $(F_CPU)
-
- # Interrupt driven control endpoint task
- ifeq (,$(filter $(NO_INTERRUPT_CONTROL_ENDPOINT),yes))
- OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
- endif
- ifneq (,$(filter $(MCU),at90usb162 atmega16u2 atmega32u2))
- NO_I2C = yes
- endif
-endif
-
-ifneq (,$(filter $(MCU),atmega32a))
- # MCU name for avrdude
- AVRDUDE_MCU = m32
-
- PROTOCOL = VUSB
-
- # Processor frequency.
- # This will define a symbol, F_CPU, in all source code files equal to the
- # processor frequency in Hz. You can then use this symbol in your source code to
- # calculate timings. Do NOT tack on a 'UL' at the end, this will be done
- # automatically to create a 32-bit value in your source code.
- F_CPU ?= 12000000
-endif
-
-ifneq (,$(filter $(MCU),atmega328p))
- # MCU name for avrdude
- AVRDUDE_MCU = m328p
-
- PROTOCOL = VUSB
-
- # Processor frequency.
- # This will define a symbol, F_CPU, in all source code files equal to the
- # processor frequency in Hz. You can then use this symbol in your source code to
- # calculate timings. Do NOT tack on a 'UL' at the end, this will be done
- # automatically to create a 32-bit value in your source code.
- F_CPU ?= 16000000
-endif
-
-ifneq (,$(filter $(MCU),atmega328))
- # MCU name for avrdude
- AVRDUDE_MCU = m328
-
- PROTOCOL = VUSB
-
- # Processor frequency.
- # This will define a symbol, F_CPU, in all source code files equal to the
- # processor frequency in Hz. You can then use this symbol in your source code to
- # calculate timings. Do NOT tack on a 'UL' at the end, this will be done
- # automatically to create a 32-bit value in your source code.
- F_CPU ?= 16000000
-endif
-
-ifneq (,$(filter $(MCU),attiny85))
- PROTOCOL = VUSB
-
- # Processor frequency.
- # This will define a symbol, F_CPU, in all source code files equal to the
- # processor frequency in Hz. You can then use this symbol in your source code to
- # calculate timings. Do NOT tack on a 'UL' at the end, this will be done
- # automatically to create a 32-bit value in your source code.
- F_CPU ?= 16500000
-endif
diff --git a/show_options.mk b/show_options.mk
deleted file mode 100644
index ee60597e1c..0000000000
--- a/show_options.mk
+++ /dev/null
@@ -1,147 +0,0 @@
-BUILD_OPTION_NAMES = \
- BOOTMAGIC_ENABLE \
- MOUSEKEY_ENABLE \
- EXTRAKEY_ENABLE \
- CONSOLE_ENABLE \
- COMMAND_ENABLE \
- NKRO_ENABLE \
- TERMINAL_ENABLE \
- CUSTOM_MATRIX \
- DEBOUNCE_TYPE \
- SPLIT_KEYBOARD \
- DYNAMIC_KEYMAP_ENABLE \
- USB_HID_ENABLE \
- VIA_ENABLE
-
-HARDWARE_OPTION_NAMES = \
- SLEEP_LED_ENABLE \
- BACKLIGHT_ENABLE \
- BACKLIGHT_DRIVER \
- RGBLIGHT_ENABLE \
- RGBLIGHT_CUSTOM_DRIVER \
- RGB_MATRIX_ENABLE \
- RGB_MATRIX_DRIVER \
- CIE1931_CURVE \
- MIDI_ENABLE \
- BLUETOOTH_ENABLE \
- BLUETOOTH_DRIVER \
- AUDIO_ENABLE \
- HD44780_ENABLE \
- ENCODER_ENABLE \
- LED_TABLES \
- POINTING_DEVICE_ENABLE \
- DIP_SWITCH_ENABLE
-
-OTHER_OPTION_NAMES = \
- UNICODE_ENABLE \
- UCIS_ENABLE \
- UNICODEMAP_ENABLE \
- UNICODE_COMMON \
- AUTO_SHIFT_ENABLE \
- AUTO_SHIFT_MODIFIERS \
- COMBO_ENABLE \
- KEY_LOCK_ENABLE \
- KEY_OVERRIDE_ENABLE \
- LEADER_ENABLE \
- PRINTING_ENABLE \
- STENO_ENABLE \
- TAP_DANCE_ENABLE \
- VIRTSER_ENABLE \
- OLED_ENABLE \
- OLED_DRIVER \
- LED_BACK_ENABLE \
- LED_UNDERGLOW_ENABLE \
- LED_ANIMATIONS \
- IOS_DEVICE_ENABLE \
- HELIX ZINC \
- AUTOLOG_ENABLE \
- DEBUG_ENABLE \
- ENCODER_ENABLE_CUSTOM \
- GERMAN_ENABLE \
- HAPTIC_ENABLE \
- HHKB_RN42_ENABLE \
- ISSI_ENABLE \
- KEYLOGGER_ENABLE \
- LCD_BACKLIGHT_ENABLE \
- MACROS_ENABLED \
- PS2_MOUSE_ENABLE \
- RAW_ENABLE \
- SWAP_HANDS_ENABLE \
- RING_BUFFERED_6KRO_REPORT_ENABLE \
- WATCHDOG_ENABLE \
- ERGOINU \
- NO_USB_STARTUP_CHECK \
- DISABLE_PROMICRO_LEDs \
- MITOSIS_DATAGROK_BOTTOMSPACE \
- MITOSIS_DATAGROK_SLOWUART \
- RGB_MATRIX_KEYPRESSES \
- LED_MIRRORED \
- RGBLIGHT_FULL_POWER \
- LTO_ENABLE \
- PROGRAMMABLE_BUTTON_ENABLE
-
-define NAME_ECHO
- @printf " %-30s = %-16s # %s\\n" "$1" "$($1)" "$(origin $1)"
-
-endef
-
-define YAML_NAME_ECHO
- @echo ' $1 : "$(strip $($1))"'
-
-endef
-
-.PHONY: show_build_options0 show_build_options
-show_build_options0:
- @echo " KEYBOARD = $(KEYBOARD)"
- @echo " KEYMAP = $(KEYMAP)"
- @echo " MCU = $(MCU)"
- @echo " MCU_SERIES = $(MCU_SERIES)"
- @echo " PLATFORM = $(PLATFORM)"
- @echo " BOOTLOADER = $(BOOTLOADER)"
- @echo " FIRMWARE_FORMAT = $(FIRMWARE_FORMAT)"
- @echo
- @echo "Build Options:"
- $(foreach A_OPTION_NAME,$(sort $(BUILD_OPTION_NAMES)),\
- $(call NAME_ECHO,$(A_OPTION_NAME)))
-
-show_build_options: show_build_options0
- @echo
- @echo "If you want to know more, please try 'show_all_features' or 'show_full_features'"
- @echo
-
-.PHONY: show_all_features
-show_all_features: show_build_options0
- @echo
- @echo "Hardware Options:"
- $(foreach A_OPTION_NAME,$(sort $(HARDWARE_OPTION_NAMES)),\
- $(if $($(A_OPTION_NAME)),$(call NAME_ECHO,$(A_OPTION_NAME))))
- @echo
- @echo "Other Options:"
- $(foreach A_OPTION_NAME,$(sort $(OTHER_OPTION_NAMES)),\
- $(if $($(A_OPTION_NAME)),$(call NAME_ECHO,$(A_OPTION_NAME))))
-
-.PHONY: show_full_features
-show_full_features: show_build_options0
- @echo
- @echo "Hardware Options:"
- $(foreach A_OPTION_NAME,$(sort $(HARDWARE_OPTION_NAMES)),\
- $(call NAME_ECHO,$(A_OPTION_NAME)))
- @echo
- @echo "Other Options:"
- $(foreach A_OPTION_NAME,$(sort $(OTHER_OPTION_NAMES)),\
- $(call NAME_ECHO,$(A_OPTION_NAME)))
-
-.PHONY: yaml_build_options
-yaml_build_options:
- @echo '- KEYBOARD : "$(KEYBOARD)"'
- @echo ' KEYMAP : "$(KEYMAP)"'
- @echo ' MCU : "$(MCU)"'
- @echo ' MCU_SERIES : "$(MCU_SERIES)"'
- @echo ' PLATFORM : "$(PLATFORM)"'
- @echo ' FIRMWARE_FORMAT : "$(FIRMWARE_FORMAT)"'
- $(foreach A_OPTION_NAME,$(sort $(BUILD_OPTION_NAMES)),\
- $(call YAML_NAME_ECHO,$(A_OPTION_NAME)))
- $(foreach A_OPTION_NAME,$(sort $(HARDWARE_OPTION_NAMES)),\
- $(if $($(A_OPTION_NAME)),$(call YAML_NAME_ECHO,$(A_OPTION_NAME))))
- $(foreach A_OPTION_NAME,$(sort $(OTHER_OPTION_NAMES)),\
- $(if $($(A_OPTION_NAME)),$(call YAML_NAME_ECHO,$(A_OPTION_NAME))))
--
cgit v1.2.3