Showing results for 
Search instead for 
Did you mean: 

TouchGFX and CubeIDE... External Memory Issue

Associate III

On a STM32U5G9J-DK2 kit, once a project, created within TouchGFX, is imported to CubeIDE bitmap images are lost when placed in the external flash memory.

TouchGFX version is 4.23.0, CubeIDE is 1.14.1 and everything is installed on a Windows 10 machine.

Right after the project is created under TouchGFX, it loads correctly to the kit and all images are there.

As soon as it is imported to CubeIDE, regenerated and compiled, it loads to the  kit, everything works perfectly... except bitmap images loaded to the external flash (shapes and other graphics loads perfectly though). Images do not show up, and instead there are parts of the previous display at the place of the bitmap. If bitmaps are set to be stored on internal flash in TouchGFX and the project recompiled under CubeIDE, then all images come again on screen.

I thus double (actually much more than double) checked everything I could suspect: external flash loader, flash.ld files... but did not see any differences between the files generated at first loading from TouchGFX and the ones generated under CubeIDE.

I may be missing something obvious, but  no way to figure out what!!!

Any guidance?





You'd perhaps want to unpack the .MAP and .ELF files to understand what was built.

You can use STM32 Cube Programmer and the appropriate External Loader to upload and verify the .ELF gets delivered properly.

Get some checksums and hashing working so you can confirm content as built.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Many thanks Tesla DeLorean for your prompt advice.

Actually I checked everything I could: the content of the flash looks good to me; at least it is exactly similar to the content of image_alternate_theme_images_previews_preview12.o generated by TouchGFX.

To me it doesn't look very well optimized for storage size, but anyway, this is what it is, and checking the same file, generated with 'Internal Memory' selected, provides the exact same structure.

Map file says it will place at the expected location:

                0x00000000a0000000   0x1e7800
 *(ExtFlashSection ExtFlashSection.*)
                0x00000000a0000000    0x38400 ./Application/User/generated/image_alternate_theme_images_previews_preview12.o
                0x00000000a0000000                image_alternate_theme_images_previews_preview12
                0x00000000a0038400    0x38400 ./Application/User/generated/image_alternate_theme_images_previews_preview15.o
                0x00000000a0038400                image_alternate_theme_images_previews_preview15
                0x00000000a0070800   0x177000 ./Application/User/generated/image_alternate_theme_images_previews_preview5.o
                0x00000000a0070800                image_alternate_theme_images_previews_preview5
                0x00000000a01e7800                . = ALIGN (0x4)

And this is what I can find reading back the external flash memory.

For any weird reasons, I've the feeling that this is more related to how TouchGFX read back the saved images.
Unfortunately I've had no time to further study how this is practically done because I'm getting late on my project.

So far, I will work with internal memory (and small bitmaps... ☹️), still expecting to understand what is wrong here for the future of my project(s)...

PS: to illustrate why I consider the storage not very well optimized, I also attach a dump of the .o file holding one of the images... lots of 0x00, maybe not so useful...

Associate III

Thinking I may have done something wrong during the process, or maybe some bugs were corrected on TouchGFX V23.1, I decided to remove TouchGFX V23.0, and start again from scratch.

So, I installed a fresh TouchGFX V23.1 on my computer.

Since this release still does not show up in CubeIDE, I import it 'from local' using

I then created a basic project under TouchGFX, in a specific folder to be able to create a CubeIDE workspace specific to that project (This is really a pain, that TouchGFX names the project with the board name instead of the project name, preventing to build several projects on the same board in the same workspace!)

I Compiled the project, loaded it onto the board fro mTouchGFX and every thing was OK.

I then imported the project under CubeIDE in a freshly created workspace .

I Compiled the project, loaded it onto the board and every thing was OK.

I finally edited STM32U5G9J-DK2.ioc (sadly named like that) added a timer, with half a second period, NVIC enabled, and in main.c, just toggle the green LED once HAL_TIM_PeriodElapsedCallback is trigged.

=> All bitmaps on the display got corrupted!!!

I went back to TouchGFX, compiled and loaded the project onto the board: same issue!

I switched 'Default Image Configuration'/Section to IntFlashSection and all images came back on screen, LED toggling!


TouchGFX seems to be a very powerful tool, but if it only consists doing a nice demo on a demo board, it is quiet useless! I definitely ask TouchGFX team to consider a better integration of TouchGFX in the official environment of ST Microelecronics, namely CubeIDE!

I finally tried to tackle the problem from the other end, as suggested in some posts, since I don't just want to run a demo!

That is, creating a blank project from CubeIDE, choosing STM32U5G9J-DK2 from board selector.

I got 2 errors when enabling TouchGFX in CubeMX: CRC IP not enable and Width/height not match Window size in LTDC.

First issue is easy to solve: simply enable CRC.

But I'm still struggling to solve the LTDC issue!

Is it possible to know what needs to be done to be able to generate code once IOC file generated?