cancel
Showing results for 
Search instead for 
Did you mean: 

How to create and run an STM32H7 dual-core basic example

Gyessine
ST Employee

Summary

This article provides a step-by-step guide to learn how to run STM32H7 Dual-Core applications using STM32CubeIDE. It covers configuring the project, setting up both Cortex®-M7 and Cortex®-M4 cores.

Introduction

This article provides a practical introduction to how to run projects based on STM32H7 dual-core microcontrollers using STM32CubeIDE. STM32H7 dual-core devices combine a high-performance Arm Cortex®-M7 core with a flexible Cortex®-M4 core, offering significant processing power and versatility for advanced embedded applications. The project structure for these devices is hierarchical, with separate subprojects and binaries for each core, allowing independent build and debug configurations for both the Cortex®-M7 and Cortex®-M4.

A critical aspect of dual-core development is understanding the boot and synchronization sequence. Typically, the Cortex®-M7 core is responsible for system initialization and resource setup, after which it releases the Cortex®-M4 core from reset or low-power mode. Respecting this sequence is essential to avoid synchronization issues and ensure correct system behavior.

By following these steps, you are able to develop, build, and debug robust applications for STM32H7 dual-core microcontrollers.

1. Prerequisites

This article assumes that you have installed:

STM32CubeIDE

STM32CubeMX

STM32CubeH7

A dual core STM32H7 board for testing (in this article I use the NUCLEO-H755ZI-Q).

2. Project setup

Open STM32CubeMX and click on [File] → [New project].

Gyessine_0-1765284905626.png

Click on "board selector" and select "NUCLEO-H755ZI-Q".

Gyessine_1-1765284916727.png

Once you have your ".ioc" file open, select "PF7" and "PF9" pins as "GPIO outputs".

Gyessine_2-1765284927491.png

In "GPIO menu", assign "PF9" pin to "Arm® Cortex® M4" and "PF7" Pin to "Arm® Cortex® M7".

 

Gyessine_3-1765284954183.pngGyessine_4-1765284973063.png

In "project manager", select a name for your project then click [generate code].

Gyessine_5-1765284994648.png

Now, open "STM32CubeIDE" and open your generated project in it.

To visualize the results, we are going to add a pin toggle mechanism in cm7 and cm4 codes.

Under "CM7/Core/Src/main.c"

Gyessine_6-1765285008432.png

Add this code under "user code begin 3"

/* USER CODE BEGIN 3 */
	    HAL_GPIO_TogglePin(GPIOF, GPIO_PIN_7);

Under "CM4/Core/Src/main.c".

Gyessine_7-1765285039856.png

Add this code in "user begin code 3".

/* USER CODE BEGIN 3 */
	    HAL_GPIO_TogglePin(GPIOF, GPIO_PIN_9);

Now, right click in cm4 project "debug as/debug configuration"

Gyessine_8-1765285086732.png

Under "STM32 C/C++ application", select the "CM4" project, select "the startup" menu and select the existing file. Click on [edit], uncheck [Download], press ok and apply.

Gyessine_21-1765289622589.png

In the "debugger" menu, check [Allow other cores to halt this core] and [Signal halt events to other cores] in the "CTI" options and click [Apply].

Gyessine_20-1765289504729.png

Now, in the "CM7" project,

In the "Startup" menu, click add then add the CM4 project then click ok and apply.

Gyessine_19-1765289417038.png

In the "debugger" menu, ensure that there is a difference by at least 4 in GDB port numbers between CM7 and CM4

In my case, I have CM7 at port number 61234 and CM4 at port number 61238. 

Gyessine_11-1765285119293.png

Check the "CTI" options.

Gyessine_22-1765289697249.png

Everything is set, click on CM7 project and run the project.

Gyessine_17-1765286523884.png

The compiler automatically flashes the CM7 project followed by the CM4 project.

3. Results

To visualize results, we can use an oscilloscope or logic analyzer (in this case I use a logic analyzer)
Attach the PF7 pin and PF9 to the logic analyzer and start a record session

PF7 and PF9 are in PINS 28 and 26 of CN9.

Gyessine_14-1765285157059.png

The logic analyzer shows that there is only a 20 us delay between CM7 and CM4.

Gyessine_15-1765285166260.png

If you select to generate the project using LL instead of HAL:

Gyessine_16-1765285177282.png

And change the necessary toggling function to LL:

GPIOF->ODR ^= (GPIO_PIN_7); for cm7

GPIOF->ODR ^= (GPIO_PIN_9); for cm4

In LL you can expect a reduction in the delay to 12 us.

Gyessine_18-1765286956731.png

Conclusion

By following these steps, you can successfully run a project on the STM32H7 dual-core device using STM32CubeIDE and STM32CubeMX. This guide offers a practical approach. It covers environment setup, dual-core debugger configuration, and validation of the boot sequence to ensure a smooth and effective debugging experience for both the CM7 and CM4 cores.

Related links

Comments

Thanks for this comprehensive guide. It’s a great starting point for anyone working with STM32H7 dual-core MCUs.

Version history
Last update:
‎2026-02-04 7:23 AM
Updated by: