Skip to main content
Visitor II
October 15, 2020
Solved

Startup sequence for STM32H7 (dual core)

  • October 15, 2020
  • 2 replies
  • 4416 views

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.
    Best answer by TDK

    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

    2 replies

    TDKAnswer
    Super User
    October 15, 2020

    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

    Visitor II
    July 24, 2024

    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 ?

    Technical Moderator
    July 24, 2024