summaryrefslogtreecommitdiffstats
path: root/builddefs
diff options
context:
space:
mode:
Diffstat (limited to 'builddefs')
-rw-r--r--builddefs/bootloader.mk163
-rw-r--r--builddefs/disable_features.mk28
-rw-r--r--builddefs/generic_features.mk51
-rw-r--r--builddefs/mcu_selection.mk668
-rw-r--r--builddefs/message.mk102
-rw-r--r--builddefs/show_options.mk147
6 files changed, 1159 insertions, 0 deletions
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 <http://www.gnu.org/licenses/>.
+
+# 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..e41ce6ac91
--- /dev/null
+++ b/builddefs/generic_features.mk
@@ -0,0 +1,51 @@
+# 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 <http://www.gnu.org/licenses/>.
+
+SPACE_CADET_ENABLE ?= yes
+GRAVE_ESC_ENABLE ?= yes
+
+GENERIC_FEATURES = \
+ COMBO \
+ COMMAND \
+ DEFERRED_EXEC \
+ DIGITIZER \
+ DIP_SWITCH \
+ DYNAMIC_KEYMAP \
+ DYNAMIC_MACRO \
+ ENCODER \
+ GRAVE_ESC \
+ HAPTIC \
+ KEY_LOCK \
+ KEY_OVERRIDE \
+ LEADER \
+ PROGRAMMABLE_BUTTON \
+ SPACE_CADET \
+ SWAP_HANDS \
+ 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
+ # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
+ MCU_FAMILY = KINETIS
+ MCU_SERIES = KL2x
+
+ # Linker script to use
+ # - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/
+ # or <keyboard_dir>/ld/
+ MCU_LDSCRIPT ?= MKL26Z64
+
+ # Startup code to use
+ # - it should exist in <chibios>/os/common/ports/ARMCMx/compilers/GCC/mk/
+ MCU_STARTUP ?= kl2x
+
+ # Board: it should exist either in <chibios>/os/hal/boards/,
+ # <keyboard_dir>/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
+ # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
+ MCU_FAMILY = KINETIS
+ MCU_SERIES = K20x
+
+ # Linker script to use
+ # - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/
+ # or <keyboard_dir>/ld/
+ MCU_LDSCRIPT ?= MK20DX128
+
+ # Startup code to use
+ # - it should exist in <chibios>/os/common/ports/ARMCMx/compilers/GCC/mk/
+ MCU_STARTUP ?= k20x5
+
+ # Board: it should exist either in <chibios>/os/hal/boards/,
+ # <keyboard_dir>/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
+ # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
+ MCU_FAMILY = KINETIS
+ MCU_SERIES = K20x
+
+ # Linker script to use
+ # - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/
+ # or <keyboard_dir>/ld/
+ MCU_LDSCRIPT ?= MK20DX256
+
+ # Startup code to use
+ # - it should exist in <chibios>/os/common/ports/ARMCMx/compilers/GCC/mk/
+ MCU_STARTUP ?= k20x7
+
+ # Board: it should exist either in <chibios>/os/hal/boards/,
+ # <keyboard_dir>/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
+ # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
+ MCU_FAMILY = KINETIS
+ MCU_SERIES = MK66F18
+
+ # Linker script to use
+ # - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/
+ # or <keyboard_dir>/ld/
+ MCU_LDSCRIPT ?= MK66FX1M0
+
+ # Startup code to use
+ # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/
+ MCU_STARTUP ?= MK66F18
+
+ # Board: it should exist either in <chibios>/os/hal/boards/,
+ # <keyboard_dir>/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
+ # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
+ MCU_FAMILY = STM32
+ MCU_SERIES = STM32F0xx
+
+ # Linker script to use
+ # - it should exist either in <chibios>/os/common/startup/ARMCMx/compilers/GCC/ld/
+ # or <keyboard_dir>/ld/
+ MCU_LDSCRIPT ?= STM32F042x6
+
+ # Startup code to use
+ # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/
+ MCU_STARTUP ?= stm32f0xx
+
+ # Board: it should exist either in <chibios>/os/hal/boards/,
+ # <keyboard_dir>/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
+ # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
+ MCU_FAMILY = STM32
+ MCU_SERIES = STM32F0xx
+
+ # Linker script to use
+ # - it should exist either in <chibios>/os/common/startup/ARMCMx/compilers/GCC/ld/
+ # or <keyboard_dir>/ld/
+ MCU_LDSCRIPT ?= STM32F072xB
+
+ # Startup code to use
+ # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/
+ MCU_STARTUP ?= stm32f0xx
+
+ # Board: it should exist either in <chibios>/os/hal/boards/,
+ # <keyboard_dir>/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
+ # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
+ MCU_FAMILY = STM32
+ MCU_SERIES = STM32F1xx
+
+ # Linker script to use
+ # - it should exist either in <chibios>/os/common/startup/ARMCMx/compilers/GCC/ld/
+ # or <keyboard_dir>/ld/
+ MCU_LDSCRIPT ?= STM32F103x8
+
+ # Startup code to use
+ # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/
+ MCU_STARTUP ?= stm32f1xx
+
+ # Board: it should exist either in <chibios>/os/hal/boards/,
+ # <keyboard_dir>/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
+ # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
+ MCU_FAMILY = STM32
+ MCU_SERIES = STM32F3xx
+
+ # Linker script to use
+ # - it should exist either in <chibios>/os/common/startup/ARMCMx/compilers/GCC/ld/
+ # or <keyboard_dir>/ld/
+ MCU_LDSCRIPT ?= STM32F303xC
+
+ # Startup code to use
+ # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/
+ MCU_STARTUP ?= stm32f3xx
+
+ # Board: it should exist either in <chibios>/os/hal/boards/,
+ # <keyboard_dir>/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
+ # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
+ MCU_FAMILY = STM32
+ MCU_SERIES = STM32F4xx
+
+ # Linker script to use
+ # - it should exist either in <chibios>/os/common/startup/ARMCMx/compilers/GCC/ld/
+ # or <keyboard_dir>/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 <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/
+ MCU_STARTUP ?= stm32f4xx
+
+ # Board: it should exist either in <chibios>/os/hal/boards/,
+ # <keyboard_dir>/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
+ # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
+ MCU_FAMILY = STM32
+ MCU_SERIES = STM32F4xx
+
+ # Linker script to use
+ # - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/
+ # or <keyboard_dir>/ld/
+ MCU_LDSCRIPT ?= STM32F405xG
+
+ # Startup code to use
+ # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/
+ MCU_STARTUP ?= stm32f4xx
+
+ # Board: it should exist either in <chibios>/os/hal/boards/,
+ # <keyboard_dir>/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
+ # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
+ MCU_FAMILY = STM32
+ MCU_SERIES = STM32F4xx
+
+ # Linker script to use
+ # - it should exist either in <chibios>/os/common/startup/ARMCMx/compilers/GCC/ld/
+ # or <keyboard_dir>/ld/
+ MCU_LDSCRIPT ?= STM32F407xE
+
+ # Startup code to use
+ # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/
+ MCU_STARTUP ?= stm32f4xx
+
+ # Board: it should exist either in <chibios>/os/hal/boards/,
+ # <keyboard_dir>/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
+ # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
+ MCU_FAMILY = STM32
+ MCU_SERIES = STM32F4xx
+
+ # Linker script to use
+ # - it should exist either in <chibios>/os/common/startup/ARMCMx/compilers/GCC/ld/
+ # or <keyboard_dir>/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 <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/
+ MCU_STARTUP ?= stm32f4xx
+
+ # Board: it should exist either in <chibios>/os/hal/boards/,
+ # <keyboard_dir>/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
+ # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
+ MCU_FAMILY = STM32
+ MCU_SERIES = STM32F4xx
+
+ # Linker script to use
+ # - it should exist either in <chibios>/os/common/startup/ARMCMx/compilers/GCC/ld/
+ # or <keyboard_dir>/ld/
+ MCU_LDSCRIPT ?= STM32F446xE
+
+ # Startup code to use
+ # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/
+ MCU_STARTUP ?= stm32f4xx
+
+ # Board: it should exist either in <chibios>/os/hal/boards/,
+ # <keyboard_dir>/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
+ # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
+ MCU_FAMILY = STM32
+ MCU_SERIES = STM32G4xx
+
+ # Linker script to use
+ # - it should exist either in <chibios>/os/common/startup/ARMCMx/compilers/GCC/ld/
+ # or <keyboard_dir>/ld/
+ MCU_LDSCRIPT ?= STM32G431xB
+
+ # Startup code to use
+ # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/
+ MCU_STARTUP ?= stm32g4xx
+
+ # Board: it should exist either in <chibios>/os/hal/boards/,
+ # <keyboard_dir>/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
+ # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
+ MCU_FAMILY = STM32
+ MCU_SERIES = STM32G4xx
+
+ # Linker script to use
+ # - it should exist either in <chibios>/os/common/startup/ARMCMx/compilers/GCC/ld/
+ # or <keyboard_dir>/ld/
+ MCU_LDSCRIPT ?= STM32G474xE
+
+ # Startup code to use
+ # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/
+ MCU_STARTUP ?= stm32g4xx
+
+ # Board: it should exist either in <chibios>/os/hal/boards/,
+ # <keyboard_dir>/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
+ # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
+ MCU_FAMILY = STM32
+ MCU_SERIES = STM32L4xx
+
+ # Linker script to use
+ # - it should exist either in <chibios>/os/common/startup/ARMCMx/compilers/GCC/ld/
+ # or <keyboard_dir>/ld/
+ MCU_LDSCRIPT ?= STM32L432xC
+
+ # Startup code to use
+ # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/
+ MCU_STARTUP ?= stm32l4xx
+
+ # Board: it should exist either in <chibios>/os/hal/boards/,
+ # <keyboard_dir>/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
+ # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
+ MCU_FAMILY = STM32
+ MCU_SERIES = STM32L4xx
+
+ # Linker script to use
+ # - it should exist either in <chibios>/os/common/startup/ARMCMx/compilers/GCC/ld/
+ # or <keyboard_dir>/ld/
+ MCU_LDSCRIPT ?= STM32L412xB
+
+ # Startup code to use
+ # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/
+ MCU_STARTUP ?= stm32l4xx
+
+ # Board: it should exist either in <chibios>/os/hal/boards/,
+ # <keyboard_dir>/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
+ # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
+ MCU_FAMILY = GD32V
+ MCU_SERIES = GD32VF103
+
+ # Linker script to use
+ # - it should exist either in <chibios>/os/common/startup/RISCV-ECLIC/compilers/GCC/ld/
+ # or <keyboard_dir>/ld/
+ MCU_LDSCRIPT ?= GD32VF103xB
+
+ # Startup code to use
+ # - it should exist in <chibios>/os/common/startup/RISCV-ECLIC/compilers/GCC/mk/
+ MCU_STARTUP ?= gd32vf103
+
+ # Board: it should exist either in <chibios>/os/hal/boards/,
+ # <keyboard_dir>/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