2025-08-24 10:39 PM
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
Solved! Go to Solution.
2025-08-27 7:57 AM
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.
2025-08-27 7:27 AM
Hello @devanshu5,
This post has been escalated to the ST Online Support Team for additional assistance. We'll contact you directly.
Best regards,
Lina
2025-08-27 7:57 AM
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.
2025-09-10 2:06 AM
Thank you for your response. We ended up using a different approach but in principle it matches with what you suggested.
2025-09-10 2:10 AM
@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.