Skip to main content
Associate III
June 18, 2024
Solved

Why the touchgfx framebuffer goes into flash?

  • June 18, 2024
  • 2 replies
  • 2830 views

I made a touchgfx project by CubeIDE,when I choose touchgfx framebuffer by allocation,after build ,the framebuffer is placed into flash,then ram.I wonder why.

Best answer by ferro

Hi @amb ,

It seems to be located at RAM 0x2001b0 right ? I guess the issue is that it is initialized by C++ RTE. The frame buffers needs to be marked by some gcc speciofic __attribute__, hm is it 'noinit' ?

[Edit]

https://www.nongnu.org/avr-libc/user-manual/mem_sections.html

The .noinit Section

This sections is a part of the .bss section. What makes the .noinit section special is that variables which are defined as such:

int foo __attribute__ ((section (".noinit")));

will not be initialized to zero during startup as would normal .bss data.

 

[Edit 2]

I see file

\ST\touchgfx\framework\include\touchgfx\hal\Config.hpp

has many defines dealing with that sort of problems. It is a jungle and I run simulation so cant check with embedded toolchain.

2 replies

mƎALLEm
Technical Moderator
June 18, 2024

Hello,

The framebuffer needs to be in the RAM (either internal or external). But how you did conclude that the frame buffer is located in the Flash? Which board are you using? ST or custom board? which MCU?

Need to provide more details, so TouchGFX expert(s) could help you.

"To give better visibility on the answered topics, please click on ""Accept as Solution"" on the reply which solved your issue or answered your question."
ambAuthor
Associate III
June 18, 2024

this is the memory details form CubeIDE.

20240618224152.jpg

this is touchgfx settings

微信截图_20240618224550.jpg

ferro
ferroBest answer
Lead
June 20, 2024

Hi @amb ,

It seems to be located at RAM 0x2001b0 right ? I guess the issue is that it is initialized by C++ RTE. The frame buffers needs to be marked by some gcc speciofic __attribute__, hm is it 'noinit' ?

[Edit]

https://www.nongnu.org/avr-libc/user-manual/mem_sections.html

The .noinit Section

This sections is a part of the .bss section. What makes the .noinit section special is that variables which are defined as such:

int foo __attribute__ ((section (".noinit")));

will not be initialized to zero during startup as would normal .bss data.

 

[Edit 2]

I see file

\ST\touchgfx\framework\include\touchgfx\hal\Config.hpp

has many defines dealing with that sort of problems. It is a jungle and I run simulation so cant check with embedded toolchain.

Osman SOYKURT
Technical Moderator
June 20, 2024

Hello @amb,

Could you share with us your linker script? 

Osman SOYKURTST Software Developer | TouchGFX
ambAuthor
Associate III
June 20, 2024

/*

******************************************************************************

**

** File : LinkerScript.ld

**

** Author : STM32CubeIDE

**

** Abstract : Linker script for STM32U599xJ Device from STM32U5 series

** 4096Kbytes FLASH

** 2512Kbytes RAM

**

** Set heap size, stack size and stack location according

** to application requirements.

**

** Set memory bank area and size if external memory is used.

**

** Target : STMicroelectronics STM32

**

** Distribution: The file is distributed as is without any warranty

** of any kind.

**

*****************************************************************************

** @attention

**

** Copyright (c) 2024 STMicroelectronics.

** All rights reserved.

**

** This software is licensed under terms that can be found in the LICENSE file

** in the root directory of this software component.

** If no LICENSE file comes with this software, it is provided AS-IS.

**

*****************************************************************************

*/

 

/* Entry Point */

ENTRY(Reset_Handler)

 

/* Highest address of the user mode stack */

_estack = ORIGIN(RAM) + LENGTH(RAM); /* end of "RAM" Ram type memory */

 

_Min_Heap_Size = 0x200; /* required amount of heap */

_Min_Stack_Size = 0x400; /* required amount of stack */

 

/* Memories definition */

MEMORY

{

RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 2496K

SRAM4 (xrw) : ORIGIN = 0x28000000, LENGTH = 16K

FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 4096K

}

 

/* Sections */

SECTIONS

{

/* The startup code into "FLASH" Rom type memory */

.isr_vector :

{

KEEP(*(.isr_vector)) /* Startup code */

} >FLASH

 

/* The program code and other data into "FLASH" Rom type memory */

.text :

{

*(.text) /* .text sections (code) */

*(.text*) /* .text* sections (code) */

*(.glue_7) /* glue arm to thumb code */

*(.glue_7t) /* glue thumb to arm code */

*(.eh_frame)

 

KEEP (*(.init))

KEEP (*(.fini))

 

_etext = .; /* define a global symbols at end of code */

} >FLASH

 

/* Constant data into "FLASH" Rom type memory */

.rodata :

{

*(.rodata) /* .rodata sections (constants, strings, etc.) */

*(.rodata*) /* .rodata* sections (constants, strings, etc.) */

} >FLASH

 

.ARM.extab (READONLY) : /* The READONLY keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */

{

*(.ARM.extab* .gnu.linkonce.armextab.*)

} >FLASH

.ARM (READONLY) : /* The READONLY keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */

{

__exidx_start = .;

*(.ARM.exidx*)

__exidx_end = .;

} >FLASH

 

.preinit_array (READONLY) : /* The READONLY keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */

{

PROVIDE_HIDDEN (__preinit_array_start = .);

KEEP (*(.preinit_array*))

PROVIDE_HIDDEN (__preinit_array_end = .);

} >FLASH

 

.init_array (READONLY) : /* The READONLY keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */

{

PROVIDE_HIDDEN (__init_array_start = .);

KEEP (*(SORT(.init_array.*)))

KEEP (*(.init_array*))

PROVIDE_HIDDEN (__init_array_end = .);

} >FLASH

 

.fini_array (READONLY) : /* The READONLY keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */

{

PROVIDE_HIDDEN (__fini_array_start = .);

KEEP (*(SORT(.fini_array.*)))

KEEP (*(.fini_array*))

PROVIDE_HIDDEN (__fini_array_end = .);

} >FLASH

 

/* Used by the startup to initialize data */

_sidata = LOADADDR(.data);

 

/* Initialized data sections into "RAM" Ram type memory */

.data :

{

_sdata = .; /* create a global symbol at data start */

*(.data) /* .data sections */

*(.data*) /* .data* sections */

*(.RamFunc) /* .RamFunc sections */

*(.RamFunc*) /* .RamFunc* sections */

 

_edata = .; /* define a global symbol at data end */

} >RAM AT> FLASH

 

/* Uninitialized data section into "RAM" Ram type memory */

.bss :

{

/* This is used by the startup in order to initialize the .bss section */

_sbss = .; /* define a global symbol at bss start */

__bss_start__ = _sbss;

*(.bss)

*(.bss*)

*(COMMON)

 

_ebss = .; /* define a global symbol at bss end */

__bss_end__ = _ebss;

} >RAM

 

/* User_heap_stack section, used to check that there is enough "RAM" Ram type memory left */

._user_heap_stack :

{

. = ALIGN(8);

PROVIDE ( end = . );

PROVIDE ( _end = . );

. = . + _Min_Heap_Size;

. = . + _Min_Stack_Size;

. = ALIGN(8);

} >RAM

 

/* Remove information from the compiler libraries */

/DISCARD/ :

{

libc.a ( * )

libm.a ( * )

libgcc.a ( * )

}

 

.ARM.attributes 0 : { *(.ARM.attributes) }

}