2024-03-26 04:52 AM
I'm using a STM32H745 and running a bootloader on the CM4. In the bootloader I want to set the boot address of the CM7 using the user option bytes.
Is this possible and if so, how should I do this?
Kind regards
Solved! Go to Solution.
2024-03-27 06:06 AM - edited 2024-03-27 06:08 AM
You're missing:
OBInit.BootConfig = OB_BOOT_ADD0;
This sequence is working well from CM4 side:
HAL_FLASH_Unlock();
HAL_FLASH_OB_Unlock();
HAL_FLASHEx_OBGetConfig(&OBInit);
OBInit.OptionType = OPTIONBYTE_CM7_BOOTADD;
OBInit.BootAddr0 = 0x08010000;
OBInit.BootConfig = OB_BOOT_ADD0;
HAL_FLASHEx_OBProgram(&OBInit);
HAL_FLASH_OB_Launch()
2024-03-26 05:30 AM
I don't see a constraint to do that.
How to modify an option byte? refer to the RM0399 / section 4.4.3 Option byte modification.
An example how to modify option byte is provided here for Flash BANK swapping example.
2024-03-26 08:32 AM
I'm using the following to set the boot address for the M7 core from the M4 core application. But somehow the boot address remains the same. Any suggestions?
{
FLASH_OBProgramInitTypeDef OB;
HAL_FLASHEx_OBGetConfig(&OB);
OB.OptionType = OPTIONBYTE_CM7_BOOTADD;
OB.BootAddr0 = 0x08010000;
HAL_FLASH_Unlock();
HAL_FLASH_OB_Unlock();
if ( HAL_FLASHEx_OBProgram(&OB) != HAL_OK )
{
return ;
}
HAL_FLASH_OB_Launch();
}
2024-03-27 06:06 AM - edited 2024-03-27 06:08 AM
You're missing:
OBInit.BootConfig = OB_BOOT_ADD0;
This sequence is working well from CM4 side:
HAL_FLASH_Unlock();
HAL_FLASH_OB_Unlock();
HAL_FLASHEx_OBGetConfig(&OBInit);
OBInit.OptionType = OPTIONBYTE_CM7_BOOTADD;
OBInit.BootAddr0 = 0x08010000;
OBInit.BootConfig = OB_BOOT_ADD0;
HAL_FLASHEx_OBProgram(&OBInit);
HAL_FLASH_OB_Launch()