cancel
Showing results for 
Search instead for 
Did you mean: 

Need help changing "BOOT_ADD0" on STM32H743

Cristea.Catalin
Associate III

Hi,

I need to be able to change "BOOT_ADD0" and the following code doesn't work; please help.

For one thing I have no idea if it's FLASH_BANK_1 or 2 that I'm interested in.

Then I'm hoping that "...GetConfig" populates everything and I only need to change a few things but I'm not sure.

Help, please?

Thanks,

Cat

HAL_FLASH_OB_Unlock();

HAL_FLASH_OB_Launch();

FLASH_OBProgramInitTypeDef Cats_pOBInit;

Cats_pOBInit.Banks = FLASH_BANK_1; //Which one?

HAL_FLASHEx_OBGetConfig(&Cats_pOBInit);

Cats_pOBInit.OptionType = OPTIONBYTE_BOOTADD;

Cats_pOBInit.BootAddr0 = 0x1FF0;

Cats_pOBInit.OptionType |= OPTIONBYTE_WRP;

Cats_pOBInit.WRPState &= ~OB_WRPSTATE_ENABLE;

HAL_FLASHEx_OBProgram(&Cats_pOBInit);

HAL_FLASH_OB_Lock();

2 REPLIES 2
Cristea.Catalin
Associate III

Note: The "-" in front of "OB_WRPSTATE_ENABLE" is in fact a Tilde. I don't know how to make it look like one.

Cristea.Catalin
Associate III

I think I got it.

The following seems to work but I think not everything I have here is needed:

FLASH_OBProgramInitTypeDef Cats_OBInit;

HAL_FLASH_Unlock();

HAL_FLASH_OB_Unlock();

HAL_FLASHEx_OBGetConfig(&Cats_OBInit);

Cats_OBInit.Banks = FLASH_BANK_1;

Cats_OBInit.OptionType = OPTIONBYTE_BOOTADD;

Cats_OBInit.BootAddr0 = 0x1FF00000;

Cats_OBInit.BootConfig = OB_BOOT_ADD0; //Specifies Boot Address to be configured: must be OB_BOOT_ADD0, OB_BOOT_ADD1, OB_BOOT_ADD_BOTH

HAL_FLASHEx_OBProgram(&Cats_OBInit);

HAL_FLASH_OB_Launch();

HAL_FLASH_OB_Lock();

HAL_FLASH_Lock();