1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-19 14:25:20 +03:00

Allow spcification of flash size on command line.

This commit is contained in:
Dominic Clifton 2015-03-25 21:00:58 +00:00
parent 5d5e74ee70
commit ef50a0648f
3 changed files with 60 additions and 28 deletions

View file

@ -88,24 +88,44 @@ void useRcControlsConfig(modeActivationCondition_t *modeActivationConditions, es
#define FLASH_TO_RESERVE_FOR_CONFIG 0x800
#ifndef FLASH_PAGE_COUNT
#ifdef STM32F303xC
#define FLASH_PAGE_COUNT 128
#define FLASH_PAGE_SIZE ((uint16_t)0x800)
#if !defined(FLASH_SIZE)
#error "Flash size not defined for target. (specify in KB)"
#endif
#ifdef STM32F10X_MD
#define FLASH_PAGE_COUNT 128
#define FLASH_PAGE_SIZE ((uint16_t)0x400)
#ifndef FLASH_PAGE_SIZE
#ifdef STM32F303xC
#define FLASH_PAGE_SIZE ((uint16_t)0x800)
#endif
#ifdef STM32F10X_MD
#define FLASH_PAGE_SIZE ((uint16_t)0x400)
#endif
#ifdef STM32F10X_HD
#define FLASH_PAGE_SIZE ((uint16_t)0x800)
#endif
#endif
#ifdef STM32F10X_HD
#define FLASH_PAGE_COUNT 128
#define FLASH_PAGE_SIZE ((uint16_t)0x800)
#endif
#if !defined(FLASH_SIZE) && !defined(FLASH_PAGE_COUNT)
#ifdef STM32F10X_MD
#define FLASH_PAGE_COUNT 128
#endif
#ifdef STM32F10X_HD
#define FLASH_PAGE_COUNT 128
#endif
#endif
#if !defined(FLASH_PAGE_COUNT) || !defined(FLASH_PAGE_SIZE)
#if defined(FLASH_SIZE)
#define FLASH_PAGE_COUNT ((FLASH_SIZE * 0x400) / FLASH_PAGE_SIZE)
#endif
#if !defined(FLASH_PAGE_SIZE)
#error "Flash page size not defined for target."
#endif
#if !defined(FLASH_PAGE_COUNT)
#error "Flash page count not defined for target."
#endif

View file

@ -20,9 +20,6 @@
#define TARGET_BOARD_IDENTIFIER "CJM1" // CJMCU
#define USE_HARDWARE_REVISION_DETECTION
#define FLASH_PAGE_COUNT 64
#define FLASH_PAGE_SIZE ((uint16_t)0x400)
#define LED0_GPIO GPIOC
#define LED0_PIN Pin_14 // PC14 (LED)
#define LED0
@ -61,7 +58,6 @@
// #define SOFT_I2C_PB67
#define SERIAL_RX
//#define BLACKBOX
//#define USE_SERVOS
#define SPEKTRUM_BIND
@ -71,3 +67,7 @@
// Since the CJMCU PCB has holes for 4 motors in each corner we can save same flash space by disabling support for other mixers.
#define USE_QUAD_MIXER_ONLY
#if (FLASH_SIZE > 64)
#define BLACKBOX
#endif