cancel
Showing results for 
Search instead for 
Did you mean: 

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

jumman_JHINGA
Senior II

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!

1 ACCEPTED SOLUTION

Accepted Solutions
Osman SOYKURT
ST Employee

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 SOYKURT
ST Software Developer | TouchGFX

View solution in original post

14 REPLIES 14
jumman_JHINGA
Senior II

is any one has idea about this?

Osman SOYKURT
ST Employee

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 SOYKURT
ST Software Developer | TouchGFX

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 Venmo
Up vote any posts that you find helpful, it shows what's working..

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?


@jumman_JHINGA wrote:
  • Display resolution: 1024×600, color format: RGB888


in single buffer mode is little on edge and flicker is normal on some situations. For double buffer in SDRAM bus is more loaded , but less flicckers possible, but next images placed in cache here add next bus overload...

Is your SDRAM 32bit ? Is DMA2D used? All limits vs LTDC clock is in appnote AN4861.

If your board have STM32H743II then try place critical images into internal flash instead QSPI. You real need RGB888?

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?

You miss SDRAM not work at this time. Simply copy in main code after init sdram...

ok copying in SDRAM in main.c is straitforward and easy, but my doubt is how touchGFX will accesses assets from SDRAM like QuadSPI.

Try read this and maybe see https://community.st.com/t5/stm32-mcus-touchgfx-and-gui/using-fontflashsection-in-qspi-flash-memory/m-p/670999?search-action-id=54626606299&search-result-uid=670999

Simple way is create memory area SDRAMQ and set fixed addressing then use SDRAMQ AT QSPI and this is for linker info place in build code addr in SDRAMQ...