cancel
Showing results for 
Search instead for 
Did you mean: 

Startup sequence for STM32H7 (dual core)

PButc.1
Associate II

Hello,

is there any documentation regarding the startup on both cores as I see there are several possibilitiess to gate the other core or to let them run directly in parallel. Nevertheless, CubeMx generates a common startup file which is shared I assume. Does ST provide more information on this topic? Where can I find some reference material, e.g. ARM for a dual core approach?

This discussion has been locked for participation. If you have a question, please start a new topic in order to ask your question
1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

There are many ways to do this. The startup code generated by CubeMX is worth a look. It lets the CM7 initialize some stuff while the CM4 waits to be notified. The startup file is the same but it is not shared--there is a copy for each core and they can be modified independently according to your needs.

/* USER CODE BEGIN Boot_Mode_Sequence_1 */
  /*HW semaphore Clock enable*/
  __HAL_RCC_HSEM_CLK_ENABLE();
  /* Activate HSEM notification for Cortex-M4*/
  HAL_HSEM_ActivateNotification(__HAL_HSEM_SEMID_TO_MASK(HSEM_ID_0));
  /*
  Domain D2 goes to STOP mode (Cortex-M4 in deep-sleep) waiting for Cortex-M7 to
  perform system initialization (system clock config, external memory configuration.. )
  */
  HAL_PWREx_ClearPendingEvent();
  HAL_PWREx_EnterSTOPMode(PWR_MAINREGULATOR_ON, PWR_STOPENTRY_WFE, PWR_D2_DOMAIN);
  /* Clear HSEM flag */
  __HAL_HSEM_CLEAR_FLAG(__HAL_HSEM_SEMID_TO_MASK(HSEM_ID_0));
 
/* USER CODE END Boot_Mode_Sequence_1 */

There is also this but I think looking at the code is more useful:

https://www.st.com/resource/en/application_note/dm00629855-getting-started-with-projects-based-on-dualcore-stm32h7-microcontrollers-in-stm32cubeide-stmicroelectronics.pdf

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

3 REPLIES 3
TDK
Guru

There are many ways to do this. The startup code generated by CubeMX is worth a look. It lets the CM7 initialize some stuff while the CM4 waits to be notified. The startup file is the same but it is not shared--there is a copy for each core and they can be modified independently according to your needs.

/* USER CODE BEGIN Boot_Mode_Sequence_1 */
  /*HW semaphore Clock enable*/
  __HAL_RCC_HSEM_CLK_ENABLE();
  /* Activate HSEM notification for Cortex-M4*/
  HAL_HSEM_ActivateNotification(__HAL_HSEM_SEMID_TO_MASK(HSEM_ID_0));
  /*
  Domain D2 goes to STOP mode (Cortex-M4 in deep-sleep) waiting for Cortex-M7 to
  perform system initialization (system clock config, external memory configuration.. )
  */
  HAL_PWREx_ClearPendingEvent();
  HAL_PWREx_EnterSTOPMode(PWR_MAINREGULATOR_ON, PWR_STOPENTRY_WFE, PWR_D2_DOMAIN);
  /* Clear HSEM flag */
  __HAL_HSEM_CLEAR_FLAG(__HAL_HSEM_SEMID_TO_MASK(HSEM_ID_0));
 
/* USER CODE END Boot_Mode_Sequence_1 */

There is also this but I think looking at the code is more useful:

https://www.st.com/resource/en/application_note/dm00629855-getting-started-with-projects-based-on-dualcore-stm32h7-microcontrollers-in-stm32cubeide-stmicroelectronics.pdf

If you feel a post has answered your question, please click "Accept as Solution".
uREG
Associate II

Hello. All the examples I've found are so, that CM7 starts first and then runs CM4.

But I need the other way: run first the CM4 from 0x08000000, make the peripherals init

and then run CM7 from 0x08100000.

How should i do that ?

Opened a dedicated thread for your question: https://community.st.com/t5/stm32-mcus-products/changing-boot-address-of-cm4-and-cm7-in-stm32h745-dual-core/td-p/701335

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.