2018-06-02 12:37 AM
X:\STMicroelectronics\STM32Cube\Repository\STM32Cube_FW_H7_V1.2.0\Projects\STM32H743I_EVAL\Applications\IAP\IAP_Main
Isn't function HAL_FLASH_Lock() supposed to be in position 2?
2018-06-04 02:05 AM
Hi
v.v.010
,I will check this problem with our development team & come back to you.Sorry for the inconvenience may bring.
-Nesrine-
2018-06-04 10:16 PM
Thank you very much for your reply.
In addition, by the way, I use the example of IAP provided in STM32Cube_FW_H7_V1.2.0\Projects\STM32H743I_EVAL\Applications\IAP\IAP_Main\, but the loaded APP program can not run. The APP code I have set the interrupt vector table and jump address.
2018-08-02 12:20 PM
Thank you for pointing this out. I was wondering why after the erase function call, the memory was not erased. I move the Lock function down to:
and now the flash erase works.
2018-08-02 12:22 PM
Sorry, my screen shot did not work.
2018-08-02 12:24 PM
AHHHH!
uint16_t FLASH_If_GetWriteProtectionStatus(void)
{
uint32_t ProtectedSECTOR = 0x0;
FLASH_OBProgramInitTypeDef OptionsBytesStruct;
/* Unlock the Flash to enable the flash control register access *************/
HAL_FLASH_Unlock();
// /* Lock the Flash to disable the flash control register access (recommended
// to protect the FLASH memory against possible unwanted operation) *********/
// HAL_FLASH_Lock();
if (APPLICATION_ADDRESS < ADDR_FLASH_SECTOR_0_BANK2)
{
/* Select Bank1 */
OptionsBytesStruct.Banks = FLASH_BANK_1;
/* Check if there are write protected sectors inside the user flash area ****/
HAL_FLASHEx_OBGetConfig(&OptionsBytesStruct);
/* Get pages already write protected ****************************************/
ProtectedSECTOR = OptionsBytesStruct.WRPSector & FLASH_SECTOR_TO_BE_PROTECTED;
}
/* Select Bank2*/
OptionsBytesStruct.Banks = FLASH_BANK_2;
/* Check if there are write protected sectors inside the user flash area ****/
HAL_FLASHEx_OBGetConfig(&OptionsBytesStruct);
/* Get pages already write protected ****************************************/
ProtectedSECTOR |= OptionsBytesStruct.WRPSector & FLASH_SECTOR_TO_BE_PROTECTED;
/* Lock the Flash to disable the flash control register access (recommended
to protect the FLASH memory against possible unwanted operation) *********/
HAL_FLASH_Lock();
/* Check if desired pages are already write protected ***********************/
if(ProtectedSECTOR != 0)
{
/* Some sectors inside the user flash area are write protected */
return FLASHIF_PROTECTION_WRPENABLED;
}
else
{
/* No write protected sectors inside the user flash area */
return FLASHIF_PROTECTION_NONE;
}
}
Someday I figure out how you guys are doing that.
2018-08-02 12:26 PM
So this new website is not very intuitive or I am not able to see what I paste AFTER I click on Answer.
2018-08-02 12:30 PM
uint16_t FLASH_If_GetWriteProtectionStatus(void)
{
uint32_t ProtectedSECTOR = 0x0;
FLASH_OBProgramInitTypeDef OptionsBytesStruct;
/* Unlock the Flash to enable the flash control register access *************/
HAL_FLASH_Unlock();
// /* Lock the Flash to disable the flash control register access (recommended
// to protect the FLASH memory against possible unwanted operation) *********/
// HAL_FLASH_Lock();
if (APPLICATION_ADDRESS < ADDR_FLASH_SECTOR_0_BANK2)
{
/* Select Bank1 */
OptionsBytesStruct.Banks = FLASH_BANK_1;
/* Check if there are write protected sectors inside the user flash area ****/
HAL_FLASHEx_OBGetConfig(&OptionsBytesStruct);
/* Get pages already write protected ****************************************/
ProtectedSECTOR = OptionsBytesStruct.WRPSector & FLASH_SECTOR_TO_BE_PROTECTED;
}
/* Select Bank2*/
OptionsBytesStruct.Banks = FLASH_BANK_2;
/* Check if there are write protected sectors inside the user flash area ****/
HAL_FLASHEx_OBGetConfig(&OptionsBytesStruct);
/* Get pages already write protected ****************************************/
ProtectedSECTOR |= OptionsBytesStruct.WRPSector & FLASH_SECTOR_TO_BE_PROTECTED;
/* Lock the Flash to disable the flash control register access (recommended
to protect the FLASH memory against possible unwanted operation) *********/
HAL_FLASH_Lock();
/* Check if desired pages are already write protected ***********************/
if(ProtectedSECTOR != 0)
{
/* Some sectors inside the user flash area are write protected */
return FLASHIF_PROTECTION_WRPENABLED;
}
else
{
/* No write protected sectors inside the user flash area */
return FLASHIF_PROTECTION_NONE;
}
}
2018-08-02 03:11 PM
You can also Edit and place in code blocks </>