Getting Started With Projects Based On Dual-Core Stm32H7 Microcontrollers in Stm32Cubeide
Getting Started With Projects Based On Dual-Core Stm32H7 Microcontrollers in Stm32Cubeide
Application note
Introduction
This application note describes how to get started with projects based on STM32H7 Series dual-core microcontrollers in the
STMicroelectronics STM32CubeIDE integrated development environment.
1 General information
STM32CubeIDE supports STM32 32-bit products based on the Arm® Cortex® processor.
Note: Arm is a registered trademark of Arm Limited (or its subsidiaries) in the US and/or elsewhere.
1.1 Prerequisites
The following tools are prerequisites for understanding the tutorial in this document and developing an application
based on the STM32H7 Series:
• STM32CubeIDE 1.4.0 or newer
• STM32Cube_FW_H7_V1.7.0 or newer
• STM32CubeMX 6.0.0 or newer
Users are advised to keep updated with the documentation evolution of the STM32H7 Series at www.st.com/en/
microcontrollers-microprocessors/stm32h7-series.html.
If the project is not shown in a hierarchical structure, this can be changed as shown in Figure 1.
This chapter describes how to create or import projects for dual-core microcontrollers in the STM32H7 Series.
Select the desired MCU or board. In the example illustrated in Figure 3, the selected board is the NUCLEO-
H745ZI-Q. Click on [Next >].
After the target selection comes the project setup step shown in Figure 4. The Targeted Project Type setting
determines whether the project gets generated by STM32CubeMX or not. An Empty project is a skeleton of a
project that needs building upon while STM32Cube indicates an STM32CubeMX-managed project.
After the project is regenerated, go to [File]>[Import…] and choose to import it as an Existing projects into
workspace as shown in Figure 5.
Then copy the code inside the different /* USER CODE BEGIN */ blocks that exist in the project into the new
STM32CubeIDE environment.
Select the device for the project being imported and click on [Next >].
When setting up the project as shown in , make sure the Targeted Project Type is set to Empty and click on
[Finish].
2.4 Create an empty project based on the template in the STM32CubeH7 MCU
Package
Follow the same steps as in Section 2.3 Import an SW4STM32 project without an ioc file but use
STM32Cube_FW_H7 firmware in the STM32CubeH7 MCU Package as input.
Then select the correct project. A project example is by default located at $HOME\STM32Cube\Repository\ST
M32Cube_FW_H7_VX.X.X\Projects\NUCLEO-H745ZI-Q\Examples\GPIO\GPIO_EXTI.
After selecting the project, click on [Finish] to import and build the project.
3 Debugging
This chapter highlights some of the points to bear in mind while debugging a device in the STM32H7 Series.
In the next two sections, this application note covers the configurations needed to start debug sessions with
ST-LINK GDB server and OpenOCD.
To start configuring the launch of the debug session, right-click the sub-project (in this example, the Cortex®-M7)
and select [Debug As]>[Debug Configurations...] as shown in Figure 11.
Figure 11. ST-LINK GDB server debug configuration (1 of 6) and OpenOCD debug configuration (1 of 3)
Note: For the rest of this section, examples are based on the NUCLEO-H755ZI-Q board.
The Cortex®-M7 debug configuration is responsible for loading both the Cortex®-M7 and Cortex®-M4 images. Go
to the Startup tab to do this as shown in Figure 13:
To download also the Cortex®-M4 image, click [Add...], browse the correct project, and build the configuration.
The result is shown in Figure 14.
The order in the load list is very important. The last entry in the list, marked by a green arrow (refer to Figure 13,
is the image debugged with this debug configuration. Consequently, the debugger fetches the program counter
value (PC) from this image.
Go to the Startup tab and select [Edit…]>[Disable Download]. This is required since the download is already
performed by the Cortex®-M7 configuration (refer to Figure 16).
Note: After creating the debug configurations for both cores, they are not shown in the scroll-down menu if they have
never been launched before. This is because the arrow provides access to the history of latest launches, with
a grayed “no history” message if there are none. First-time degug launch must be done through the debug
configuration wizard.
When debugging an STM32H7 device with the ST-LINK GDB server, it is possible to create a launch group, which
offers the following advantages:
• The user can launch the debug session on both cores with only one launch configuration as shown in
Figure 18.
• The user can stop both cores using the launch group. This avoids having to terminate both debug sessions
individually.
Note: Checking both checkboxes in both debug configurations enables both cores to halt each other.
Create the debug configuration for the other core, which is the Cortex®-M4 in the example in Figure 21:
• Select ST-LINK (OpenOCD) as the [Debug probe]
• Select Autostart local GDB server as default
• Make sure that the Port number exceeds the value of the previous debug configuration by at least 2 (3335 in
this example)
• Open [Generator Options] and select Core reset as [Reset Mode]
The configuration of the Startup tab is the same as with the ST-LINK GDB server probe for both debug
configurations (refer to Startup tab - Cortex-M7 and Startup tab - Cortex-M4 in Section 3.1 Setting up with
ST-LINK GDB server).
Note: After creating the debug configurations for both cores, they are not shown in the scroll-down menu if they have
never been launched before. This is because the arrow provides access to the history of latest launches, with
a grayed “no history” message if there are none. First-time degug launch must be done through the debug
configuration wizard.
When debugging an STM32H7 device with OpenOCD, it ispossible to create a launch group, which offers the
following advantages:
• The user can launch the debug session on both cores with only one launch configuration.
• The user can stop both cores using the launch group. This avoids having to manually terminate both debug
sessions individually. In Figure 24, the launch group in pink handles each of the cores in green.
Note: Checking both checkboxes in both debug configurations enables both cores to halt each other.
Revision history
Table 1. Document revision history
Contents
1 General information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.1 Prerequisites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2 The use cases in this document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.3 Specific features of dual-core microcontrollers in the STM32H7 Series. . . . . . . . . . . . . . . . . . 2
1.3.1 Dual-core STM32H7 project structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2 Create and import projects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.1 Create a new STM32 project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.2 Import an SW4STM32 project with an ioc file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.3 Import an SW4STM32 project without an ioc file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.4 Create an empty project based on the template in the STM32CubeH7 MCU Package . . . . . 9
2.5 Import a project from the STM32CubeH7 MCU Package . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3 Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .11
3.1 Setting up with ST-LINK GDB server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.1.1 Launching the configurations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
3.1.2 Cross-trigger Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
3.2 Setting up with OpenOCD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3.2.1 Launching the configurations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
3.2.2 Cross-trigger interface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .23
List of figures. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .25
List of figures
Figure 1. Setting the project hierarchical view. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Figure 2. New STM32 project. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Figure 3. Target selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Figure 4. Projet setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Figure 5. Import an existing projet with an ioc file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Figure 6. New STM32 project. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Figure 7. Projet setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Figure 8. Copy project content to empty sub-project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Figure 9. Import of firmware project into STM32CubeIDE. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Figure 10. Firmware project selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Figure 11. ST-LINK GDB server debug configuration (1 of 6) and OpenOCD debug configuration (1 of 3) . . . . . . . . . . . . 11
Figure 12. ST-LINK GDB server debug configuration (2 of 6) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Figure 13. ST-LINK GDB server debug configuration (3 of 6) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Figure 14. ST-LINK GDB server debug configuration (4 of 6) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Figure 15. ST-LINK GDB server debug configuration (5 of 6) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Figure 16. ST-LINK GDB server debug configuration (6 of 6) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Figure 17. ST-LINK GDB server debug configuration launch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Figure 18. ST-LINK GDB server launch group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Figure 19. ST-LINK GDB server debug cross-trigger interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Figure 20. OpenOCD debug configuration (2 of 3) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Figure 21. OpenOCD debug configuration (3 of 3) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Figure 22. OpenOCD debug configuration launch. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Figure 23. Launch OpenOCD debug on both cores. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Figure 24. Stop OpenOCD debug on both cores . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Figure 25. OpenOCD debug cross-trigger interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22