Skip to main content
Visitor II
March 2, 2021
Solved

STM32Cube_FW_H7_V1.9.0 pFlash variable in stm32h7xx_hal_flash module

  • March 2, 2021
  • 1 reply
  • 736 views

The private variable "FLASH_ProcessTypeDef pFlash" in stm32h7xx_hal_flash.c is used in some functions I notice that it is not initialize by any function.

So for example the first time a call is made to: FLASH_Program(uint32_t TypeProgram, uint32_t FlashAddress, uint32_t DataAddress)

the result of the line is  __HAL_LOCK(&pFlash); is undefined. So it will only work by chance on the first call, successive calls are granted to succeed as  __HAL_UNLOCK(&pFlash); has been called

    This topic has been closed for replies.
    Best answer by DUgbo.1

    I have done a bit more research and as HAL_UNLOCKED = 0x00 and pFlash fields will be set to '0' as it a global variable; So it is not undefined and there is no issue

    1 reply

    DUgbo.1AuthorAnswer
    Visitor II
    March 2, 2021

    I have done a bit more research and as HAL_UNLOCKED = 0x00 and pFlash fields will be set to '0' as it a global variable; So it is not undefined and there is no issue