on 2025-10-28 5:12 AM
This article provides a step-by-step guide to configure STM32CubeIDE for debugging STM32N6 microcontrollers running TouchGFX applications. It focuses on importing a TouchGFX-generated project into STM32CubeIDE and setting up the necessary debug configurations to enable seamless debugging. By following this guide, developers can efficiently debug their graphical applications on STM32N6 devices, improving development productivity and troubleshooting capabilities.
Developing advanced graphical user interfaces on STM32 microcontrollers has been greatly simplified by TouchGFX, a powerful framework for creating high-performance embedded graphics. When targeting the STM32N6 series, integrating TouchGFX projects with STM32CubeIDE is essential to leverage the full debugging capabilities offered by ST’s development environment.
This article walks you through the process of importing a TouchGFX-generated project into STM32CubeIDE and configuring the IDE to enable debugging on STM32N6 devices. You learn how to set up the project environment, configure debug settings, and troubleshoot common issues, ensuring a smooth and efficient development workflow for your TouchGFX applications.
Before starting, ensure that you have:
The hardware used to showcase is the STM32N6570-DK and make sure that you have it in DEV boot mode to program the code:
1. Create a simple project using TouchGFX by clicking [Create New].
2. Select the board by filtering with "STM32N6," then click on the board and configure the path and project name.3. Configure the application as desired. For this example, the Flex Button demo code application is used.
4. Once the design includes all desired features, generate the project.
1. Open the project created with STM32CubeIDE. It should include all projects created in the workspace.2. If your board has the default OTP fuse settings, either:
To debug the application on the STM32N6 with TouchGFX, follow these steps:
1. Add the post-build step to ensure your FSBL has the signature.
1a. FSBL:
cd "${ProjDirPath}/Debug" && echo y | "C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin\STM32_SigningTool_CLI.exe" -bin "${ProjName}.bin" -nk -of 0x80000000 -t fsbl -o "${ProjName}-Trusted.bin" -hv 2.3 -dump "${ProjName}-Trusted.bin"
2. Add the post-build step to ensure your application has the signature.
2a. Application:
arm-none-eabi-objcopy.exe -O binary --remove-section=ExtFlashSection --remove-section=FontFlashSection --remove-section=TextFlashSection ${ProjName}.elf ${ProjName}.bin&arm-none-eabi-objcopy.exe -O ihex --only-section=FontFlashSection --only-section=TextFlashSection --only-section=ExtFlashSection ${ProjName}.elf ${ProjName}_assets.hex && cd "${ProjDirPath}/Debug" && echo y | "C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin\STM32_SigningTool_CLI.exe" -bin "${ProjName}.bin" -nk -of 0x80000000 -t fsbl -o "${ProjName}-Trusted.bin" -hv 2.3 -dump "${ProjName}-Trusted.bin"
3. Edit the startup sequence in the debugger settings for the FSBL:4. Go to the [Debugger] tab.
5. In the [Startup] section, ensure that the FSBL ELF file is used. Since this is a debug session, the trusted binary is not required, but we will add it as well. Add the FSBL-Trusted.bin file to be programmed at address 0x70000000.
6. Configure the application to load the trusted binary into address 0x70100000 and the image assets using the HEX file. Only download this file; do not load symbols, as they are provided by the ELF file.
This should be the final look of the settings:
Once in debug mode, you might encounter a few messages before the application runs as the framebuffer is populated. Click Continue a few times if this happens.
Warning: Avoid leaving breakpoints in the application, as this causes the debugger session to fail and display an error message.
Note: You may need to power cycle between debug sessions if using the default external loader. For more details, refer to the How to debug STM32N6 using STM32CubeIDE article. Alternatively, create a custom loader to adjust this behavior as explained in the article.
Configuring STM32CubeIDE to debug TouchGFX projects on STM32N6 devices is a crucial step to fully harness the capabilities of both the hardware and software tools. By following the outlined steps to import the TouchGFX-generated project and properly set up the debug environment, developers can efficiently identify and resolve issues within their graphical applications. This integration not only streamlines the development process but also enhances the overall reliability and performance of the final product. With this configuration in place, you are well equipped to accelerate your embedded GUI development on STM32N6 platforms using TouchGFX and STM32CubeIDE.