forked from mirrors/qmk_userspace
		
	Move EFL wear-leveling driver to be default for F1, F3, F4, L4, G4, WB32, GD32V. (#19020)
This commit is contained in:
		
					parent
					
						
							
								8c6d2946f7
							
						
					
				
			
			
				commit
				
					
						092228571c
					
				
			
		
					 12 changed files with 36 additions and 23 deletions
				
			
		| 
						 | 
					@ -177,7 +177,7 @@ ifeq ($(strip $(QUANTUM_PAINTER_ENABLE)), yes)
 | 
				
			||||||
    include $(QUANTUM_DIR)/painter/rules.mk
 | 
					    include $(QUANTUM_DIR)/painter/rules.mk
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
VALID_EEPROM_DRIVER_TYPES := vendor custom transient i2c spi wear_leveling
 | 
					VALID_EEPROM_DRIVER_TYPES := vendor custom transient i2c spi wear_leveling legacy_stm32_flash
 | 
				
			||||||
EEPROM_DRIVER ?= vendor
 | 
					EEPROM_DRIVER ?= vendor
 | 
				
			||||||
ifeq ($(filter $(EEPROM_DRIVER),$(VALID_EEPROM_DRIVER_TYPES)),)
 | 
					ifeq ($(filter $(EEPROM_DRIVER),$(VALID_EEPROM_DRIVER_TYPES)),)
 | 
				
			||||||
  $(call CATASTROPHIC_ERROR,Invalid EEPROM_DRIVER,EEPROM_DRIVER="$(EEPROM_DRIVER)" is not a valid EEPROM driver)
 | 
					  $(call CATASTROPHIC_ERROR,Invalid EEPROM_DRIVER,EEPROM_DRIVER="$(EEPROM_DRIVER)" is not a valid EEPROM driver)
 | 
				
			||||||
| 
						 | 
					@ -204,6 +204,12 @@ else
 | 
				
			||||||
    OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_SPI
 | 
					    OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_SPI
 | 
				
			||||||
    QUANTUM_LIB_SRC += spi_master.c
 | 
					    QUANTUM_LIB_SRC += spi_master.c
 | 
				
			||||||
    SRC += eeprom_driver.c eeprom_spi.c
 | 
					    SRC += eeprom_driver.c eeprom_spi.c
 | 
				
			||||||
 | 
					  else ifeq ($(strip $(EEPROM_DRIVER)), legacy_stm32_flash)
 | 
				
			||||||
 | 
					    # STM32 Emulated EEPROM, backed by MCU flash (soon to be deprecated)
 | 
				
			||||||
 | 
					    OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_STM32_FLASH_EMULATED
 | 
				
			||||||
 | 
					    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 ifeq ($(strip $(EEPROM_DRIVER)), transient)
 | 
					  else ifeq ($(strip $(EEPROM_DRIVER)), transient)
 | 
				
			||||||
    # Transient EEPROM implementation -- no data storage but provides runtime area for it
 | 
					    # Transient EEPROM implementation -- no data storage but provides runtime area for it
 | 
				
			||||||
    OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_TRANSIENT
 | 
					    OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_TRANSIENT
 | 
				
			||||||
| 
						 | 
					@ -214,12 +220,17 @@ else
 | 
				
			||||||
    ifeq ($(PLATFORM),AVR)
 | 
					    ifeq ($(PLATFORM),AVR)
 | 
				
			||||||
      # Automatically provided by avr-libc, nothing required
 | 
					      # Automatically provided by avr-libc, nothing required
 | 
				
			||||||
    else ifeq ($(PLATFORM),CHIBIOS)
 | 
					    else ifeq ($(PLATFORM),CHIBIOS)
 | 
				
			||||||
      ifneq ($(filter STM32F3xx_% STM32F1xx_% %_STM32F401xC %_STM32F401xE %_STM32F405xG %_STM32F411xE %_STM32F072xB %_STM32F042x6 %_GD32VF103xB %_GD32VF103x8, $(MCU_SERIES)_$(MCU_LDSCRIPT)),)
 | 
					      ifneq ($(filter %_STM32F072xB %_STM32F042x6, $(MCU_SERIES)_$(MCU_LDSCRIPT)),)
 | 
				
			||||||
        # Emulated EEPROM
 | 
					        # STM32 Emulated EEPROM, backed by MCU flash (soon to be deprecated)
 | 
				
			||||||
        OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_STM32_FLASH_EMULATED
 | 
					        OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_STM32_FLASH_EMULATED
 | 
				
			||||||
        COMMON_VPATH += $(PLATFORM_PATH)/$(PLATFORM_KEY)/$(DRIVER_DIR)/flash
 | 
					        COMMON_VPATH += $(PLATFORM_PATH)/$(PLATFORM_KEY)/$(DRIVER_DIR)/flash
 | 
				
			||||||
        COMMON_VPATH += $(DRIVER_PATH)/flash
 | 
					        COMMON_VPATH += $(DRIVER_PATH)/flash
 | 
				
			||||||
        SRC += eeprom_driver.c eeprom_stm32.c flash_stm32.c
 | 
					        SRC += eeprom_driver.c eeprom_stm32.c flash_stm32.c
 | 
				
			||||||
 | 
					      else ifneq ($(filter $(MCU_SERIES),STM32F1xx STM32F3xx STM32F4xx STM32L4xx STM32G4xx WB32F3G71xx WB32FQ95xx GD32VF103),)
 | 
				
			||||||
 | 
					        # Wear-leveling EEPROM implementation, backed by MCU flash
 | 
				
			||||||
 | 
					        OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_WEAR_LEVELING
 | 
				
			||||||
 | 
					        SRC += eeprom_driver.c eeprom_wear_leveling.c
 | 
				
			||||||
 | 
					        WEAR_LEVELING_DRIVER = embedded_flash
 | 
				
			||||||
      else ifneq ($(filter $(MCU_SERIES),STM32L0xx STM32L1xx),)
 | 
					      else ifneq ($(filter $(MCU_SERIES),STM32L0xx STM32L1xx),)
 | 
				
			||||||
        # True EEPROM on STM32L0xx, L1xx
 | 
					        # True EEPROM on STM32L0xx, L1xx
 | 
				
			||||||
        OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_STM32_L0_L1
 | 
					        OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_STM32_L0_L1
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -348,8 +348,6 @@ ifneq ($(findstring STM32F401, $(MCU)),)
 | 
				
			||||||
  #   or <keyboard_dir>/ld/
 | 
					  #   or <keyboard_dir>/ld/
 | 
				
			||||||
  ifeq ($(strip $(BOOTLOADER)), tinyuf2)
 | 
					  ifeq ($(strip $(BOOTLOADER)), tinyuf2)
 | 
				
			||||||
    MCU_LDSCRIPT ?= STM32F401xC_tinyuf2
 | 
					    MCU_LDSCRIPT ?= STM32F401xC_tinyuf2
 | 
				
			||||||
    EEPROM_DRIVER ?= wear_leveling
 | 
					 | 
				
			||||||
    WEAR_LEVELING_DRIVER ?= legacy
 | 
					 | 
				
			||||||
  else
 | 
					  else
 | 
				
			||||||
    MCU_LDSCRIPT ?= STM32F401xC
 | 
					    MCU_LDSCRIPT ?= STM32F401xC
 | 
				
			||||||
  endif
 | 
					  endif
 | 
				
			||||||
| 
						 | 
					@ -465,8 +463,6 @@ ifneq ($(findstring STM32F411, $(MCU)),)
 | 
				
			||||||
  #   or <keyboard_dir>/ld/
 | 
					  #   or <keyboard_dir>/ld/
 | 
				
			||||||
  ifeq ($(strip $(BOOTLOADER)), tinyuf2)
 | 
					  ifeq ($(strip $(BOOTLOADER)), tinyuf2)
 | 
				
			||||||
    MCU_LDSCRIPT ?= STM32F411xE_tinyuf2
 | 
					    MCU_LDSCRIPT ?= STM32F411xE_tinyuf2
 | 
				
			||||||
    EEPROM_DRIVER ?= wear_leveling
 | 
					 | 
				
			||||||
    WEAR_LEVELING_DRIVER ?= legacy
 | 
					 | 
				
			||||||
  else
 | 
					  else
 | 
				
			||||||
    MCU_LDSCRIPT ?= STM32F411xE
 | 
					    MCU_LDSCRIPT ?= STM32F411xE
 | 
				
			||||||
  endif
 | 
					  endif
 | 
				
			||||||
| 
						 | 
					@ -520,6 +516,9 @@ ifneq ($(findstring STM32F446, $(MCU)),)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # Bootloader address for STM32 DFU
 | 
					  # Bootloader address for STM32 DFU
 | 
				
			||||||
  STM32_BOOTLOADER_ADDRESS ?= 0x1FFF0000
 | 
					  STM32_BOOTLOADER_ADDRESS ?= 0x1FFF0000
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  # Default as no chibios efl config
 | 
				
			||||||
 | 
					  EEPROM_DRIVER ?= transient
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ifneq ($(findstring STM32G431, $(MCU)),)
 | 
					ifneq ($(findstring STM32G431, $(MCU)),)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -19,8 +19,6 @@ RGBLIGHT_ENABLE = no        # Enable keyboard RGB underglow
 | 
				
			||||||
AUDIO_ENABLE = no           # Audio output
 | 
					AUDIO_ENABLE = no           # Audio output
 | 
				
			||||||
RGB_MATRIX_ENABLE = yes
 | 
					RGB_MATRIX_ENABLE = yes
 | 
				
			||||||
RGB_MATRIX_DRIVER = WS2812
 | 
					RGB_MATRIX_DRIVER = WS2812
 | 
				
			||||||
EEPROM_DRIVER = wear_leveling
 | 
					 | 
				
			||||||
WEAR_LEVELING_DRIVER = legacy
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Enter lower-power sleep mode when on the ChibiOS idle thread
 | 
					# Enter lower-power sleep mode when on the ChibiOS idle thread
 | 
				
			||||||
OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE -DDEBUG_EEPROM_OUTPUT=TRUE
 | 
					OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE -DDEBUG_EEPROM_OUTPUT=TRUE
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -20,8 +20,6 @@ AUDIO_ENABLE = no           # Audio output
 | 
				
			||||||
RGB_MATRIX_ENABLE = yes
 | 
					RGB_MATRIX_ENABLE = yes
 | 
				
			||||||
RGB_MATRIX_DRIVER = IS31FL3741
 | 
					RGB_MATRIX_DRIVER = IS31FL3741
 | 
				
			||||||
KEYBOARD_SHARED_EP = yes
 | 
					KEYBOARD_SHARED_EP = yes
 | 
				
			||||||
EEPROM_DRIVER = wear_leveling
 | 
					 | 
				
			||||||
WEAR_LEVELING_DRIVER = legacy
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Enter lower-power sleep mode when on the ChibiOS idle thread
 | 
					# Enter lower-power sleep mode when on the ChibiOS idle thread
 | 
				
			||||||
OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE -DDEBUG_EEPROM_OUTPUT=TRUE
 | 
					OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE -DDEBUG_EEPROM_OUTPUT=TRUE
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -20,7 +20,5 @@ AUDIO_ENABLE = no           # Audio output
 | 
				
			||||||
RGB_MATRIX_ENABLE = yes
 | 
					RGB_MATRIX_ENABLE = yes
 | 
				
			||||||
RGB_MATRIX_DRIVER = WS2812
 | 
					RGB_MATRIX_DRIVER = WS2812
 | 
				
			||||||
 | 
					
 | 
				
			||||||
EEPROM_DRIVER = wear_leveling
 | 
					 | 
				
			||||||
WEAR_LEVELING_DRIVER = legacy
 | 
					 | 
				
			||||||
# Enter lower-power sleep mode when on the ChibiOS idle thread
 | 
					# Enter lower-power sleep mode when on the ChibiOS idle thread
 | 
				
			||||||
OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE -DDEBUG_EEPROM_OUTPUT=TRUE
 | 
					OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE -DDEBUG_EEPROM_OUTPUT=TRUE
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -20,8 +20,5 @@ AUDIO_ENABLE = no           # Audio output
 | 
				
			||||||
RGB_MATRIX_ENABLE = yes
 | 
					RGB_MATRIX_ENABLE = yes
 | 
				
			||||||
RGB_MATRIX_DRIVER = WS2812
 | 
					RGB_MATRIX_DRIVER = WS2812
 | 
				
			||||||
 | 
					
 | 
				
			||||||
EEPROM_DRIVER = wear_leveling
 | 
					 | 
				
			||||||
WEAR_LEVELING_DRIVER = legacy
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Enter lower-power sleep mode when on the ChibiOS idle thread
 | 
					# Enter lower-power sleep mode when on the ChibiOS idle thread
 | 
				
			||||||
OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE -DDEBUG_EEPROM_OUTPUT=TRUE
 | 
					OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE -DDEBUG_EEPROM_OUTPUT=TRUE
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -20,6 +20,7 @@ NKRO_ENABLE = no            # Enable N-Key Rollover
 | 
				
			||||||
BACKLIGHT_ENABLE = no       # Enable keyboard backlight functionality
 | 
					BACKLIGHT_ENABLE = no       # Enable keyboard backlight functionality
 | 
				
			||||||
RGBLIGHT_ENABLE = yes       # HAS TO BE ON! Otherwise the custom matrix doesn't work
 | 
					RGBLIGHT_ENABLE = yes       # HAS TO BE ON! Otherwise the custom matrix doesn't work
 | 
				
			||||||
AUDIO_ENABLE = no           # Audio output
 | 
					AUDIO_ENABLE = no           # Audio output
 | 
				
			||||||
 | 
					LTO_ENABLE = yes
 | 
				
			||||||
 | 
					
 | 
				
			||||||
CUSTOM_MATRIX = lite
 | 
					CUSTOM_MATRIX = lite
 | 
				
			||||||
SRC += matrix.c
 | 
					SRC += matrix.c
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -54,4 +54,6 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
				
			||||||
#define ENCODER_RESOLUTION 4
 | 
					#define ENCODER_RESOLUTION 4
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define TAP_CODE_DELAY 10
 | 
					#define TAP_CODE_DELAY 10
 | 
				
			||||||
#define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 2047
 | 
					
 | 
				
			||||||
 | 
					#define WEAR_LEVELING_BACKING_SIZE 4096
 | 
				
			||||||
 | 
					#define WEAR_LEVELING_LOGICAL_SIZE 2048
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -154,3 +154,6 @@
 | 
				
			||||||
#define TOUCH_UPDATE_INTERVAL 33
 | 
					#define TOUCH_UPDATE_INTERVAL 33
 | 
				
			||||||
#define OLED_UPDATE_INTERVAL 33
 | 
					#define OLED_UPDATE_INTERVAL 33
 | 
				
			||||||
#define TAP_CODE_DELAY 5
 | 
					#define TAP_CODE_DELAY 5
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define WEAR_LEVELING_BACKING_SIZE 4096
 | 
				
			||||||
 | 
					#define WEAR_LEVELING_LOGICAL_SIZE 2048
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -172,3 +172,6 @@
 | 
				
			||||||
#define AUDIO_CLICKY
 | 
					#define AUDIO_CLICKY
 | 
				
			||||||
#define AUDIO_DAC_SAMPLE_WAVEFORM_SQUARE
 | 
					#define AUDIO_DAC_SAMPLE_WAVEFORM_SQUARE
 | 
				
			||||||
#define AUDIO_DAC_OFF_VALUE 0
 | 
					#define AUDIO_DAC_OFF_VALUE 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define WEAR_LEVELING_BACKING_SIZE 4096
 | 
				
			||||||
 | 
					#define WEAR_LEVELING_LOGICAL_SIZE 2048
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -91,5 +91,6 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
				
			||||||
//#define NO_ACTION_TAPPING
 | 
					//#define NO_ACTION_TAPPING
 | 
				
			||||||
//#define NO_ACTION_ONESHOT
 | 
					//#define NO_ACTION_ONESHOT
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* redefine available (emulated) EEPROM as 4 kB rather than the default 1 kB to let VIA use more of the 8 kB of on-chip Flash of the STM32F303 to store 4 layers (since 4 layers * 8 rows * 16 columns * 2 = 1024 bytes but the default max available is 1023 bytes due to ATMEGA32U4 etc. only having 1 kB of EEPROM) */
 | 
					/* redefine available (emulated) EEPROM as 4 kB rather than the default 2 kB to let VIA use more of the on-chip Flash of the STM32F303 to store 4 layers (since 4 layers * 8 rows * 16 columns * 2 = 1024 bytes but the default max available is 1023 bytes due to ATMEGA32U4 etc. only having 1 kB of EEPROM) */
 | 
				
			||||||
#define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 4095
 | 
					#define WEAR_LEVELING_BACKING_SIZE 4096
 | 
				
			||||||
 | 
					#define WEAR_LEVELING_LOGICAL_SIZE 2048
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -20,7 +20,9 @@
 | 
				
			||||||
#        if defined(STM32_FLASH_LINE_SIZE) // from some family's stm32_registry.h file
 | 
					#        if defined(STM32_FLASH_LINE_SIZE) // from some family's stm32_registry.h file
 | 
				
			||||||
#            define BACKING_STORE_WRITE_SIZE (STM32_FLASH_LINE_SIZE)
 | 
					#            define BACKING_STORE_WRITE_SIZE (STM32_FLASH_LINE_SIZE)
 | 
				
			||||||
#        else
 | 
					#        else
 | 
				
			||||||
#            if defined(QMK_MCU_SERIES_STM32F1XX)
 | 
					#            if defined(QMK_MCU_SERIES_STM32F0XX)
 | 
				
			||||||
 | 
					#                define BACKING_STORE_WRITE_SIZE 2 // from hal_efl_lld.c
 | 
				
			||||||
 | 
					#            elif defined(QMK_MCU_SERIES_STM32F1XX)
 | 
				
			||||||
#                define BACKING_STORE_WRITE_SIZE 2 // from hal_efl_lld.c
 | 
					#                define BACKING_STORE_WRITE_SIZE 2 // from hal_efl_lld.c
 | 
				
			||||||
#            elif defined(QMK_MCU_SERIES_STM32F3XX)
 | 
					#            elif defined(QMK_MCU_SERIES_STM32F3XX)
 | 
				
			||||||
#                define BACKING_STORE_WRITE_SIZE 2 // from hal_efl_lld.c
 | 
					#                define BACKING_STORE_WRITE_SIZE 2 // from hal_efl_lld.c
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue