diff --git a/flight/targets/brain/fw/Makefile b/flight/targets/brain/fw/Makefile index ac56a8eac5d..98ed632dbb0 100644 --- a/flight/targets/brain/fw/Makefile +++ b/flight/targets/brain/fw/Makefile @@ -30,6 +30,7 @@ include $(BOARD_INFO_DIR)/board-info.mk # Set developer code and compile options # Set to YES for debugging DEBUG ?= NO +ERASE_FLASH ?= NO # List of modules to include MODULES = Sensors @@ -114,6 +115,10 @@ SRC += $(DEBUG_CM3_DIR)/dcc_stdio.c SRC += $(DEBUG_CM3_DIR)/cm3_fault_handlers.c endif +ifeq ($(ERASE_FLASH), YES) +CDEFS += -DERASE_FLASH +endif + SRC += $(FLIGHTLIB)/paths.c SRC += $(FLIGHTLIB)/fifo_buffer.c SRC += $(FLIGHTLIB)/WorldMagModel.c diff --git a/flight/targets/brain/fw/pios_board.c b/flight/targets/brain/fw/pios_board.c index b4313a6b2df..7f4b69ac939 100644 --- a/flight/targets/brain/fw/pios_board.c +++ b/flight/targets/brain/fw/pios_board.c @@ -418,7 +418,11 @@ void PIOS_Board_Init(void) { if (PIOS_FLASHFS_Logfs_Init(&pios_uavo_settings_fs_id, &flashfs_settings_cfg, FLASH_PARTITION_LABEL_SETTINGS) != 0) panic(1); if (PIOS_FLASHFS_Logfs_Init(&pios_waypoints_settings_fs_id, &flashfs_waypoints_cfg, FLASH_PARTITION_LABEL_WAYPOINTS) != 0) - panic(1);; + panic(1); + +#if defined(ERASE_FLASH) + PIOS_FLASHFS_Format(pios_uavo_settings_fs_id); +#endif #endif /* PIOS_INCLUDE_FLASH */ RCC_ClearFlag(); // The flags cleared after use