1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-15 20:35:33 +03:00

Move FLASH_PAGE_SIZE definition to CPU specific target.h files (#12394)

* Never block use of SWD pins

* Split the AT-START-F435 and REVO-AT configs out from AT32F435/target.h

* Move FLASH_PAGE_SIZE definition to CPU specific target.h files

---------

Co-authored-by: J Blackman <blckmn@users.noreply.github.com>
This commit is contained in:
Steve Evans 2023-02-21 15:06:40 +00:00 committed by GitHub
parent c1c1f95578
commit 0736da8aa3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 30 additions and 42 deletions

View file

@ -36,49 +36,8 @@ uint8_t eepromData[EEPROM_SIZE];
#endif #endif
#if (defined(STM32H750xx) || defined(STM32H730xx)) && !(defined(CONFIG_IN_EXTERNAL_FLASH) || defined(CONFIG_IN_MEMORY_MAPPED_FLASH) || defined(CONFIG_IN_RAM) || defined(CONFIG_IN_SDCARD))
#error "The configured MCU only has one flash page which contains the bootloader, no spare flash pages available, use external storage for persistent config or ram for target testing"
#endif
// @todo this is not strictly correct for F4/F7, where sector sizes are variable
#if !defined(FLASH_PAGE_SIZE) #if !defined(FLASH_PAGE_SIZE)
// F4 #error "Flash page size not defined for target."
#if defined(STM32F40_41xxx)
# define FLASH_PAGE_SIZE ((uint32_t)0x4000) // 16K sectors
# elif defined(STM32F411xE)
# define FLASH_PAGE_SIZE ((uint32_t)0x4000)
# elif defined(STM32F427_437xx)
# define FLASH_PAGE_SIZE ((uint32_t)0x4000)
# elif defined(STM32F446xx)
# define FLASH_PAGE_SIZE ((uint32_t)0x4000)
# elif defined(AT32F435ZMT7) || defined(AT32F435RMT7)
# define FLASH_PAGE_SIZE ((uint32_t)0x1000) // 4K sectors
# elif defined(AT32F435RGT7)
# define FLASH_PAGE_SIZE ((uint32_t)0x0800) // 2K sectors
// F7
#elif defined(STM32F722xx)
# define FLASH_PAGE_SIZE ((uint32_t)0x4000) // 16K sectors
# elif defined(STM32F745xx)
# define FLASH_PAGE_SIZE ((uint32_t)0x8000) // 32K sectors
# elif defined(STM32F746xx)
# define FLASH_PAGE_SIZE ((uint32_t)0x8000)
# elif defined(STM32F765xx)
# define FLASH_PAGE_SIZE ((uint32_t)0x8000)
# elif defined(UNIT_TEST)
# define FLASH_PAGE_SIZE (0x400)
// H7
# elif defined(STM32H743xx) || defined(STM32H750xx) || defined(STM32H723xx) || defined(STM32H725xx) || defined(STM32H730xx)
# define FLASH_PAGE_SIZE ((uint32_t)0x20000) // 128K sectors
# elif defined(STM32H7A3xx) || defined(STM32H7A3xxQ)
# define FLASH_PAGE_SIZE ((uint32_t)0x2000) // 8K sectors
// G4
# elif defined(STM32G4)
# define FLASH_PAGE_SIZE ((uint32_t)0x800) // 2K page
// SIMULATOR
# elif defined(SIMULATOR_BUILD)
# define FLASH_PAGE_SIZE (0x400)
# else
# error "Flash page size not defined for target."
# endif
#endif #endif
void config_streamer_init(config_streamer_t *c) void config_streamer_init(config_streamer_t *c)

View file

@ -87,3 +87,5 @@
#undef USE_FLASH #undef USE_FLASH
#undef USE_FLASHFS #undef USE_FLASHFS
#undef USE_FLASH_CHIP #undef USE_FLASH_CHIP
#define FLASH_PAGE_SIZE ((uint32_t)0x1000) // 4K sectors

View file

@ -155,6 +155,8 @@
#define DEFIO_NO_PORTS // suppress 'no pins defined' warning #define DEFIO_NO_PORTS // suppress 'no pins defined' warning
#define FLASH_PAGE_SIZE (0x400)
// belows are internal stuff // belows are internal stuff
extern uint32_t SystemCoreClock; extern uint32_t SystemCoreClock;

View file

@ -80,3 +80,5 @@
#define USE_CUSTOM_DEFAULTS #define USE_CUSTOM_DEFAULTS
#define USE_EXTI #define USE_EXTI
#define FLASH_PAGE_SIZE ((uint32_t)0x4000) // 16K sectors

View file

@ -77,3 +77,5 @@
#define USE_CUSTOM_DEFAULTS #define USE_CUSTOM_DEFAULTS
#define USE_EXTI #define USE_EXTI
#define FLASH_PAGE_SIZE ((uint32_t)0x4000) // 16K sectors

View file

@ -87,3 +87,5 @@
#define USE_CUSTOM_DEFAULTS #define USE_CUSTOM_DEFAULTS
#define USE_EXTI #define USE_EXTI
#define FLASH_PAGE_SIZE ((uint32_t)0x8000) // 32K sectors

View file

@ -79,3 +79,5 @@
#define USE_CUSTOM_DEFAULTS #define USE_CUSTOM_DEFAULTS
#define USE_EXTI #define USE_EXTI
#define FLASH_PAGE_SIZE ((uint32_t)0x4000) // 16K sectors

View file

@ -79,3 +79,4 @@
#define USE_CUSTOM_DEFAULTS #define USE_CUSTOM_DEFAULTS
#define USE_EXTI #define USE_EXTI
#define USE_TIMER_UP_CONFIG #define USE_TIMER_UP_CONFIG

View file

@ -102,3 +102,5 @@
#define USE_EXTI #define USE_EXTI
#define USE_TIMER_UP_CONFIG #define USE_TIMER_UP_CONFIG
#define FLASH_PAGE_SIZE ((uint32_t)0x20000) // 128K sectors

View file

@ -114,3 +114,9 @@
#define USE_EXTI #define USE_EXTI
#define USE_TIMER_UP_CONFIG #define USE_TIMER_UP_CONFIG
#if !(defined(CONFIG_IN_EXTERNAL_FLASH) || defined(CONFIG_IN_MEMORY_MAPPED_FLASH) || defined(CONFIG_IN_RAM) || defined(CONFIG_IN_SDCARD))
#error "The configured MCU only has one flash page which contains the bootloader, no spare flash pages available, use external storage for persistent config or ram for target testing"
#endif
#define FLASH_PAGE_SIZE ((uint32_t)0x20000) // 128K sectors

View file

@ -88,3 +88,5 @@
#define USE_CUSTOM_DEFAULTS #define USE_CUSTOM_DEFAULTS
#define USE_EXTI #define USE_EXTI
#define USE_TIMER_UP_CONFIG #define USE_TIMER_UP_CONFIG
#define FLASH_PAGE_SIZE ((uint32_t)0x20000) // 128K sectors

View file

@ -109,3 +109,9 @@
#define USE_EXTI #define USE_EXTI
#define USE_TIMER_UP_CONFIG #define USE_TIMER_UP_CONFIG
#if !(defined(CONFIG_IN_EXTERNAL_FLASH) || defined(CONFIG_IN_MEMORY_MAPPED_FLASH) || defined(CONFIG_IN_RAM) || defined(CONFIG_IN_SDCARD))
#error "The configured MCU only has one flash page which contains the bootloader, no spare flash pages available, use external storage for persistent config or ram for target testing"
#endif
#define FLASH_PAGE_SIZE ((uint32_t)0x20000) // 128K sectors