Skip to main content
PButc.1
Associate II
Oct 15, 2020 6:25 PM UTC
Solved

Startup sequence for STM32H7 (dual core)

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 topic has been closed for replies.
TDK
TDKBest answer
Oct 15, 2020 7:00 PM UTC

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""."

3 replies

TDK
TDKBest answer
Oct 15, 2020 7:00 PM UTC

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""."
Associate
Jul 24, 2024 11:39 AM UTC

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 ?

mƎALLEm
ST Technical Moderator
Jul 24, 2024 12:49 PM UTC
To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.