Go to the documentation of this file.
89 #include "stm32h7xx_hal.h"
100 #ifdef HAL_FLASH_MODULE_ENABLED
107 #define FLASH_TIMEOUT_VALUE 50000U
153 __IO uint32_t *dest_addr = (
__IO uint32_t *)FlashAddress;
154 __IO uint32_t *src_addr = (
__IO uint32_t*)DataAddress;
165 #if defined (FLASH_OPTCR_PG_OTP)
173 #if defined (DUAL_BANK)
174 else if(IS_FLASH_PROGRAM_ADDRESS_BANK2(FlashAddress))
192 #if defined (DUAL_BANK)
195 #if defined (FLASH_OPTCR_PG_OTP)
196 if (TypeProgram == FLASH_TYPEPROGRAM_OTPWORD)
214 #if defined (FLASH_OPTCR_PG_OTP)
215 if (TypeProgram == FLASH_TYPEPROGRAM_OTPWORD)
231 #if defined (FLASH_OPTCR_PG_OTP)
232 if (TypeProgram == FLASH_TYPEPROGRAM_OTPWORD)
235 *(
__IO uint16_t *)FlashAddress = *(
__IO uint16_t*)DataAddress;
243 *dest_addr = *src_addr;
247 }
while (row_index != 0U);
256 #if defined (DUAL_BANK)
257 #if defined (FLASH_OPTCR_PG_OTP)
258 if (TypeProgram == FLASH_TYPEPROGRAM_OTPWORD)
278 #if defined (FLASH_OPTCR_PG_OTP)
279 if (TypeProgram == FLASH_TYPEPROGRAM_OTPWORD)
316 __IO uint32_t *dest_addr = (
__IO uint32_t*)FlashAddress;
317 __IO uint32_t *src_addr = (
__IO uint32_t*)DataAddress;
331 #if defined (FLASH_OPTCR_PG_OTP)
339 #if defined (DUAL_BANK)
340 else if(IS_FLASH_PROGRAM_ADDRESS_BANK2(FlashAddress))
362 #if defined (DUAL_BANK)
368 #if defined (FLASH_OPTCR_PG_OTP)
369 if (TypeProgram == FLASH_TYPEPROGRAM_OTPWORD)
382 #if defined (FLASH_CR_OPERRIE)
399 #if defined (FLASH_CR_OPERRIE)
411 #if defined (FLASH_OPTCR_PG_OTP)
412 if (TypeProgram == FLASH_TYPEPROGRAM_OTPWORD)
425 #if defined (FLASH_CR_OPERRIE)
437 #if defined (FLASH_OPTCR_PG_OTP)
438 if (TypeProgram == FLASH_TYPEPROGRAM_OTPWORD)
441 *(
__IO uint16_t *)FlashAddress = *(
__IO uint16_t*)DataAddress;
449 *dest_addr = *src_addr;
453 }
while (row_index != 0U);
541 #if defined (DUAL_BANK)
612 #if defined (FLASH_SR_OPERR)
614 FLASH_FLAG_INCERR_BANK1 | FLASH_FLAG_OPERR_BANK1);
617 FLASH_FLAG_INCERR_BANK1);
654 #if defined (DUAL_BANK)
656 #if defined (FLASH_SR_OPERR)
658 FLASH_FLAG_INCERR_BANK2 | FLASH_FLAG_OPERR_BANK2) & 0x7FFFFFFFU);
661 FLASH_FLAG_INCERR_BANK2) & 0x7FFFFFFFU);
701 #if defined (FLASH_CR_OPERRIE)
706 #if defined (DUAL_BANK)
716 #if defined (DUAL_BANK)
803 #if defined (DUAL_BANK)
836 #if defined (DUAL_BANK)
903 #if defined (DUAL_BANK)
1009 #if defined (DUAL_BANK)
1011 if (Bank == FLASH_BANK_2)
1024 if(((
HAL_GetTick() - tickstart) > Timeout) || (Timeout == 0U))
1032 if((errorflag & 0x7FFFFFFFU) != 0U)
1052 #if defined (DUAL_BANK)
1081 if(((
HAL_GetTick() - tickstart) > Timeout) || (Timeout == 0U))
1132 if(((
HAL_GetTick() - tickstart) > Timeout) || (Timeout == 0U))
1153 #if defined (DUAL_BANK)
#define assert_param(expr)
Include module's header file.
#define FLASH_FLAG_EOP_BANK2
HAL_StatusTypeDef HAL_FLASH_Lock(void)
#define FLASH_IT_EOP_BANK1
HAL_StatusTypeDef HAL_FLASH_Program(uint32_t TypeProgram, uint32_t Address, uint64_t Data)
#define FLASH_FLAG_WRPERR_BANK2
HAL_StatusTypeDef
HAL Status structures definition
HAL_StatusTypeDef HAL_FLASH_OB_Unlock(void)
HAL_StatusTypeDef HAL_FLASH_OB_Launch(void)
#define FLASH_IT_PGSERR_BANK1
#define FLASH_FLAG_PGSERR_BANK2
@ FLASH_PROC_PROGRAM_BANK1
__STATIC_FORCEINLINE void __DSB(void)
Data Synchronization Barrier.
void FLASH_Erase_Sector(uint32_t Sector, uint8_t VoltageRange)
__STATIC_FORCEINLINE void __ISB(void)
Instruction Synchronization Barrier.
void HAL_FLASH_IRQHandler(void)
#define FLASH_OPTSR_OPT_BUSY
#define FLASH_FLAG_QW_BANK2
#define FLASH_FLAG_ALL_ERRORS_BANK1
@ FLASH_PROC_MASSERASE_BANK1
@ FLASH_PROC_SECTERASE_BANK2
#define FLASH_IT_WRPERR_BANK1
#define CLEAR_BIT(REG, BIT)
uint32_t HAL_GetTick(void)
Provides a tick value in millisecond.
__IO uint8_t VoltageForErase
#define HAL_FLASH_ERROR_CRCRD_BANK2
uint32_t HAL_FLASH_GetError(void)
#define FLASH_FLAG_STRBERR_BANK2
#define __HAL_FLASH_CLEAR_FLAG_BANK2(__FLAG__)
#define FLASH_OPTCR_OPTSTART
#define __HAL_FLASH_CLEAR_FLAG(__FLAG__)
Clear the specified FLASH flags.
FLASH_ProcessTypeDef pFlash
#define IS_FLASH_BANK_EXCLUSIVE(BANK)
#define IS_FLASH_TYPEPROGRAM(VALUE)
__IO FLASH_ProcedureTypeDef ProcedureOnGoing
#define FLASH_FLAG_CRC_BUSY_BANK1
FLASH_ProcedureTypeDef
FLASH Procedure structure definition.
#define FLASH_FLAG_ALL_ERRORS_BANK2
#define FLASH_FLAG_CRCRDERR_BANK2
#define __HAL_FLASH_GET_FLAG_BANK1(__FLAG__)
Checks whether the specified FLASH flag is set or not.
#define __HAL_FLASH_DISABLE_IT_BANK1(__INTERRUPT__)
Disable the specified FLASH interrupt.
void HAL_FLASH_OperationErrorCallback(uint32_t ReturnValue)
#define __HAL_LOCK(__HANDLE__)
#define FLASH_OPTCR_OPTLOCK
@ FLASH_PROC_SECTERASE_BANK1
#define FLASH_OPTSR_OPTCHANGEERR
#define FLASH_FLAG_CRC_BUSY_BANK2
#define __HAL_FLASH_CLEAR_FLAG_BANK1(__FLAG__)
Clear the specified FLASH flag.
@ FLASH_PROC_MASSERASE_BANK2
#define FLASH_IT_INCERR_BANK1
#define __HAL_UNLOCK(__HANDLE__)
#define READ_BIT(REG, BIT)
#define FLASH_FLAG_CRCRDERR_BANK1
HAL_StatusTypeDef FLASH_WaitForLastOperation(uint32_t Timeout)
#define __HAL_FLASH_ENABLE_IT_BANK1(__INTERRUPT__)
Enable the specified FLASH interrupt.
HAL_StatusTypeDef FLASH_CRC_WaitForLastOperation(uint32_t Timeout, uint32_t Bank)
#define __HAL_FLASH_GET_FLAG(__FLAG__)
Get the specified FLASH flag status.
#define FLASH_IT_INCERR_BANK2
#define FLASH_OPTCCR_CLR_OPTCHANGEERR
#define FLASH_IT_STRBERR_BANK2
#define FLASH_FLAG_QW_BANK1
FLASH handle Structure definition
@ FLASH_PROC_PROGRAM_BANK2
#define __HAL_FLASH_ENABLE_IT_BANK2(__INTERRUPT__)
#define IS_FLASH_PROGRAM_ADDRESS(ADDRESS)
#define FLASH_FLAG_EOP_BANK1
#define __HAL_FLASH_DISABLE_IT_BANK2(__INTERRUPT__)
void HAL_FLASH_EndOfOperationCallback(uint32_t ReturnValue)
#define HAL_FLASH_ERROR_NONE
#define FLASH_IT_WRPERR_BANK2
#define FLASH_FLAG_WRPERR_BANK1
#define FLASH_IT_STRBERR_BANK1
#define WRITE_REG(REG, VAL)
HAL_StatusTypeDef HAL_FLASH_OB_Lock(void)
#define SET_BIT(REG, BIT)
#define IS_FLASH_PROGRAM_ADDRESS_BANK1(ADDRESS)
#define FLASH_IT_PGSERR_BANK2
#define FLASH_IT_EOP_BANK2
#define FLASH_NB_32BITWORD_IN_FLASHWORD
@ FLASH_PROC_ALLBANK_MASSERASE
HAL_StatusTypeDef FLASH_OB_WaitForLastOperation(uint32_t Timeout)
__IO uint32_t NbSectorsToErase
#define __HAL_FLASH_GET_FLAG_BANK2(__FLAG__)
#define FLASH_FLAG_PGSERR_BANK1
#define FLASH_FLAG_STRBERR_BANK1
#define HAL_FLASH_ERROR_CRCRD_BANK1
#define HAL_FLASH_ERROR_OB_CHANGE
HAL_StatusTypeDef HAL_FLASH_Program_IT(uint32_t TypeProgram, uint32_t Address, uint64_t Data)
HAL_StatusTypeDef HAL_FLASH_Unlock(void)