I am having troubles changing boot1 address in Option Byte in Flash
I want to change boot1 address, allowing me to launch either in bootloader mode (system memory) or usercode mode(flash) without using a jump.
I am currently testing on the STM32H743 EVAL Board
Here is the code changing the address and it does not appear its changing anything
HAL_FLASH_OB_Unlock();
HAL_FLASH_Unlock();
/* Change Boot0 address */
if(mode)OBInit.BootAddr1 = BOOTLOADER_ADDR0;
else OBInit.BootAddr1 = USER_CODE_ADDR0;
HAL_FLASHEx_OBProgram(&OBInit);
if (HAL_FLASH_OB_Launch() != HAL_OK)
{
return(-1);//error
}
HAL_FLASH_OB_Lock();
HAL_FLASH_Lock();
Thanks,
Gabriel
Fixed :
added
OBInit.BootConfig=OB_BOOT_ADD1;
before
if(mode)OBInit.BootAddr1 = BOOTLOADER_ADDR0;