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
37#define FLASH_RETURN_SECURITYERROR -12
39#define FLASH_RETURN_CRCERROR -13
54#if defined(STM32F4XX) || defined(STM32H7XX)
55#define FLASH_CR_PSIZE_MASK (FLASH_CR_PSIZE_0 | FLASH_CR_PSIZE_1)
56#if ((STM32_VDD >= 270) && (STM32_VDD <= 360))
57#define FLASH_CR_PSIZE_VALUE FLASH_CR_PSIZE_1
59#elif (STM32_VDD >= 240) && (STM32_VDD < 270)
60#define FLASH_CR_PSIZE_VALUE FLASH_CR_PSIZE_0
62#elif (STM32_VDD >= 210) && (STM32_VDD < 240)
63#define FLASH_CR_PSIZE_VALUE FLASH_CR_PSIZE_0
65#elif (STM32_VDD >= 180) && (STM32_VDD < 210)
66#define FLASH_CR_PSIZE_VALUE ((uint32_t)0x00000000)
69#error "invalid VDD voltage specified"
74#define FLASH_CR_PSIZE_MASK (FLASH_CR_PSIZE_0 | FLASH_CR_PSIZE_1)
75#if ((STM32_VDD >= 270) && (STM32_VDD <= 300))
76#define FLASH_CR_PSIZE_VALUE FLASH_CR_PSIZE_1
78#elif (STM32_VDD >= 210) && (STM32_VDD < 360)
79#define FLASH_CR_PSIZE_VALUE FLASH_CR_PSIZE_0
81#elif (STM32_VDD >= 170) && (STM32_VDD < 360)
82#define FLASH_CR_PSIZE_VALUE ((uint32_t)0x00000000)
85#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