NVRAM refactor, phase 1. (#18969)

* Rename `eeprom_stm32` to `eeprom_legacy_emulated_flash`.

* Rename `flash_stm32` to `legacy_flash_ops`.

* Rename `eeprom_teensy` to `eeprom_kinetis_flexram`.
master
Nick Brassel 2022-11-23 19:50:19 +11:00 committed by GitHub
parent bfdc761819
commit bebfdad795
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 34 additions and 34 deletions

View File

@ -222,10 +222,10 @@ else
else ifeq ($(PLATFORM),CHIBIOS)
ifneq ($(filter %_STM32F072xB %_STM32F042x6, $(MCU_SERIES)_$(MCU_LDSCRIPT)),)
# STM32 Emulated EEPROM, backed by MCU flash (soon to be deprecated)
OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_STM32_FLASH_EMULATED
OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_LEGACY_EMULATED_FLASH
COMMON_VPATH += $(PLATFORM_PATH)/$(PLATFORM_KEY)/$(DRIVER_DIR)/flash
COMMON_VPATH += $(DRIVER_PATH)/flash
SRC += eeprom_driver.c eeprom_stm32.c flash_stm32.c
SRC += eeprom_driver.c eeprom_legacy_emulated_flash.c legacy_flash_ops.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
@ -242,8 +242,8 @@ else
WEAR_LEVELING_DRIVER = rp2040_flash
else ifneq ($(filter $(MCU_SERIES),KL2x K20x),)
# Teensy EEPROM implementations
OPT_DEFS += -DEEPROM_TEENSY
SRC += eeprom_teensy.c
OPT_DEFS += -DEEPROM_KINETIS_FLEXRAM
SRC += eeprom_kinetis_flexram.c
else
# Fall back to transient, i.e. non-persistent
OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_TRANSIENT
@ -287,7 +287,7 @@ ifneq ($(strip $(WEAR_LEVELING_DRIVER)),none)
POST_CONFIG_H += $(PLATFORM_PATH)/$(PLATFORM_KEY)/$(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
SRC += legacy_flash_ops.c wear_leveling_legacy.c
POST_CONFIG_H += $(PLATFORM_PATH)/$(PLATFORM_KEY)/$(DRIVER_DIR)/wear_leveling/wear_leveling_legacy_config.h
endif
endif

View File

@ -1,7 +1,7 @@
#include <ch.h>
#include <hal.h>
#include "eeprom_teensy.h"
#include "eeprom_kinetis_flexram.h"
#include "eeconfig.h"
/*************************************/

View File

@ -22,8 +22,8 @@
#include <stdbool.h>
#include "util.h"
#include "debug.h"
#include "eeprom_stm32.h"
#include "flash_stm32.h"
#include "eeprom_legacy_emulated_flash.h"
#include "legacy_flash_ops.h"
/*
* We emulate eeprom by writing a snapshot compacted view of eeprom contents,
@ -132,7 +132,7 @@
*
*/
#include "eeprom_stm32_defs.h"
#include "eeprom_legacy_emulated_flash_defs.h"
/* These bits are used for optimizing encoding of bytes, 0 and 1 */
#define FEE_WORD_ENCODING 0x8000
#define FEE_VALUE_NEXT 0x6000

View File

@ -17,7 +17,7 @@
*/
#include <hal.h>
#include "flash_stm32.h"
#include "legacy_flash_ops.h"
#if defined(STM32F1XX)
# define FLASH_SR_WRPERR FLASH_SR_WRPRTERR

View File

@ -24,7 +24,7 @@ extern "C" {
#include <stdint.h>
#ifdef FLASH_STM32_MOCKED
#ifdef LEGACY_FLASH_OPS_MOCKED
extern uint8_t FlashBuf[MOCK_FLASH_SIZE];
#endif

View File

@ -5,7 +5,7 @@
#include "timer.h"
#include "wear_leveling.h"
#include "wear_leveling_internal.h"
#include "flash_stm32.h"
#include "legacy_flash_ops.h"
bool backing_store_init(void) {
bs_dprintf("Init\n");

View File

@ -41,11 +41,11 @@ void eeprom_update_block(const void *__src, void *__dst, size_t __n);
#elif defined(EEPROM_STM32_L0_L1)
# include "eeprom_stm32_L0_L1.h"
# define TOTAL_EEPROM_BYTE_COUNT (STM32_ONBOARD_EEPROM_SIZE)
#elif defined(EEPROM_TEENSY)
# include "eeprom_teensy.h"
#elif defined(EEPROM_KINETIS_FLEXRAM)
# include "eeprom_kinetis_flexram.h"
# define TOTAL_EEPROM_BYTE_COUNT (EEPROM_SIZE)
#elif defined(EEPROM_STM32_FLASH_EMULATED)
# include "eeprom_stm32_defs.h"
#elif defined(EEPROM_LEGACY_EMULATED_FLASH)
# include "eeprom_legacy_emulated_flash_defs.h"
# define TOTAL_EEPROM_BYTE_COUNT (FEE_DENSITY_BYTES)
#elif defined(EEPROM_SAMD)
# include "eeprom_samd.h"
@ -59,12 +59,12 @@ void eeprom_update_block(const void *__src, void *__dst, size_t __n);
#elif defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1287__)
# define TOTAL_EEPROM_BYTE_COUNT 4096
#elif defined(EEPROM_TEST_HARNESS)
# ifndef FLASH_STM32_MOCKED
# ifndef LEGACY_FLASH_OPS_MOCKED
// Normal tests
# define TOTAL_EEPROM_BYTE_COUNT 32
# else
// Flash wear-leveling testing
# include "eeprom_stm32_tests.h"
# include "eeprom_legacy_emulated_flash_tests.h"
# define TOTAL_EEPROM_BYTE_COUNT (EEPROM_SIZE)
# endif
#else

View File

@ -2,7 +2,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include "flash_stm32.h"
#include "eeprom_stm32.h"
#include "legacy_flash_ops.h"
#include "eeprom_legacy_emulated_flash.h"
#define EEPROM_SIZE (FEE_PAGE_SIZE * FEE_PAGE_COUNT / 2)

View File

@ -16,7 +16,7 @@
#include <string.h>
#include <stdbool.h>
#include "flash_stm32.h"
#include "legacy_flash_ops.h"
uint8_t FlashBuf[MOCK_FLASH_SIZE] = {0};

View File

@ -1,25 +1,25 @@
eeprom_stm32_DEFS := -DEEPROM_TEST_HARNESS -DFLASH_STM32_MOCKED -DNO_PRINT -DFEE_FLASH_BASE=FlashBuf
eeprom_stm32_tiny_DEFS := $(eeprom_stm32_DEFS) \
eeprom_legacy_emulated_flash_DEFS := -DEEPROM_TEST_HARNESS -DLEGACY_FLASH_OPS_MOCKED -DNO_PRINT -DFEE_FLASH_BASE=FlashBuf
eeprom_legacy_emulated_flash_tiny_DEFS := $(eeprom_legacy_emulated_flash_DEFS) \
-DFEE_MCU_FLASH_SIZE=1 \
-DMOCK_FLASH_SIZE=1024 \
-DFEE_PAGE_SIZE=512 \
-DFEE_PAGE_COUNT=1
eeprom_stm32_large_DEFS := $(eeprom_stm32_DEFS) \
eeprom_legacy_emulated_flash_large_DEFS := $(eeprom_legacy_emulated_flash_DEFS) \
-DFEE_MCU_FLASH_SIZE=64 \
-DMOCK_FLASH_SIZE=65536 \
-DFEE_PAGE_SIZE=2048 \
-DFEE_PAGE_COUNT=16
eeprom_stm32_INC := \
eeprom_legacy_emulated_flash_INC := \
$(PLATFORM_PATH)/chibios/drivers/eeprom/ \
$(PLATFORM_PATH)/chibios/drivers/flash/
eeprom_stm32_tiny_INC := $(eeprom_stm32_INC)
eeprom_stm32_large_INC := $(eeprom_stm32_INC)
eeprom_legacy_emulated_flash_tiny_INC := $(eeprom_legacy_emulated_flash_INC)
eeprom_legacy_emulated_flash_large_INC := $(eeprom_legacy_emulated_flash_INC)
eeprom_stm32_SRC := \
eeprom_legacy_emulated_flash_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/drivers/eeprom/eeprom_stm32.c
eeprom_stm32_tiny_SRC := $(eeprom_stm32_SRC)
eeprom_stm32_large_SRC := $(eeprom_stm32_SRC)
$(PLATFORM_PATH)/$(PLATFORM_KEY)/eeprom_legacy_emulated_flash_tests.cpp \
$(PLATFORM_PATH)/$(PLATFORM_KEY)/legacy_flash_ops_mock.c \
$(PLATFORM_PATH)/chibios/drivers/eeprom/eeprom_legacy_emulated_flash.c
eeprom_legacy_emulated_flash_tiny_SRC := $(eeprom_legacy_emulated_flash_SRC)
eeprom_legacy_emulated_flash_large_SRC := $(eeprom_legacy_emulated_flash_SRC)

View File

@ -1 +1 @@
TEST_LIST += eeprom_stm32_tiny eeprom_stm32_large
TEST_LIST += eeprom_legacy_emulated_flash_tiny eeprom_legacy_emulated_flash_large