Skip to main content
jumman_JHINGA
Senior III
May 12, 2025
Solved

How to Load QSPI Assests into SDRAM Once and Use Them Repeatedly in TouchGFX?

  • May 12, 2025
  • 4 replies
  • 1319 views

Hello ST Community,

I'm working on a project using STM32H7 (Waveshare OpenH7XXI-C board) with TouchGFX 4.25.

My hardware setup:

  • External QSPI flash (W25Q128) for storing bitmap/image assets

  • External SDRAM (IS42S16400J - 16MB) for framebuffer and runtime buffers

  • Display resolution: 1024×600, color format: RGB888

Due to hardware design limitations, I'm unable to increase the QuadSPI speed (track length and plug-n-play module constraints).
I’ve observed that during frequent screen updates, some parts of the background image get re-read from QSPI, resulting in flickering.

This becomes more noticeable when using large fonts, wildcard text updates, or redrawing images.


My goal:

I want TouchGFX to:

  1. Load image/bitmap assets (stored in QSPI) only once at startup

  2. Copy them into SDRAM

  3. Reuse from SDRAM on future redraws — avoiding repeated QSPI reads


My Questions:

  1. What is the recommended method to configure TouchGFX for caching QSPI images into SDRAM once?

  2. How should I modify the linker script (.ld) to reserve a section in SDRAM for bitmap cache without conflicting with the framebuffer?

  3. Is there a way to verify whether an image was successfully cached?

  4. What happens if the cache size is exceeded?


️ Current Setup:

  • Framebuffer is mapped at 0xD0000000 in SDRAM (TouchGFX_Framebuffer)

  • Planning to reserve from 0xD0400000 onwards for cached bitmaps via a .BitmapCacheSection in the linker

If needed, I’m happy to share my .ld file or SDRAM init code.

Thanks in advance for your guidance and suggestions!

Best answer by Osman SOYKURT

Hello @jumman_JHINGA ,

I invite you to look at this article which explains exactly what you need. Caching Bitmaps is what I would go for if I had to copy what I have from flash to RAM. If you have enough space in RAM, I suggest to cache all the assets at the beginning of your application then you would not need to uncache assets in case of multiple screens using other assets.

4 replies

jumman_JHINGA
Senior III
May 13, 2025

is any one has idea about this?

Tesla DeLorean
Guru
May 14, 2025

Use the linker script to describe these areas in SDRAM, but to store in QSPI, add symbols at the head, and tail, and location in QSPI, add code in startup.s to move the area after bringing up.

Have code in SystemInit(), or your loader, bring up the SDRAM and QSPI interfaces properly per ARM CMSIS expectations, prior to main()

 /* used by the startup to initialize SDRAM data */
 _sisdramdata = LOADADDR(.sdramdata);

 /* Initialized data sections goes into SDRAM, load LMA copy after code */
 .sdramdata :
 {
 . = ALIGN(4);
 _ssdramdata = .; /* create a global symbol at SDRAM data start */
 *(.sdramdata) /* .sdramdata sections */
 *(.sdramdata*) /* .sdarmdata* sections */

/* plus fonts, data, etc that you'd previous have in QSPI */

 . = ALIGN(4);
 _esdramdata = .; /* define a global symbol at SDRAM data end */
 } >SDRAM AT> QSPI /* linker allocates in SDRAM, but stows in non-volatile QSPI */

 

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
jumman_JHINGA
Senior III
May 15, 2025

hii @Tesla DeLorean please tell me if im wrong,  what i understood:

 

1. Modify the Linker Script

In my .ld file, ihave to  add a new section to copy image/font data from QSPI to SDRAM:

 

 
/* Pointer to data in QSPI (load location) */
_sisdramdata = LOADADDR(.sdramdata);

/* Actual section in SDRAM (execution location) */
.sdramdata :
{
 . = ALIGN(4);
 _ssdramdata = .; /* Start of SDRAM data */
 *(.sdramdata) /* All asset variables with __attribute__((section(".sdramdata"))) */
 . = ALIGN(4);
 _esdramdata = .; /* End of SDRAM data */
} >SDRAM AT>QSPI

 

2. Modify Startup File (startup_stm32h743iitx.s)

Copy .sdramdata from QSPI to SDRAM at startup:

/* Copy sdramdata section from QSPI to SDRAM */
 ldr r0, =_ssdramdata
 ldr r1, =_esdramdata
 ldr r2, =_sisdramdata
 movs r3, #0
 b LoopCopySDRAM

CopySDRAM:
 ldr r4, [r2, r3]
 str r4, [r0, r3]
 adds r3, r3, #4

LoopCopySDRAM:
 adds r4, r0, r3
 cmp r4, r1
 bcc CopySDRAM

till now Im i going in correct way?

After this, dose i need to do other procedure to load images and fonts into SDRAM ? or it is going to work automatically?

Osman SOYKURT
Osman SOYKURTBest answer
Technical Moderator
May 14, 2025

Hello @jumman_JHINGA ,

I invite you to look at this article which explains exactly what you need. Caching Bitmaps is what I would go for if I had to copy what I have from flash to RAM. If you have enough space in RAM, I suggest to cache all the assets at the beginning of your application then you would not need to uncache assets in case of multiple screens using other assets.

Osman SOYKURTST Software Developer | TouchGFX
jumman_JHINGA
Senior III
May 15, 2025

Hii @Osman SOYKURT when im clicking on the article link, its going to microsoft Teams website.. when im login to team its not showing anything. could you provide procedure to access that article?

Osman SOYKURT
Technical Moderator
May 15, 2025

Issue solved, thanks for reporting ;)

Osman SOYKURTST Software Developer | TouchGFX
urbito
Senior II
May 15, 2025

Flickering is more related to unoptimal configuration on FMC/SDRAM than the speed between QSPI and DMA/SDRAM.

I had kind of flickering or wrong resolution/definitions in fonts and figures/images that got solved once the FMC/SDRAM got fixed.

hope it helps.

Osman SOYKURT
Technical Moderator
May 16, 2025

Hello @jumman_JHINGA ,

Glad to hear it solved your issue! :)

Osman SOYKURTST Software Developer | TouchGFX