Getting Started With Projects Based On Dual-Core Stm32Wl Microcontrollers in Stm32Cubeide
Getting Started With Projects Based On Dual-Core Stm32Wl Microcontrollers in Stm32Cubeide
Application note
Introduction
This application note describes how to get started with projects based on STM32WL 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 STM32WL Series:
• STM32CubeIDE 1.5.0 or newer
• STM32Cube_FW_WL_V1.0.0 or newer
• STM32CubeMX 6.1.0 or newer
Users are advised to keep updated with the documentation evolution of the STM32WL Series at www.st.com/en/
microcontrollers-microprocessors/stm32wl-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 STM32WL Series.
Select the desired MCU or board. In the example shown in Figure 3, the selected board is the NUCLEO-
WL55JC2. 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.
• Empty projects contain the bare-minimum code to build an debug an empty main().
• STM32Cube projects are managed by STM32CubeMX. Drivers and middleware are generated in the project
based on the configurations done in the .ioc file editor in STM32CubeIDE (the .ioc file editor is the
integrated version of STM32CubeMX).
Note: Select the [Enable Multi Cpus Configuration] option to allow the creation of multicore project with both the
Cortex®‑M0+ and Cortex®‑M4. Unselect this option to create a project with the Cortex®‑M4 only.
Note: Users can also import projects using the import mechanism by going to [File]>[Project...]>[Import...] and
selecting [Existing Projects into Workspace].
3 Debugging
This chapter highlights some of the points to bear in mind while debugging a device in the STM32WL Series.
In the next two sections, this application note covers the configurations needed to start debug sessions with
ST-LINK GDB server and OpenOCD.
Note: By default, the Cortex®‑M0+ is not available until the C2BOOT bit is set in power control register 4 (PWR_CR4).
It is the user's responsibility to enable the C2BOOT bit through the application code running on the Cortex®‑M4.
If there is no security enabled on the Cortex®‑M0+, STMicroelectronics recommends to use access port 0 (AP0)
to program both CPUs.
The Cortex®‑M4 debug configuration is responsible for loading both the Cortex®‑M4 and Cortex®‑M0+ images.
Go to the Startup tab to set this up as shown in Figure 8.
To also download the Cortex®-M4 image, click on [Add...], point to the right project and build the configuration.
The result is shown in Figure 9.
The order in the load list is very important. The debugger sets the start of execution using the entry point of the
last loaded image in this list. In practice, this means that the program counter for the Cortex®‑M4 is set to the
location of the Reset_Handler of the Cortex®‑M4 binary. This is indicated by the green arrow.
Note: It is not necessary to load symbols for the Cortex®‑M0+ in the debug configuration of the Cortex®‑M4 because
they are loaded in the debug configuration of the Cortex®‑M0+.
These steps conclude the debug configuration for the Cortex®‑M4. The next steps present the creation of a debug
configuration for the Cortex®‑M0+ based on the Cortex®‑M0+ project.
Flash programming via access port 1 in “hot-plug” (Cortex®‑M0+) fails if the existing application code on the
Cortex®‑M0+ enables interrupts.
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 debug launch must be done through the “Debug
Configurations...” wizard.
Note: Checking both checkboxes in both debug configurations enables both cores to halt each other.
Select ST-LINK (OpenOCD) as the [Debug probe]. Select Autostart local GDB server for the configuration that
launches first, which is the Cortex®‑M4 in the example in Figure 15.
Create the debug configuration for the other core, which is the Cortex®‑M0+ in the example in Figure 16:
• 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 None 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®‑M4 and Debugger tab - Cortex®-M0+ in Section 3.1 Setting up
with ST-LINK GDB server).
To launch the debug and enable the cross-trigger interface, refer to Section 3.1.1 Launching the configurations
and Section 3.1.2 Cross-trigger Interface.
4 Limitations
Use Use
The whole Flash memory is empty Download only STM32CubeProgrammer STM32CubeProgrammer
standalone(1) standalone(1)
• Application code already loaded for the Use theCortex®‑M0+
Cortex®‑M4 Use
debug configuration to STM32CubeProgrammer
Download only
• The Flash memory is empty for the program the Flash
standalone(1)
Cortex®‑M0+ memory
Application code already loaded for both Cortex®‑Mx Debug only Refer to Section 3 Refer to Section 3
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 STM32WL Series . . . . . . . . . . . . . . . . . 2
1.3.1 Dual-core STM32WL project structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
3 Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8
3.1 Setting up with ST-LINK GDB server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.1.1 Launching the configurations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
4 Limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .20
Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .21
Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .22
List of tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .23
List of figures. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .24
List of tables
Table 1. Programming/debugging status using access port 1 (AP1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Table 2. Document revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
List of figures
Figure 1. Setting the project hierarchical view. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Figure 2. New STM32 project. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Figure 3. Board selector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Figure 4. Projet setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Figure 5. Project example selector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Figure 6. ST-LINK GDB server debug configuration (1 of 6) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Figure 7. ST-LINK GDB server debug configuration (2 of 6) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Figure 8. ST-LINK GDB server debug configuration (3 of 6) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Figure 9. ST-LINK GDB server debug configuration (4 of 6) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Figure 10. ST-LINK GDB server debug configuration (5 of 6) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Figure 11. ST-LINK GDB server debug configuration (6 of 6) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Figure 12. ST-LINK GDB server debug configuration launch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Figure 13. ST-LINK GDB server debug cross-trigger interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Figure 14. OpenOCD debug configuration (1 of 3) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Figure 15. OpenOCD debug configuration (2 of 3) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Figure 16. OpenOCD debug configuration (3 of 3) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18