From 0c97a6e0c0ee297cca14091235a7fdd9c0cc792c Mon Sep 17 00:00:00 2001 From: Nick Brassel Date: Mon, 6 Jun 2022 15:12:22 +1000 Subject: [PATCH 1/4] Rework paths for eeprom locations. --- builddefs/common_features.mk | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/builddefs/common_features.mk b/builddefs/common_features.mk index 631558ef27e2..ff0c6b0cc6e4 100644 --- a/builddefs/common_features.mk +++ b/builddefs/common_features.mk @@ -160,27 +160,26 @@ 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)), 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 +190,13 @@ 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),KL2x K20x),) # Teensy EEPROM implementations OPT_DEFS += -DEEPROM_TEENSY @@ -209,17 +204,16 @@ 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 From a91c5c267643e2b0adc796ae152aed126f1d9697 Mon Sep 17 00:00:00 2001 From: Nick Brassel Date: Tue, 7 Jun 2022 14:59:46 +1000 Subject: [PATCH 2/4] File relocation. --- platforms/chibios/{ => drivers/eeprom}/eeprom_stm32.c | 0 platforms/chibios/{ => drivers/eeprom}/eeprom_stm32.h | 0 platforms/chibios/{ => drivers/eeprom}/eeprom_stm32_defs.h | 0 platforms/chibios/{ => drivers/eeprom}/eeprom_teensy.c | 0 platforms/chibios/{ => drivers/eeprom}/eeprom_teensy.h | 0 platforms/chibios/{ => drivers/flash}/flash.mk | 0 platforms/chibios/{ => drivers/flash}/flash_stm32.c | 0 platforms/chibios/{ => drivers/flash}/flash_stm32.h | 0 8 files changed, 0 insertions(+), 0 deletions(-) rename platforms/chibios/{ => drivers/eeprom}/eeprom_stm32.c (100%) rename platforms/chibios/{ => drivers/eeprom}/eeprom_stm32.h (100%) rename platforms/chibios/{ => drivers/eeprom}/eeprom_stm32_defs.h (100%) rename platforms/chibios/{ => drivers/eeprom}/eeprom_teensy.c (100%) rename platforms/chibios/{ => drivers/eeprom}/eeprom_teensy.h (100%) rename platforms/chibios/{ => drivers/flash}/flash.mk (100%) rename platforms/chibios/{ => drivers/flash}/flash_stm32.c (100%) rename platforms/chibios/{ => drivers/flash}/flash_stm32.h (100%) diff --git a/platforms/chibios/eeprom_stm32.c b/platforms/chibios/drivers/eeprom/eeprom_stm32.c similarity index 100% rename from platforms/chibios/eeprom_stm32.c rename to platforms/chibios/drivers/eeprom/eeprom_stm32.c diff --git a/platforms/chibios/eeprom_stm32.h b/platforms/chibios/drivers/eeprom/eeprom_stm32.h similarity index 100% rename from platforms/chibios/eeprom_stm32.h rename to platforms/chibios/drivers/eeprom/eeprom_stm32.h diff --git a/platforms/chibios/eeprom_stm32_defs.h b/platforms/chibios/drivers/eeprom/eeprom_stm32_defs.h similarity index 100% rename from platforms/chibios/eeprom_stm32_defs.h rename to platforms/chibios/drivers/eeprom/eeprom_stm32_defs.h diff --git a/platforms/chibios/eeprom_teensy.c b/platforms/chibios/drivers/eeprom/eeprom_teensy.c similarity index 100% rename from platforms/chibios/eeprom_teensy.c rename to platforms/chibios/drivers/eeprom/eeprom_teensy.c diff --git a/platforms/chibios/eeprom_teensy.h b/platforms/chibios/drivers/eeprom/eeprom_teensy.h similarity index 100% rename from platforms/chibios/eeprom_teensy.h rename to platforms/chibios/drivers/eeprom/eeprom_teensy.h diff --git a/platforms/chibios/flash.mk b/platforms/chibios/drivers/flash/flash.mk similarity index 100% rename from platforms/chibios/flash.mk rename to platforms/chibios/drivers/flash/flash.mk diff --git a/platforms/chibios/flash_stm32.c b/platforms/chibios/drivers/flash/flash_stm32.c similarity index 100% rename from platforms/chibios/flash_stm32.c rename to platforms/chibios/drivers/flash/flash_stm32.c diff --git a/platforms/chibios/flash_stm32.h b/platforms/chibios/drivers/flash/flash_stm32.h similarity index 100% rename from platforms/chibios/flash_stm32.h rename to platforms/chibios/drivers/flash/flash_stm32.h From d7cb7f95adc22251338f2b7ed2697ba1beca51ee Mon Sep 17 00:00:00 2001 From: Nick Brassel Date: Tue, 7 Jun 2022 16:05:31 +1000 Subject: [PATCH 3/4] Wrong file move. --- platforms/chibios/{drivers/flash => }/flash.mk | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename platforms/chibios/{drivers/flash => }/flash.mk (100%) diff --git a/platforms/chibios/drivers/flash/flash.mk b/platforms/chibios/flash.mk similarity index 100% rename from platforms/chibios/drivers/flash/flash.mk rename to platforms/chibios/flash.mk From 40225513dd8219b8686135b03040357fadd9bc98 Mon Sep 17 00:00:00 2001 From: Nick Brassel Date: Tue, 7 Jun 2022 16:33:23 +1000 Subject: [PATCH 4/4] Fixup test paths. --- platforms/test/rules.mk | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/platforms/test/rules.mk b/platforms/test/rules.mk index 55512c7392f0..a2baa283d02c 100644 --- a/platforms/test/rules.mk +++ b/platforms/test/rules.mk @@ -11,7 +11,8 @@ eeprom_stm32_large_DEFS := $(eeprom_stm32_DEFS) \ -DFEE_PAGE_COUNT=16 eeprom_stm32_INC := \ - $(PLATFORM_PATH)/chibios/ + $(PLATFORM_PATH)/chibios/drivers/eeprom/ \ + $(PLATFORM_PATH)/chibios/drivers/flash/ eeprom_stm32_tiny_INC := $(eeprom_stm32_INC) eeprom_stm32_large_INC := $(eeprom_stm32_INC) @@ -19,6 +20,6 @@ eeprom_stm32_SRC := \ $(TOP_DIR)/drivers/eeprom/eeprom_driver.c \ $(PLATFORM_PATH)/$(PLATFORM_KEY)/eeprom_stm32_tests.cpp \ $(PLATFORM_PATH)/$(PLATFORM_KEY)/flash_stm32_mock.c \ - $(PLATFORM_PATH)/chibios/eeprom_stm32.c + $(PLATFORM_PATH)/chibios/drivers/eeprom/eeprom_stm32.c eeprom_stm32_tiny_SRC := $(eeprom_stm32_SRC) eeprom_stm32_large_SRC := $(eeprom_stm32_SRC)