diff --git a/firmware/config/boards/at_start_f435/board.mk b/firmware/config/boards/at_start_f435/board.mk index 7c29a54071..338452bc3a 100644 --- a/firmware/config/boards/at_start_f435/board.mk +++ b/firmware/config/boards/at_start_f435/board.mk @@ -22,7 +22,7 @@ CONFDIR = $(PROJECT_DIR)/hw_layer/ports/at32/at32f4/cfg # This board uses ChibiOS MFS driver on internal flash DDEFS += -DHAL_USE_EFL=TRUE -include $(PROJECT_DIR)/hw_layer/ports/stm32/calibrations_on_flash.mk +include $(PROJECT_DIR)/hw_layer/ports/stm32/use_higher_level_flash_api.mk # This board has chip with dual-bank flash, bank 2 can be flashed in background DDEFS += -DEFI_FLASH_WRITE_THREAD=TRUE diff --git a/firmware/config/boards/m74_9/board.mk b/firmware/config/boards/m74_9/board.mk index f5fa3cb631..a483c77380 100644 --- a/firmware/config/boards/m74_9/board.mk +++ b/firmware/config/boards/m74_9/board.mk @@ -26,7 +26,7 @@ CONFDIR = $(PROJECT_DIR)/hw_layer/ports/at32/at32f4/cfg # This board uses ChibiOS MFS driver on internal flash DDEFS += -DHAL_USE_EFL=TRUE -include $(PROJECT_DIR)/hw_layer/ports/stm32/calibrations_on_flash.mk +include $(PROJECT_DIR)/hw_layer/ports/stm32/use_higher_level_flash_api.mk # This board has chip with dual-bank flash, bank 2 can be flashed in background DDEFS += -DEFI_FLASH_WRITE_THREAD=TRUE diff --git a/firmware/config/boards/subaru_eg33/board.mk b/firmware/config/boards/subaru_eg33/board.mk index 59b870c667..ccb75f633b 100644 --- a/firmware/config/boards/subaru_eg33/board.mk +++ b/firmware/config/boards/subaru_eg33/board.mk @@ -34,7 +34,7 @@ DDEFS += -DSNOR_SHARED_BUS=FALSE DDEFS += -DWSPI_USE_MUTUAL_EXCLUSION=FALSE # This board uses ChibiOS MFS driver on internal flash -include $(PROJECT_DIR)/hw_layer/ports/stm32/calibrations_on_flash.mk +include $(PROJECT_DIR)/hw_layer/ports/stm32/use_higher_level_flash_api.mk #Serial flash driver include $(PROJECT_DIR)/hw_layer/drivers/flash/sst26f_jedec.mk diff --git a/firmware/config/stm32f4ems/efifeatures.h b/firmware/config/stm32f4ems/efifeatures.h index c8488e67e6..7da4ea909b 100644 --- a/firmware/config/stm32f4ems/efifeatures.h +++ b/firmware/config/stm32f4ems/efifeatures.h @@ -174,10 +174,13 @@ #define TRIGGER_EXTREME_LOGGING FALSE #ifndef EFI_STORAGE_INT_FLASH +// historically we've started with low-level flash access with our own redundancy logic +// todo: migrate to EFI_STORAGE_MFS which provides same functionality and more! #define EFI_STORAGE_INT_FLASH TRUE #endif #ifndef EFI_STORAGE_MFS +// todo: this higher level API should replace EFI_STORAGE_INT_FLASH legacy implementation #define EFI_STORAGE_MFS FALSE #endif diff --git a/firmware/hw_layer/ports/stm32/calibrations_on_flash.mk b/firmware/hw_layer/ports/stm32/calibrations_on_flash.mk deleted file mode 100644 index 0a9d840e98..0000000000 --- a/firmware/hw_layer/ports/stm32/calibrations_on_flash.mk +++ /dev/null @@ -1,3 +0,0 @@ -# see also 'HAL_USE_EFL' in case of internal flash - -DDEFS += -DEFI_STORAGE_INT_FLASH=FALSE -DEFI_STORAGE_MFS=TRUE diff --git a/firmware/hw_layer/ports/stm32/use_higher_level_flash_api.mk b/firmware/hw_layer/ports/stm32/use_higher_level_flash_api.mk new file mode 100644 index 0000000000..08cb1413e6 --- /dev/null +++ b/firmware/hw_layer/ports/stm32/use_higher_level_flash_api.mk @@ -0,0 +1,7 @@ +# this header is relevant both for modern driver to access internal flash, and for external flash persistence +# see also 'HAL_USE_EFL' in case of internal flash + +# do not use legacy implementation to persist calibrations +DDEFS += -DEFI_STORAGE_INT_FLASH=FALSE +# use higher level API instead +DDEFS += -DEFI_STORAGE_MFS=TRUE