From 5846b40f7444af96b0d8ddf3af9b558193c2475d Mon Sep 17 00:00:00 2001 From: Nick Brassel Date: Sat, 2 Jul 2022 15:18:50 +1000 Subject: RP2040 emulated EEPROM. (#17519) --- builddefs/common_features.mk | 10 +++++++++- builddefs/mcu_selection.mk | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'builddefs') diff --git a/builddefs/common_features.mk b/builddefs/common_features.mk index 2edc1bdef0..c11e5688e3 100644 --- a/builddefs/common_features.mk +++ b/builddefs/common_features.mk @@ -220,6 +220,11 @@ else # True EEPROM on STM32L0xx, L1xx OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_STM32_L0_L1 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 @@ -241,7 +246,7 @@ else endif endif -VALID_WEAR_LEVELING_DRIVER_TYPES := custom embedded_flash spi_flash legacy +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)),) @@ -262,6 +267,9 @@ ifneq ($(strip $(WEAR_LEVELING_DRIVER)),none) 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 diff --git a/builddefs/mcu_selection.mk b/builddefs/mcu_selection.mk index d676e0c06a..135f663c14 100644 --- a/builddefs/mcu_selection.mk +++ b/builddefs/mcu_selection.mk @@ -135,7 +135,7 @@ ifneq ($(findstring RP2040, $(MCU)),) # - it should exist either in /os/common/ports/ARMCMx/compilers/GCC/ld/ # or /ld/ STARTUPLD_CONTRIB = $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/ld - MCU_LDSCRIPT ?= RP2040_FLASH + MCU_LDSCRIPT ?= RP2040_FLASH_TIMECRIT LDFLAGS += -L $(STARTUPLD_CONTRIB) # Startup code to use -- cgit v1.2.3