cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H745 set CM7 boot addr0 from CM4

Sander-W
Associate

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

1 ACCEPTED SOLUTION

Accepted Solutions

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()
To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

View solution in original post

3 REPLIES 3
SofLit
ST Employee

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.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

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

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()
To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.