Skip to main content
Associate II
March 26, 2025
Solved

How to configure internal memory for LCD without using external RAM and Flash

  • March 26, 2025
  • 3 replies
  • 724 views

Hello everyone, I'm currently using the STM32H745BIT6 microcontroller and I'm having difficulty configuring the system so that the M7 core can use internal memory (Internal RAM/Flash) to store data from TouchGFX. I would like to avoid using any external memory (external RAM or Flash). I'm not sure how to properly configure this. I would greatly appreciate any support or guidance. Thank you !

NguyenAnhHieu__0-1742953516422.png

NguyenAnhHieu__1-1742953549735.png

 

Best answer by GaetanGodart

Hello @NguyenAnhHieu_ ,

 

Since your board is not working yet, we recommend you to disable the DCache for the moment and to set it up once you have a working project.

It is also recommended to keep the buffer location as "By allocation" to let TouchGFX choose where to put it.
Then, in your linker script you can tell that you want the framebuffer in the internal RAM.
We put the framebuffer in internal RAM on the STM32U5G9J-DK2 TBS so you can look how we did that :

MEMORY
{
 RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 3008K
 FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 4096K
 EXT_FLASH (r) : ORIGIN = 0xA0000000, LENGTH = 128M
}

/* Sections */
SECTIONS
{
.
.
.

.
.
.
FramebufferSection (NOLOAD) :
 {
 *(TouchGFX_Framebuffer TouchGFX_Framebuffer.*)
 *(.gnu.linkonce.r.*)
 . = ALIGN(0x4); 

 *(Nemagfx_Stencil_Buffer Nemagfx_Stencil_Buffer.*)
 *(.gnu.linkonce.r.*)
 . = ALIGN(0x4); 

 *(Nemagfx_Memory_Pool_Buffer Nemagfx_Memory_Pool_Buffer.*)
 *(.gnu.linkonce.r.*)
 . = ALIGN(0x4);
 } >RAM
.
.
.

.
.
.
}

 

The STM32H745BI has 2MBytes of internal flash so you have enough to put a full framebuffer in it, maybe enough for a double depending on your display resolution and color precision:

GaetanGodart_0-1742984732505.png

 

We also have a STM32H750-DK TBS that you could look at but we use external memory for this one.

 

Regards,

3 replies

jumman_JHINGA
Senior III
March 26, 2025

i think you want to store frame buffer of TouchGFX in the internal RAM... if im correct then you need to change Buffer location Frome By Adress to by alloaction. if there is no linker script present for Frame Buffer then controller will automatically allocate this buffer to D1 or D2 RAM .

But if your using internal memory for frame buffer then you should avoid taking images with large size in TouchGFX designer, frame buffer size is dependent on your LTDC parameters in some cases buffer size wont get fitted into internal RAM. 

 

GaetanGodart
GaetanGodartBest answer
Technical Moderator
March 26, 2025

Hello @NguyenAnhHieu_ ,

 

Since your board is not working yet, we recommend you to disable the DCache for the moment and to set it up once you have a working project.

It is also recommended to keep the buffer location as "By allocation" to let TouchGFX choose where to put it.
Then, in your linker script you can tell that you want the framebuffer in the internal RAM.
We put the framebuffer in internal RAM on the STM32U5G9J-DK2 TBS so you can look how we did that :

MEMORY
{
 RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 3008K
 FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 4096K
 EXT_FLASH (r) : ORIGIN = 0xA0000000, LENGTH = 128M
}

/* Sections */
SECTIONS
{
.
.
.

.
.
.
FramebufferSection (NOLOAD) :
 {
 *(TouchGFX_Framebuffer TouchGFX_Framebuffer.*)
 *(.gnu.linkonce.r.*)
 . = ALIGN(0x4); 

 *(Nemagfx_Stencil_Buffer Nemagfx_Stencil_Buffer.*)
 *(.gnu.linkonce.r.*)
 . = ALIGN(0x4); 

 *(Nemagfx_Memory_Pool_Buffer Nemagfx_Memory_Pool_Buffer.*)
 *(.gnu.linkonce.r.*)
 . = ALIGN(0x4);
 } >RAM
.
.
.

.
.
.
}

 

The STM32H745BI has 2MBytes of internal flash so you have enough to put a full framebuffer in it, maybe enough for a double depending on your display resolution and color precision:

GaetanGodart_0-1742984732505.png

 

We also have a STM32H750-DK TBS that you could look at but we use external memory for this one.

 

Regards,

GaetanGodart
Technical Moderator
April 4, 2025

Hello @NguyenAnhHieu_ ,

 

Have you been able to move forward on your project?

 

Regards,

Associate II
April 4, 2025

Thanks for your help but it was hard to handle and luckily the RAM and Flash components arrived. But there was a problem with configuring the external memory, I asked more here:https://community.st.com/t5/stm32cubeide-mcus/how-to-adjust-ram-and-flash-memory-area/td-p/790319