From d96380e65496912e0f68e6531565f4b45efd1623 Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Sat, 21 Mar 2020 05:20:04 +0000 Subject: [PATCH] Initial arm->chibios pass - simplify some platform logic (#8450) --- build_keyboard.mk | 5 ++++- build_test.mk | 1 + common_features.mk | 12 ++---------- drivers/{arm => chibios}/analog.c | 0 drivers/{arm => chibios}/analog.h | 0 drivers/{arm => chibios}/i2c_master.c | 0 drivers/{arm => chibios}/i2c_master.h | 0 drivers/{arm => chibios}/ws2812.c | 0 drivers/{arm => chibios}/ws2812.h | 0 drivers/{arm => chibios}/ws2812_pwm.c | 0 drivers/{arm => chibios}/ws2812_spi.c | 0 keyboards/hs60/v2/ansi/rules.mk | 2 +- keyboards/hs60/v2/hhkb/rules.mk | 2 +- keyboards/hs60/v2/iso/rules.mk | 2 +- keyboards/nk65/rules.mk | 2 +- keyboards/wilba_tech/wt_rgb_backlight.c | 2 +- quantum/audio/{audio.c => audio_avr.c} | 0 quantum/audio/{audio_arm.c => audio_chibios.c} | 0 .../{backlight_arm.c => backlight_chibios.c} | 0 tmk_core/chibios.mk | 2 +- tmk_core/common.mk | 14 ++------------ 21 files changed, 15 insertions(+), 29 deletions(-) rename drivers/{arm => chibios}/analog.c (100%) rename drivers/{arm => chibios}/analog.h (100%) rename drivers/{arm => chibios}/i2c_master.c (100%) rename drivers/{arm => chibios}/i2c_master.h (100%) rename drivers/{arm => chibios}/ws2812.c (100%) rename drivers/{arm => chibios}/ws2812.h (100%) rename drivers/{arm => chibios}/ws2812_pwm.c (100%) rename drivers/{arm => chibios}/ws2812_spi.c (100%) rename quantum/audio/{audio.c => audio_avr.c} (100%) rename quantum/audio/{audio_arm.c => audio_chibios.c} (100%) rename quantum/backlight/{backlight_arm.c => backlight_chibios.c} (100%) diff --git a/build_keyboard.mk b/build_keyboard.mk index b086420653..bfadede376 100644 --- a/build_keyboard.mk +++ b/build_keyboard.mk @@ -231,13 +231,16 @@ endif # We can assume a ChibiOS target When MCU_FAMILY is defined since it's # not used for LUFA ifdef MCU_FAMILY - FIRMWARE_FORMAT?=bin PLATFORM=CHIBIOS + PLATFORM_KEY=chibios + FIRMWARE_FORMAT?=bin else ifdef ARM_ATSAM PLATFORM=ARM_ATSAM + PLATFORM_KEY=arm_atsam FIRMWARE_FORMAT=bin else PLATFORM=AVR + PLATFORM_KEY=avr FIRMWARE_FORMAT?=hex endif diff --git a/build_test.mk b/build_test.mk index cac2cba509..d13d9a515b 100644 --- a/build_test.mk +++ b/build_test.mk @@ -41,6 +41,7 @@ all: elf VPATH += $(COMMON_VPATH) PLATFORM:=TEST +PLATFORM_KEY:=test ifneq ($(filter $(FULL_TESTS),$(TEST)),) include tests/$(TEST)/rules.mk diff --git a/common_features.mk b/common_features.mk index b71dbc77e2..64ddc85fd3 100644 --- a/common_features.mk +++ b/common_features.mk @@ -35,11 +35,7 @@ ifeq ($(strip $(AUDIO_ENABLE)), yes) MUSIC_ENABLE := 1 SRC += $(QUANTUM_DIR)/process_keycode/process_audio.c SRC += $(QUANTUM_DIR)/process_keycode/process_clicky.c - ifeq ($(PLATFORM),AVR) - SRC += $(QUANTUM_DIR)/audio/audio.c - else - SRC += $(QUANTUM_DIR)/audio/audio_arm.c - endif + SRC += $(QUANTUM_DIR)/audio/audio_$(PLATFORM_KEY).c SRC += $(QUANTUM_DIR)/audio/voices.c SRC += $(QUANTUM_DIR)/audio/luts.c endif @@ -315,11 +311,7 @@ ifeq ($(strip $(BACKLIGHT_ENABLE)), yes) else SRC += $(QUANTUM_DIR)/backlight/backlight_driver_common.c ifeq ($(strip $(BACKLIGHT_DRIVER)), pwm) - ifeq ($(PLATFORM),AVR) - SRC += $(QUANTUM_DIR)/backlight/backlight_avr.c - else - SRC += $(QUANTUM_DIR)/backlight/backlight_arm.c - endif + SRC += $(QUANTUM_DIR)/backlight/backlight_$(PLATFORM_KEY).c else SRC += $(QUANTUM_DIR)/backlight/backlight_$(strip $(BACKLIGHT_DRIVER)).c endif diff --git a/drivers/arm/analog.c b/drivers/chibios/analog.c similarity index 100% rename from drivers/arm/analog.c rename to drivers/chibios/analog.c diff --git a/drivers/arm/analog.h b/drivers/chibios/analog.h similarity index 100% rename from drivers/arm/analog.h rename to drivers/chibios/analog.h diff --git a/drivers/arm/i2c_master.c b/drivers/chibios/i2c_master.c similarity index 100% rename from drivers/arm/i2c_master.c rename to drivers/chibios/i2c_master.c diff --git a/drivers/arm/i2c_master.h b/drivers/chibios/i2c_master.h similarity index 100% rename from drivers/arm/i2c_master.h rename to drivers/chibios/i2c_master.h diff --git a/drivers/arm/ws2812.c b/drivers/chibios/ws2812.c similarity index 100% rename from drivers/arm/ws2812.c rename to drivers/chibios/ws2812.c diff --git a/drivers/arm/ws2812.h b/drivers/chibios/ws2812.h similarity index 100% rename from drivers/arm/ws2812.h rename to drivers/chibios/ws2812.h diff --git a/drivers/arm/ws2812_pwm.c b/drivers/chibios/ws2812_pwm.c similarity index 100% rename from drivers/arm/ws2812_pwm.c rename to drivers/chibios/ws2812_pwm.c diff --git a/drivers/arm/ws2812_spi.c b/drivers/chibios/ws2812_spi.c similarity index 100% rename from drivers/arm/ws2812_spi.c rename to drivers/chibios/ws2812_spi.c diff --git a/keyboards/hs60/v2/ansi/rules.mk b/keyboards/hs60/v2/ansi/rules.mk index d013775c11..8efabcccbf 100644 --- a/keyboards/hs60/v2/ansi/rules.mk +++ b/keyboards/hs60/v2/ansi/rules.mk @@ -30,4 +30,4 @@ SRC = keyboards/wilba_tech/wt_main.c \ keyboards/wilba_tech/wt_rgb_backlight.c \ drivers/issi/is31fl3733.c \ quantum/color.c \ - drivers/arm/i2c_master.c + drivers/chibios/i2c_master.c diff --git a/keyboards/hs60/v2/hhkb/rules.mk b/keyboards/hs60/v2/hhkb/rules.mk index 44399851f0..14951cca70 100644 --- a/keyboards/hs60/v2/hhkb/rules.mk +++ b/keyboards/hs60/v2/hhkb/rules.mk @@ -28,4 +28,4 @@ SRC = keyboards/wilba_tech/wt_main.c \ keyboards/wilba_tech/wt_rgb_backlight.c \ drivers/issi/is31fl3733.c \ quantum/color.c \ - drivers/arm/i2c_master.c + drivers/chibios/i2c_master.c diff --git a/keyboards/hs60/v2/iso/rules.mk b/keyboards/hs60/v2/iso/rules.mk index 582ed4e817..96bfbce056 100644 --- a/keyboards/hs60/v2/iso/rules.mk +++ b/keyboards/hs60/v2/iso/rules.mk @@ -30,4 +30,4 @@ SRC = keyboards/wilba_tech/wt_main.c \ keyboards/wilba_tech/wt_rgb_backlight.c \ drivers/issi/is31fl3733.c \ quantum/color.c \ - drivers/arm/i2c_master.c + drivers/chibios/i2c_master.c diff --git a/keyboards/nk65/rules.mk b/keyboards/nk65/rules.mk index 1b734161fc..f7db412a24 100755 --- a/keyboards/nk65/rules.mk +++ b/keyboards/nk65/rules.mk @@ -30,4 +30,4 @@ SRC = keyboards/wilba_tech/wt_main.c \ keyboards/wilba_tech/wt_rgb_backlight.c \ drivers/issi/is31fl3733.c \ quantum/color.c \ - drivers/arm/i2c_master.c + drivers/chibios/i2c_master.c diff --git a/keyboards/wilba_tech/wt_rgb_backlight.c b/keyboards/wilba_tech/wt_rgb_backlight.c index 9db4478efb..1a8bd8981a 100644 --- a/keyboards/wilba_tech/wt_rgb_backlight.c +++ b/keyboards/wilba_tech/wt_rgb_backlight.c @@ -49,7 +49,7 @@ #else #include "ch.h" #include "hal.h" -#include "drivers/arm/i2c_master.h" +#include "drivers/chibios/i2c_master.h" #endif #if defined(RGB_BACKLIGHT_DAWN60) diff --git a/quantum/audio/audio.c b/quantum/audio/audio_avr.c similarity index 100% rename from quantum/audio/audio.c rename to quantum/audio/audio_avr.c diff --git a/quantum/audio/audio_arm.c b/quantum/audio/audio_chibios.c similarity index 100% rename from quantum/audio/audio_arm.c rename to quantum/audio/audio_chibios.c diff --git a/quantum/backlight/backlight_arm.c b/quantum/backlight/backlight_chibios.c similarity index 100% rename from quantum/backlight/backlight_arm.c rename to quantum/backlight/backlight_chibios.c diff --git a/tmk_core/chibios.mk b/tmk_core/chibios.mk index 014019ef04..b400e9e0f1 100644 --- a/tmk_core/chibios.mk +++ b/tmk_core/chibios.mk @@ -179,7 +179,7 @@ HEX = $(OBJCOPY) -O $(FORMAT) EEP = BIN = $(OBJCOPY) -O binary -COMMON_VPATH += $(DRIVER_PATH)/arm +COMMON_VPATH += $(DRIVER_PATH)/chibios THUMBFLAGS = -DTHUMB_PRESENT -mno-thumb-interwork -DTHUMB_NO_INTERWORKING -mthumb -DTHUMB diff --git a/tmk_core/common.mk b/tmk_core/common.mk index 6863929cee..b766ebe97e 100644 --- a/tmk_core/common.mk +++ b/tmk_core/common.mk @@ -1,13 +1,5 @@ COMMON_DIR = common -ifeq ($(PLATFORM),AVR) - PLATFORM_COMMON_DIR = $(COMMON_DIR)/avr -else ifeq ($(PLATFORM),CHIBIOS) - PLATFORM_COMMON_DIR = $(COMMON_DIR)/chibios -else ifeq ($(PLATFORM),ARM_ATSAM) - PLATFORM_COMMON_DIR = $(COMMON_DIR)/arm_atsam -else - PLATFORM_COMMON_DIR = $(COMMON_DIR)/test -endif +PLATFORM_COMMON_DIR = $(COMMON_DIR)/$(PLATFORM_KEY) TMK_COMMON_SRC += $(COMMON_DIR)/host.c \ $(COMMON_DIR)/keyboard.c \ @@ -179,6 +171,4 @@ endif # Search Path VPATH += $(TMK_PATH)/$(COMMON_DIR) -ifeq ($(PLATFORM),CHIBIOS) -VPATH += $(TMK_PATH)/$(COMMON_DIR)/chibios -endif +VPATH += $(TMK_PATH)/$(PLATFORM_COMMON_DIR)