Skip to main content
Associate
March 26, 2024
Solved

STM32H745 set CM7 boot addr0 from CM4

  • March 26, 2024
  • 1 reply
  • 1424 views

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

This topic has been closed for replies.
Best answer by mƎALLEm

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()

1 reply

mƎALLEm
Technical Moderator
March 26, 2024

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.

Sander-WAuthor
Associate
March 26, 2024

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();
}
mƎALLEm
mƎALLEmBest answer
Technical Moderator
March 27, 2024

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()