11#define FLASH_RETURN_SUCCESS HAL_SUCCESS
14#define FLASH_RETURN_NO_PERMISSION -1
17#define FLASH_RETURN_OPERROR -2
20#define FLASH_RETURN_WPERROR -3
23#define FLASH_RETURN_ALIGNERROR -4
26#define FLASH_RETURN_PPARALLERROR -5
29#define FLASH_RETURN_ESEQERROR -6
32#define FLASH_RETURN_PSEQERROR -7
35#define FLASH_RETURN_BAD_FLASH -11
50#if defined(STM32F4XX) || defined(STM32H7XX)
51#define FLASH_CR_PSIZE_MASK (FLASH_CR_PSIZE_0 | FLASH_CR_PSIZE_1)
52#if ((STM32_VDD >= 270) && (STM32_VDD <= 360))
53#define FLASH_CR_PSIZE_VALUE FLASH_CR_PSIZE_1
55#elif (STM32_VDD >= 240) && (STM32_VDD < 270)
56#define FLASH_CR_PSIZE_VALUE FLASH_CR_PSIZE_0
58#elif (STM32_VDD >= 210) && (STM32_VDD < 240)
59#define FLASH_CR_PSIZE_VALUE FLASH_CR_PSIZE_0
61#elif (STM32_VDD >= 180) && (STM32_VDD < 210)
62#define FLASH_CR_PSIZE_VALUE ((uint32_t)0x00000000)
65#error "invalid VDD voltage specified"
70#define FLASH_CR_PSIZE_MASK (FLASH_CR_PSIZE_0 | FLASH_CR_PSIZE_1)
71#if ((STM32_VDD >= 270) && (STM32_VDD <= 300))
72#define FLASH_CR_PSIZE_VALUE FLASH_CR_PSIZE_1
74#elif (STM32_VDD >= 210) && (STM32_VDD < 360)
75#define FLASH_CR_PSIZE_VALUE FLASH_CR_PSIZE_0
77#elif (STM32_VDD >= 170) && (STM32_VDD < 360)
78#define FLASH_CR_PSIZE_VALUE ((uint32_t)0x00000000)
81#error "invalid VDD voltage specified"
int intFlashErase(flashaddr_t address, size_t size)
Erase the sectors containing the span of size bytes starting at address.
uintptr_t flashaddr_t
Address in the flash memory.
int intFlashWrite(flashaddr_t address, const char *buffer, size_t size)
Copy data from a buffer to the flash memory.
uintptr_t getFlashAddrFirstCopy(void)
bool intFlashIsErased(flashaddr_t address, size_t size)
Check if the size bytes of flash memory starting at address are erased.
int intFlashRead(flashaddr_t source, char *destination, size_t size)
Copy data from the flash memory to a destination.
uintptr_t getFlashAddrSecondCopy(void)
bool intFlashCompare(flashaddr_t address, const char *buffer, size_t size)
Check if the data in buffer are identical to the one in flash memory.
size_t flashSectorSize(flashsector_t sector)
Get the size of sector.
uint8_t flashsector_t
Index of a sector.
static BigBufferHandle buffer