AP_HAL_ChibiOS: avoid referencing flash sector/page 22 on 1MB boards

This commit is contained in:
Peter Barker 2020-02-29 14:31:20 +11:00 committed by Andrew Tridgell
parent c917cd4dbb
commit 1a123e5f8d
8 changed files with 11 additions and 7 deletions

View File

@ -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

View File

@ -5,3 +5,4 @@ include ../Pixhawk1/hwdef.dat
FLASH_SIZE_KB 1024
define HAL_MINIMIZE_FEATURES 1
undef STORAGE_FLASH_PAGE

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -53,6 +53,8 @@
#include <string.h>
#include "stm32_util.h"
#include <assert.h>
// #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];

View File

@ -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

View File

@ -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