on 2025-03-18 1:36 AM
For various reasons, developers may need to deactivate booting of a core in the STM32H7 dual core product. This article shows how to disable the Cortex®-M7 and Cortex®-M4 cores and enable them again.
Disabling a core is needed for debug purposes or to turn the product to a single core product. Dual and single core products have the same die, but some features are disabled in production on single core products. The Cortex®-M4 is one of the disabled features. So, you can turn the CM4 off on STM32H745 MCU to be seen as, for example, a STM32H743 MCU by taking care of some hardware specifications like the power supply configuration: SMPS and LDO.
To do so, STM32CubeProgrammer is a fast and easy solution using option bytes. In the next section, we describe how to use this tool to disable/enable Cortex®-M4 and Coretx-M7.
Note: If both cores are disabled in the option bytes, the Cortex®-M7 boots (see section 4).
Connect the board with STLINK and open the STM32CubeProgrammer tool:
Figure 1. Opening option bytes menu in STM32CubeProgrammer
Figure 2. Disabling the Cortex®-M7 in option bytes
After applying the change in the option bytes, the connection to the MCU is lost. This is normal behavior, and you see these messages:
Figure 3. STM32CubeProgrammer messages after the operation completion
To connect to the device again, you need to change the debug access port (see section 4).
To enable the Cortex®-M7 boot again, you need first to select the access port 3 to connect to the MCU port (for more details, see section 4):
Figure 4. Selecting access port 3 to connect to CM4
After a successful connection, you can see that the CM7 boot is disabled. Check the [BCM7] option again and click on the [Apply] button.
Figure 5. Reenabling the Cortex®-M7
Wait until the end of the operation. Do not disconnect or power off the board during this operation. At this stage, the Cortex®-M7 is enabled. You can disconnect and reconnect to check.
Same manipulation steps described in the section 2.1 for Cortex®-M7 but need to uncheck the option “BCM4”.
Figure 6. Disable of the Cortex®-M4 in option bytes
Apply this change by clicking on the [Apply] button and wait for the operation to complete.
Same manipulation steps described in the section 2.2, but you need to check the option “BCM4”.
Figure 7. Reenabling the Cortex®-M4
Wait until the end of the operation. Do not disconnect or power off the board during this operation. At this stage, the Cortex®-M4 is enabled. You can disconnect and reconnect to check.
There is no usage for this configuration but if the user disables by mistake both cores, there is a mechanism implemented in the MCU to prevent breaking the chip. If both cores are disabled, the Cortex®-M7 keeps booting. This table is provided in the reference manual RM0399:
This figure shows that if CM4 and CM7 boot are disabled in the option byte, the connection keeps going over access port 0:
To differentiate between the two cores in a connection session, the debugger (for example STM32CubeIDE, see the figures 9 and 10) or the STM32Cubeprogarmmer tool need to know which core is active in the current connection. The access port number is used for this purpose in the DP_SELECT register. For more information, refer to reference manual RM0399 debug port access port select register (DP_SELECT) bit description.
Figure 8. APSEL bitfield description in DP_SELECT register
If you disable Cortex®-M7 in the option bytes and the current access port set is 0 in STM32CubeProgrammer, the connection is lost. The same principle applies to Cortex®-M4. If the current active access port is set to 3 in STM32CubeProgrammer and you disable CM4 boot, the connection is lost.
When reestablishing the connection to the MCU, you need to select the access port number corresponding to an enabled core.
Figure 9. Debugger access port configuration of a Cortex®-M7 project in a STM32H7 dual core example
Figure 10. Debugger access port configuration of a Cortex®-M4 project in a STM32H7 dual core example
This article showed how to enable and disable the Cortex®-M7 and Cortex®-M4 boot using STM32CubeProgrammer.
Reference manual 0399: STM32H745/755 and STM32H747/757 advanced Arm®-based 32-bit MCUs.
Is there a way to disable the M4 core in STM32CubeIDE? This will disable the core. However, if you are using STM32CubeIDE, it will not know this and inject code into the running core (M7 in this case) to wait for the halted core to synchronize. If STM32CubeIDE was told that the M4 core (in this case) was disabled, it would not generate code for the M4 core and would not inject synchronization code into the M7 core.
This article covers the disable/enable of the cores with STM32CubeProgrammer.
"Disable a core with STM32CubeIDE" doesn't make sense as the activation/deactivation is done through the option bytes i.e. in the application.
OK, so check out this scenario:
I'm working with an STM32H745i-DISCO. I want to use the M7 exclusively.
I follow the outline above and disable the M4 core in STM32CubeProgrammer.
Next, I go into STM32CubeIDE and generate a project for the STM32H745i-DISCO, build it and run it. It will run until it executes the core synchronization code. Then it will freeze because the M4 is disabled (as you've noted by the option bytes) and cannot synchronize with the M7 core.
What I am suggesting is that there should be a way to build a project in STM32CubeIDE so that takes into account the disabled M4 core.
In short, if one core is disabled and you don't modify the code from STM32CubeIDE, then the project will not run. You cannot do one without the other.
"In short, if one core is disabled and you don't modify the code from STM32CubeIDE, then the project will not run. You cannot do one without the other"
I do agree.
But this is something related to the user code. I mean, that synchronization could be removed by the user and the CubeMx will not generate that code again. The synchronization code is available between
/* USER CODE BEGIN Boot_Mode_Sequence_X */ and /* USER CODE END Boot_Mode_Sequence_X */
So the user needs to remove the synchronization and program the enabled core.
Keeping one core and disabling the other one is not a regular application scenario for a Dual core product. I don't think a user will purchase a Dual core product than he will use it as a single core (unless per obligation for a reason or another). Disabling a core with STM32CubeProgrammer is used, for example, for debug/tests purposes .