Skip to main content
Associate II
August 25, 2025
Solved

How to map code generated by TouchGFX to external flash for XIP

  • August 25, 2025
  • 2 replies
  • 979 views

Hi,

We have a STM32H7B3 which uses TouchGFX (4.25.0) for GUI with external flash for storing images, texts, fonts etc. The storing and reding of images, text, fonts from external flash works fine for us in our current product. In a new design we want the code generated by TouchGFX to also be stored on external flash and be XIP from external flash. How can I make TocuhGFX map the code that it generates to external flash. There is a lot of code that gets generated and manually using the __attribute__((section("ExtFlashSection"))) for each function is not possible. Please help how this can be achieved with TouchGFX software.

Regards,

Devanshu Agarwal

Best answer by mƎALLEm

Hello,

This is something that needs to be managed with the linker script file of your project and not at TouchGFX level.

I'm inspiring from this package: X-CUBE-PERF-H7: / Linker file you need to refer to: STM32H743I_EVAL\stm32h7x3_cpu_perf\SW4STM32\8 - D1_QuadSPI_Single - D1_DTCM\8 - D1_QuadSPI_Single - D1_DTCM.ld

So in your project try to add the files you need to execute from the external flash as the following in the ExtFlashSection section:

 ExtFlashSection :
	{
 . = ALIGN(0x4); /* need to test with and without this line */
 *file1.o (.text .text*) /*example main.o */
 *file2.o (.text .text*)
 .
 .
		*(ExtFlashSection ExtFlashSection.*)
		*(.gnu.linkonce.r.*)
 . = ALIGN(0x4);
	} >QUADSPI

But executing the code while fetching the graphic assets from the same memory may introduce some performance drop due to the access contention between CPU/LTDC to the memory.

PS: need to test with and without  the first ". = ALIGN(4);" line.

Hope that helps.

2 replies

Lina_DABASINSKAITE
Community Manager
August 27, 2025

Hello @devanshu5,

This post has been escalated to the ST Online Support Team for additional assistance. We'll contact you directly.

Best regards,
Lina

​In order 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.
mƎALLEm
mƎALLEmBest answer
Technical Moderator
August 27, 2025

Hello,

This is something that needs to be managed with the linker script file of your project and not at TouchGFX level.

I'm inspiring from this package: X-CUBE-PERF-H7: / Linker file you need to refer to: STM32H743I_EVAL\stm32h7x3_cpu_perf\SW4STM32\8 - D1_QuadSPI_Single - D1_DTCM\8 - D1_QuadSPI_Single - D1_DTCM.ld

So in your project try to add the files you need to execute from the external flash as the following in the ExtFlashSection section:

 ExtFlashSection :
	{
 . = ALIGN(0x4); /* need to test with and without this line */
 *file1.o (.text .text*) /*example main.o */
 *file2.o (.text .text*)
 .
 .
		*(ExtFlashSection ExtFlashSection.*)
		*(.gnu.linkonce.r.*)
 . = ALIGN(0x4);
	} >QUADSPI

But executing the code while fetching the graphic assets from the same memory may introduce some performance drop due to the access contention between CPU/LTDC to the memory.

PS: need to test with and without  the first ". = ALIGN(4);" line.

Hope that helps.

"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."
devanshu5Author
Associate II
September 10, 2025

Thank you for your response. We ended up using a different approach but in principle it matches with what you suggested.

mƎALLEm
Technical Moderator
September 10, 2025

@devanshu5 wrote:

Thank you for your response. We ended up using a different approach but in principle it matches with what you suggested.


Hello,

Thank you for the reply. As the comment guided you to the solution, please accept it as solution.

"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."