diff --git a/libraries/AP_HAL_ChibiOS/hwdef/F4BY/hwdef.dat b/libraries/AP_HAL_ChibiOS/hwdef/F4BY/hwdef.dat index 9510b1f9fc..eab03baeb9 100755 --- a/libraries/AP_HAL_ChibiOS/hwdef/F4BY/hwdef.dat +++ b/libraries/AP_HAL_ChibiOS/hwdef/F4BY/hwdef.dat @@ -75,7 +75,6 @@ PC12 UART5_TX UART5 NODMA PD2 UART5_RX UART5 NODMA define HAL_STORAGE_SIZE 16384 -define STORAGE_FLASH_PAGE 22 #SPI1 for MPU PA5 SPI1_SCK SPI1 diff --git a/libraries/AP_HAL_ChibiOS/hwdef/Pixhawk1-1M/hwdef.dat b/libraries/AP_HAL_ChibiOS/hwdef/Pixhawk1-1M/hwdef.dat index 4b40312f58..91534d170f 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/Pixhawk1-1M/hwdef.dat +++ b/libraries/AP_HAL_ChibiOS/hwdef/Pixhawk1-1M/hwdef.dat @@ -5,3 +5,4 @@ include ../Pixhawk1/hwdef.dat FLASH_SIZE_KB 1024 define HAL_MINIMIZE_FEATURES 1 +undef STORAGE_FLASH_PAGE diff --git a/libraries/AP_HAL_ChibiOS/hwdef/VRBrain-v51/hwdef.dat b/libraries/AP_HAL_ChibiOS/hwdef/VRBrain-v51/hwdef.dat index e6e323b9cc..3200312058 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/VRBrain-v51/hwdef.dat +++ b/libraries/AP_HAL_ChibiOS/hwdef/VRBrain-v51/hwdef.dat @@ -136,7 +136,6 @@ define HAL_BOARD_LOG_DIRECTORY "/APM/LOGS" define HAL_BOARD_TERRAIN_DIRECTORY "/APM/TERRAIN" define HAL_STORAGE_SIZE 16384 -define STORAGE_FLASH_PAGE 22 # enable RAMTROM parameter storage define HAL_WITH_RAMTRON 1 diff --git a/libraries/AP_HAL_ChibiOS/hwdef/VRBrain-v52/hwdef.dat b/libraries/AP_HAL_ChibiOS/hwdef/VRBrain-v52/hwdef.dat index e1ca735d17..be8bfe06d3 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/VRBrain-v52/hwdef.dat +++ b/libraries/AP_HAL_ChibiOS/hwdef/VRBrain-v52/hwdef.dat @@ -136,7 +136,6 @@ define HAL_BOARD_LOG_DIRECTORY "/APM/LOGS" define HAL_BOARD_TERRAIN_DIRECTORY "/APM/TERRAIN" define HAL_STORAGE_SIZE 16384 -define STORAGE_FLASH_PAGE 22 # enable RAMTROM parameter storage define HAL_WITH_RAMTRON 1 diff --git a/libraries/AP_HAL_ChibiOS/hwdef/VRCore-v10/hwdef.dat b/libraries/AP_HAL_ChibiOS/hwdef/VRCore-v10/hwdef.dat index 5853892dc3..31b1d33f9a 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/VRCore-v10/hwdef.dat +++ b/libraries/AP_HAL_ChibiOS/hwdef/VRCore-v10/hwdef.dat @@ -136,7 +136,6 @@ define HAL_BOARD_LOG_DIRECTORY "/APM/LOGS" define HAL_BOARD_TERRAIN_DIRECTORY "/APM/TERRAIN" define HAL_STORAGE_SIZE 16384 -define STORAGE_FLASH_PAGE 22 # enable RAMTROM parameter storage define HAL_WITH_RAMTRON 1 diff --git a/libraries/AP_HAL_ChibiOS/hwdef/common/flash.c b/libraries/AP_HAL_ChibiOS/hwdef/common/flash.c index 4c5e4d4915..50806ae3bb 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/common/flash.c +++ b/libraries/AP_HAL_ChibiOS/hwdef/common/flash.c @@ -53,6 +53,8 @@ #include #include "stm32_util.h" +#include + // #pragma GCC optimize("O0") /* @@ -125,6 +127,11 @@ static const uint32_t flash_memmap[STM32_FLASH_NPAGES] = { KB(32), KB(32), KB(32 #error "Unsupported processor for flash.c" #endif +#ifdef STORAGE_FLASH_PAGE +static_assert(STORAGE_FLASH_PAGE < STM32_FLASH_NPAGES, + "STORAGE_FLASH_PAGE out of range"); +#endif + // keep a cache of the page addresses #ifndef STM32_FLASH_FIXED_PAGE_SIZE static uint32_t flash_pageaddr[STM32_FLASH_NPAGES]; diff --git a/libraries/AP_HAL_ChibiOS/hwdef/fmuv2/hwdef.dat b/libraries/AP_HAL_ChibiOS/hwdef/fmuv2/hwdef.dat index e67593b4c1..f07eddc94e 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/fmuv2/hwdef.dat +++ b/libraries/AP_HAL_ChibiOS/hwdef/fmuv2/hwdef.dat @@ -10,3 +10,6 @@ FLASH_SIZE_KB 1024 # 1M, but it prepares us for when large features such as scripting are # added to the build define HAL_MINIMIZE_FEATURES 1 + +# we don't have a flash page spare to write parameters to: +undef STORAGE_FLASH_PAGE diff --git a/libraries/AP_HAL_ChibiOS/hwdef/mini-pix/hwdef.dat b/libraries/AP_HAL_ChibiOS/hwdef/mini-pix/hwdef.dat index 2b0832c272..1f7b82119f 100644 --- a/libraries/AP_HAL_ChibiOS/hwdef/mini-pix/hwdef.dat +++ b/libraries/AP_HAL_ChibiOS/hwdef/mini-pix/hwdef.dat @@ -141,9 +141,6 @@ define HAL_STORAGE_SIZE 16384 # enable RAMTROM parameter storage define HAL_WITH_RAMTRON 1 -# fallback to flash is no FRAM fitted -define STORAGE_FLASH_PAGE 22 - # enable FAT filesystem define HAL_OS_FATFS_IO 1