summaryrefslogtreecommitdiff
path: root/builddefs/common_features.mk
diff options
context:
space:
mode:
Diffstat (limited to 'builddefs/common_features.mk')
-rw-r--r--builddefs/common_features.mk125
1 files changed, 94 insertions, 31 deletions
diff --git a/builddefs/common_features.mk b/builddefs/common_features.mk
index c976b8296d..c11e5688e3 100644
--- a/builddefs/common_features.mk
+++ b/builddefs/common_features.mk
@@ -92,10 +92,29 @@ ifeq ($(MUSIC_ENABLE), yes)
SRC += $(QUANTUM_DIR)/process_keycode/process_music.c
endif
+VALID_STENO_PROTOCOL_TYPES := geminipr txbolt all
+STENO_PROTOCOL ?= all
ifeq ($(strip $(STENO_ENABLE)), yes)
- OPT_DEFS += -DSTENO_ENABLE
- VIRTSER_ENABLE ?= yes
- SRC += $(QUANTUM_DIR)/process_keycode/process_steno.c
+ ifeq ($(filter $(STENO_PROTOCOL),$(VALID_STENO_PROTOCOL_TYPES)),)
+ $(call CATASTROPHIC_ERROR,Invalid STENO_PROTOCOL,STENO_PROTOCOL="$(STENO_PROTOCOL)" is not a valid stenography protocol)
+ else
+ OPT_DEFS += -DSTENO_ENABLE
+ VIRTSER_ENABLE ?= yes
+
+ ifeq ($(strip $(STENO_PROTOCOL)), geminipr)
+ OPT_DEFS += -DSTENO_ENABLE_GEMINI
+ endif
+ ifeq ($(strip $(STENO_PROTOCOL)), txbolt)
+ OPT_DEFS += -DSTENO_ENABLE_BOLT
+ endif
+ ifeq ($(strip $(STENO_PROTOCOL)), all)
+ OPT_DEFS += -DSTENO_ENABLE_ALL
+ OPT_DEFS += -DSTENO_ENABLE_GEMINI
+ OPT_DEFS += -DSTENO_ENABLE_BOLT
+ endif
+
+ SRC += $(QUANTUM_DIR)/process_keycode/process_steno.c
+ endif
endif
ifeq ($(strip $(VIRTSER_ENABLE)), yes)
@@ -154,33 +173,36 @@ ifeq ($(strip $(QUANTUM_PAINTER_ENABLE)), yes)
include $(QUANTUM_DIR)/painter/rules.mk
endif
-VALID_EEPROM_DRIVER_TYPES := vendor custom transient i2c spi
+VALID_EEPROM_DRIVER_TYPES := vendor custom transient i2c spi wear_leveling
EEPROM_DRIVER ?= vendor
ifeq ($(filter $(EEPROM_DRIVER),$(VALID_EEPROM_DRIVER_TYPES)),)
$(call CATASTROPHIC_ERROR,Invalid EEPROM_DRIVER,EEPROM_DRIVER="$(EEPROM_DRIVER)" is not a valid EEPROM driver)
else
OPT_DEFS += -DEEPROM_ENABLE
+ COMMON_VPATH += $(PLATFORM_PATH)/$(PLATFORM_KEY)/$(DRIVER_DIR)/eeprom
+ COMMON_VPATH += $(DRIVER_PATH)/eeprom
+ COMMON_VPATH += $(PLATFORM_COMMON_DIR)
ifeq ($(strip $(EEPROM_DRIVER)), custom)
# Custom EEPROM implementation -- only needs to implement init/erase/read_block/write_block
OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_CUSTOM
- COMMON_VPATH += $(DRIVER_PATH)/eeprom
SRC += eeprom_driver.c
+ else ifeq ($(strip $(EEPROM_DRIVER)), wear_leveling)
+ # Wear-leveling EEPROM implementation
+ OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_WEAR_LEVELING
+ SRC += eeprom_driver.c eeprom_wear_leveling.c
else ifeq ($(strip $(EEPROM_DRIVER)), i2c)
# External I2C EEPROM implementation
OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_I2C
- COMMON_VPATH += $(DRIVER_PATH)/eeprom
QUANTUM_LIB_SRC += i2c_master.c
SRC += eeprom_driver.c eeprom_i2c.c
else ifeq ($(strip $(EEPROM_DRIVER)), spi)
# External SPI EEPROM implementation
OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_SPI
- COMMON_VPATH += $(DRIVER_PATH)/eeprom
QUANTUM_LIB_SRC += spi_master.c
SRC += eeprom_driver.c eeprom_spi.c
else ifeq ($(strip $(EEPROM_DRIVER)), transient)
# Transient EEPROM implementation -- no data storage but provides runtime area for it
OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_TRANSIENT
- COMMON_VPATH += $(DRIVER_PATH)/eeprom
SRC += eeprom_driver.c eeprom_transient.c
else ifeq ($(strip $(EEPROM_DRIVER)), vendor)
# Vendor-implemented EEPROM
@@ -191,17 +213,18 @@ else
ifneq ($(filter STM32F3xx_% STM32F1xx_% %_STM32F401xC %_STM32F401xE %_STM32F405xG %_STM32F411xE %_STM32F072xB %_STM32F042x6 %_GD32VF103xB %_GD32VF103x8, $(MCU_SERIES)_$(MCU_LDSCRIPT)),)
# Emulated EEPROM
OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_STM32_FLASH_EMULATED
- COMMON_VPATH += $(DRIVER_PATH)/eeprom
- SRC += eeprom_driver.c
- SRC += $(PLATFORM_COMMON_DIR)/eeprom_stm32.c
- SRC += $(PLATFORM_COMMON_DIR)/flash_stm32.c
+ COMMON_VPATH += $(PLATFORM_PATH)/$(PLATFORM_KEY)/$(DRIVER_DIR)/flash
+ COMMON_VPATH += $(DRIVER_PATH)/flash
+ SRC += eeprom_driver.c eeprom_stm32.c flash_stm32.c
else ifneq ($(filter $(MCU_SERIES),STM32L0xx STM32L1xx),)
# True EEPROM on STM32L0xx, L1xx
OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_STM32_L0_L1
- COMMON_VPATH += $(DRIVER_PATH)/eeprom
- COMMON_VPATH += $(PLATFORM_PATH)/$(PLATFORM_KEY)/$(DRIVER_DIR)/eeprom
- SRC += eeprom_driver.c
- SRC += eeprom_stm32_L0_L1.c
+ SRC += eeprom_driver.c eeprom_stm32_L0_L1.c
+ else ifneq ($(filter $(MCU_SERIES),RP2040),)
+ # Wear-leveling EEPROM implementation, backed by RP2040 flash
+ OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_WEAR_LEVELING
+ SRC += eeprom_driver.c eeprom_wear_leveling.c
+ WEAR_LEVELING_DRIVER = rp2040_flash
else ifneq ($(filter $(MCU_SERIES),KL2x K20x),)
# Teensy EEPROM implementations
OPT_DEFS += -DEEPROM_TEENSY
@@ -209,32 +232,64 @@ else
else
# Fall back to transient, i.e. non-persistent
OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_TRANSIENT
- COMMON_VPATH += $(DRIVER_PATH)/eeprom
SRC += eeprom_driver.c eeprom_transient.c
endif
else ifeq ($(PLATFORM),ARM_ATSAM)
# arm_atsam EEPROM
OPT_DEFS += -DEEPROM_SAMD
- SRC += $(PLATFORM_COMMON_DIR)/eeprom_samd.c
+ SRC += eeprom_samd.c
else ifeq ($(PLATFORM),TEST)
# Test harness "EEPROM"
OPT_DEFS += -DEEPROM_TEST_HARNESS
- SRC += $(PLATFORM_COMMON_DIR)/eeprom.c
+ SRC += eeprom.c
+ endif
+ endif
+endif
+
+VALID_WEAR_LEVELING_DRIVER_TYPES := custom embedded_flash spi_flash rp2040_flash legacy
+WEAR_LEVELING_DRIVER ?= none
+ifneq ($(strip $(WEAR_LEVELING_DRIVER)),none)
+ ifeq ($(filter $(WEAR_LEVELING_DRIVER),$(VALID_WEAR_LEVELING_DRIVER_TYPES)),)
+ $(call CATASTROPHIC_ERROR,Invalid WEAR_LEVELING_DRIVER,WEAR_LEVELING_DRIVER="$(WEAR_LEVELING_DRIVER)" is not a valid wear leveling driver)
+ else
+ FNV_ENABLE := yes
+ OPT_DEFS += -DWEAR_LEVELING_ENABLE
+ OPT_DEFS += -DWEAR_LEVELING_$(strip $(shell echo $(WEAR_LEVELING_DRIVER) | tr '[:lower:]' '[:upper:]'))
+ COMMON_VPATH += $(PLATFORM_PATH)/$(PLATFORM_KEY)/$(DRIVER_DIR)/wear_leveling
+ COMMON_VPATH += $(DRIVER_PATH)/wear_leveling
+ COMMON_VPATH += $(QUANTUM_DIR)/wear_leveling
+ SRC += wear_leveling.c
+ ifeq ($(strip $(WEAR_LEVELING_DRIVER)), embedded_flash)
+ OPT_DEFS += -DHAL_USE_EFL
+ SRC += wear_leveling_efl.c
+ POST_CONFIG_H += $(PLATFORM_PATH)/$(PLATFORM_KEY)/$(DRIVER_DIR)/wear_leveling/wear_leveling_efl_config.h
+ else ifeq ($(strip $(WEAR_LEVELING_DRIVER)), spi_flash)
+ FLASH_DRIVER := spi
+ SRC += wear_leveling_flash_spi.c
+ POST_CONFIG_H += $(DRIVER_PATH)/wear_leveling/wear_leveling_flash_spi_config.h
+ else ifeq ($(strip $(WEAR_LEVELING_DRIVER)), rp2040_flash)
+ SRC += wear_leveling_rp2040_flash.c
+ POST_CONFIG_H += $(DRIVER_PATH)/wear_leveling/wear_leveling_rp2040_flash_config.h
+ else ifeq ($(strip $(WEAR_LEVELING_DRIVER)), legacy)
+ COMMON_VPATH += $(PLATFORM_PATH)/$(PLATFORM_KEY)/$(DRIVER_DIR)/flash
+ SRC += flash_stm32.c wear_leveling_legacy.c
+ POST_CONFIG_H += $(PLATFORM_PATH)/$(PLATFORM_KEY)/$(DRIVER_DIR)/wear_leveling/wear_leveling_legacy_config.h
endif
endif
endif
VALID_FLASH_DRIVER_TYPES := spi
-FLASH_DRIVER ?= no
-ifneq ($(strip $(FLASH_DRIVER)), no)
+FLASH_DRIVER ?= none
+ifneq ($(strip $(FLASH_DRIVER)), none)
ifeq ($(filter $(FLASH_DRIVER),$(VALID_FLASH_DRIVER_TYPES)),)
- $(error FLASH_DRIVER="$(FLASH_DRIVER)" is not a valid FLASH driver)
+ $(call CATASTROPHIC_ERROR,Invalid FLASH_DRIVER,FLASH_DRIVER="$(FLASH_DRIVER)" is not a valid flash driver)
else
OPT_DEFS += -DFLASH_ENABLE
- ifeq ($(strip $(FLASH_DRIVER)), spi)
+ ifeq ($(strip $(FLASH_DRIVER)),spi)
OPT_DEFS += -DFLASH_DRIVER -DFLASH_SPI
COMMON_VPATH += $(DRIVER_PATH)/flash
SRC += flash_spi.c
+ QUANTUM_LIB_SRC += spi_master.c
endif
endif
endif
@@ -500,7 +555,7 @@ ifeq ($(strip $(BACKLIGHT_ENABLE)), yes)
endif
endif
-VALID_WS2812_DRIVER_TYPES := bitbang pwm spi i2c
+VALID_WS2812_DRIVER_TYPES := bitbang pwm spi i2c vendor
WS2812_DRIVER ?= bitbang
ifeq ($(strip $(WS2812_DRIVER_REQUIRED)), yes)
@@ -542,12 +597,6 @@ ifeq ($(strip $(LED_TABLES)), yes)
SRC += $(QUANTUM_DIR)/led_tables.c
endif
-ifeq ($(strip $(TERMINAL_ENABLE)), yes)
- SRC += $(QUANTUM_DIR)/process_keycode/process_terminal.c
- OPT_DEFS += -DTERMINAL_ENABLE
- OPT_DEFS += -DUSER_PRINT
-endif
-
ifeq ($(strip $(VIA_ENABLE)), yes)
DYNAMIC_KEYMAP_ENABLE := yes
RAW_ENABLE := yes
@@ -595,6 +644,14 @@ ifneq ($(strip $(DEBOUNCE_TYPE)), custom)
QUANTUM_SRC += $(QUANTUM_DIR)/debounce/$(strip $(DEBOUNCE_TYPE)).c
endif
+
+VALID_SERIAL_DRIVER_TYPES := bitbang usart vendor
+
+SERIAL_DRIVER ?= bitbang
+ifeq ($(filter $(SERIAL_DRIVER),$(VALID_SERIAL_DRIVER_TYPES)),)
+ $(call CATASTROPHIC_ERROR,Invalid SERIAL_DRIVER,SERIAL_DRIVER="$(SERIAL_DRIVER)" is not a valid SERIAL driver)
+endif
+
ifeq ($(strip $(SPLIT_KEYBOARD)), yes)
POST_CONFIG_H += $(QUANTUM_DIR)/split_common/post_config.h
OPT_DEFS += -DSPLIT_KEYBOARD
@@ -619,11 +676,11 @@ ifeq ($(strip $(SPLIT_KEYBOARD)), yes)
endif
endif
- SERIAL_DRIVER ?= bitbang
OPT_DEFS += -DSERIAL_DRIVER_$(strip $(shell echo $(SERIAL_DRIVER) | tr '[:lower:]' '[:upper:]'))
ifeq ($(strip $(SERIAL_DRIVER)), bitbang)
QUANTUM_LIB_SRC += serial.c
else
+ QUANTUM_LIB_SRC += serial_protocol.c
QUANTUM_LIB_SRC += serial_$(strip $(SERIAL_DRIVER)).c
endif
endif
@@ -635,6 +692,12 @@ ifeq ($(strip $(CRC_ENABLE)), yes)
SRC += crc.c
endif
+ifeq ($(strip $(FNV_ENABLE)), yes)
+ OPT_DEFS += -DFNV_ENABLE
+ VPATH += $(LIB_PATH)/fnv
+ SRC += qmk_fnv_type_validation.c hash_32a.c hash_64a.c
+endif
+
ifeq ($(strip $(HAPTIC_ENABLE)),yes)
COMMON_VPATH += $(DRIVER_PATH)/haptic