Skip to content

Commit

Permalink
Brain: enable compiling firmware to erase flash
Browse files Browse the repository at this point in the history
  • Loading branch information
BrainFPV committed Feb 13, 2015
1 parent 7dca061 commit 66d34c5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions flight/targets/brain/fw/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion flight/targets/brain/fw/pios_board.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 66d34c5

Please sign in to comment.