cancel
Showing results for 
Search instead for 
Did you mean: 

TouchGFX and CMake

TS-LMG
Associate II

Hello. 

I've been struggling to flash a simple TouchGFX application through the STM32 VS Code extension. I am using the Nucleo-G071RB dev board with the GFX01M2 display board. My project was initially created using the TouchGFX designer, then generated the CMake project in CubeMX. In VS Code, I added the SPI_FLASH section in  STM32G071RBTX_FLASH linker file, and the cmake/touchgfx sub directory in the CMakeLists. This allowed me to build the project with no errors. However, whenever I try to flash, I get the following:

Screenshot 2025-06-10 152940.jpg

I suspect this has something the do with the external flash. I am aware of an external loader file that you have to select in STM32CubeIDE, but I'm not too sure what would be the equivalent in VS Code. 

3 REPLIES 3
TS-LMG
Associate II

Update: I've added the location of the external loader to "serverArgs" of launch.json. I'm still having the same issue. 

GaetanGodart
ST Employee

Hello @TS-LMG ,

 

This looks like a flashing issue.
Since you erase internal memory and then flash it is perhaps an internal memory issue, not external?

Could you try to flash using STM32CubeProgrammer?

 

What about that SPI_FLASH section?
You say that you create the project using TouchGFX Designer, so it should work from there, then you change 2 things : you add the SPI_FLASH section and you also change the toolchain.
Could you try to only do 1 of these things to see which one is causing an issue?

 

Regards,

Gaetan Godart
Software engineer at ST (TouchGFX)

Hello @GaetanGodart,

Thank you for your reply. It seems like the flash issue happens right from the get-go. Without the SPI_FLASH, I get a flash overflow on the internal flash. And without the cmake/touchgfx in the CMakeLists, I get compile errors. Regarding the launch.json, I uncommented the external loader section: 

Screenshot 2025-06-12 093530.jpg

This had no effect. I'm not sure if the external loader is being used or not. 

Regarding STM32CubeIDE, the code works fine using ST-Link GDB server and the external loader generated by touchGFX. However, not including the external loader, I get the following error:

Screenshot 2025-06-12 094329.jpg

Switching to OpenOCD, I get this error message: 

Info : accepting 'gdb' connection on tcp/3333
Error: Failed to write memory at 0x900017c0
Error: Failed to write memory at 0x90005740
Info : dropped 'gdb' connection
shutdown command invoked
Info : dropped 'gdb' connection

I'll attach the zip of the Cmake project if you want to take a look at it.