cancel
Showing results for 
Search instead for 
Did you mean: 

External vs. internal flash memory for touchGFX assets

HP
Senior III

When developing touchGFX applications you tend to get a pretty high memory need.

I'm working with the CubeIDE integration of TouchGFX and tried to add a third screen (with a third background image). I got an error saying that the application would not fit in my FLASH.

After a bit of digging it seems that the linker files don't mention the QSPI at all.

I can add that to the linker files but I would like to know if there is an official way of doing this?

I found some documentation on this but I'm not sure if this is the right way to go about it.

What goes where in the memory and how do I control it? if at all?

Thanks!

40 REPLIES 40

Thanks for that info! I will try that out. I might come back with more questions if I can't figure it out 😉

Here's some code taken a bit out of context to explain it - I think you'll get the idea.

uint16_t frameBuffer[480 * 272];
static uint32_t frameBuf0 = (uint32_t)& frameBuffer[0];
...
//Init layer with address
BSP_LCD_LayerInit(0, frameBuf0);
...
//Init touchgfx with address
hal.setFrameBufferStartAddress((uint16_t*)frameBuf0, 16, ...);

HP
Senior III

Just to close this one up I have made a video guide on how to configure the F746 DISCO board for external memory use.

You can find it here:

https://youtu.be/237lPdMsDZs

Well, I got it working (I think)

but I had to disable double buffering and animation storage.

So while possible on the F746 MCU it seems like a bad idea to use up all the memory on the framebuffer. Thanks anyway for the hints, it was very easy to test out 🙂

Awesome, thanks!

Yep, on "large" screens it's generally not a good idea since you'll be using up all your internal memory on framebuffers. It's mostly for projects with cost constraints (no external memory), large enough internal memory and perhaps a small screen.

We've got some exciting features coming, not yet released, where you can have a combination of partial framebuffer and L8 pallette in order to minimize the memory you use for framebuffer at the cost of some performance. But for a lot of low cost applications that's perfectly fine and feasible since they may not have complex guis.

/Martin

kjtl
Associate II

Hi,

I have tried to follow your video tutorial. I'm also on a disco-F746G board. At the point where you acheive 0 errors after excluding all the simulator folders/files, and setting up the include paths, I'm still receiving this error.

In file included from ../Src/main.cpp:23:0:
../Src/main.cpp: In function 'int main()':
../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS/cmsis_os.h:470:54: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
 { #name, (thread), (priority), (instances), (stacksz)}
                                                      ^
../Src/main.cpp:193:3: note: in expansion of macro 'osThreadDef'
   osThreadDef(defaultTask, StartDefaultTask, osPriorityNormal, 0, 4096);
   ^~~~~~~~~~~
 
   C:/Cube_Project/Elevator_new/Debug/../Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers_cmsis.cpp:18: multiple definition of `touchgfx::OSWrappers::initialize()'
Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers.o:C:/Cube_Project/Elevator_new/Debug/../Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers.cpp:18: first defined here
Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers_cmsis.o: In function `touchgfx::OSWrappers::takeFrameBufferSemaphore()':
C:/Cube_Project/Elevator_new/Debug/../Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers_cmsis.cpp:30: multiple definition of `touchgfx::OSWrappers::takeFrameBufferSemaphore()'
Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers.o:C:/Cube_Project/Elevator_new/Debug/../Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers.cpp:25: first defined here
Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers_cmsis.o: In function `touchgfx::OSWrappers::giveFrameBufferSemaphore()':
C:/Cube_Project/Elevator_new/Debug/../Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers_cmsis.cpp:36: multiple definition of `touchgfx::OSWrappers::giveFrameBufferSemaphore()'
Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers.o:C:/Cube_Project/Elevator_new/Debug/../Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers.cpp:29: first defined here
Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers_cmsis.o: In function `touchgfx::OSWrappers::tryTakeFrameBufferSemaphore()':
C:/Cube_Project/Elevator_new/Debug/../Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers_cmsis.cpp:42: multiple definition of `touchgfx::OSWrappers::tryTakeFrameBufferSemaphore()'
Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers.o:C:/Cube_Project/Elevator_new/Debug/../Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers.cpp:34: first defined here
Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers_cmsis.o: In function `touchgfx::OSWrappers::giveFrameBufferSemaphoreFromISR()':
C:/Cube_Project/Elevator_new/Debug/../Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers_cmsis.cpp:48: multiple definition of `touchgfx::OSWrappers::giveFrameBufferSemaphoreFromISR()'
Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers.o:C:/Cube_Project/Elevator_new/Debug/../Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers.cpp:39: first defined here
Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers_cmsis.o: In function `touchgfx::OSWrappers::signalVSync()':
C:/Cube_Project/Elevator_new/Debug/../Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers_cmsis.cpp:54: multiple definition of `touchgfx::OSWrappers::signalVSync()'
Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers.o:C:/Cube_Project/Elevator_new/Debug/../Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers.cpp:48: first defined here
Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers_cmsis.o: In function `touchgfx::OSWrappers::waitForVSync()':
C:/Cube_Project/Elevator_new/Debug/../Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers_cmsis.cpp:62: multiple definition of `touchgfx::OSWrappers::waitForVSync()'
Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers.o:C:/Cube_Project/Elevator_new/Debug/../Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers.cpp:60: first defined here
Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers_cmsis.o: In function `touchgfx::OSWrappers::taskDelay(unsigned short)':
C:/Cube_Project/Elevator_new/Debug/../Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers_cmsis.cpp:74: multiple definition of `touchgfx::OSWrappers::taskDelay(unsigned short)'
Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers.o:C:/Cube_Project/Elevator_new/Debug/../Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers.cpp:69: first defined here
Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers_cmsis.o: In function `vApplicationStackOverflowHook':
C:/Cube_Project/Elevator_new/Debug/../Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers_cmsis.cpp:104: multiple definition of `vApplicationStackOverflowHook'
Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers.o:C:/Cube_Project/Elevator_new/Debug/../Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers.cpp:91: first defined here
Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers_cmsis.o: In function `vApplicationMallocFailedHook':
C:/Cube_Project/Elevator_new/Debug/../Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers_cmsis.cpp:110: multiple definition of `vApplicationMallocFailedHook'
Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers.o:C:/Cube_Project/Elevator_new/Debug/../Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers.cpp:97: first defined here
Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers_cmsis.o: In function `vApplicationIdleHook':
C:/Cube_Project/Elevator_new/Debug/../Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers_cmsis.cpp:115: multiple definition of `vApplicationIdleHook'
Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers.o:C:/Cube_Project/Elevator_new/Debug/../Middlewares/ST/TouchGFX/touchgfx/os/OSWrappers.cpp:102: first defined here
c:\st\stm32cubeide_1.0.2\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.0.0.201904181610\tools\arm-none-eabi\bin\ld.exe: Elevator_new.elf section `ExtFlashSection' will not fit in region `FLASH'
c:\st\stm32cubeide_1.0.2\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.7-2018-q2-update.win32_1.0.0.201904181610\tools\arm-none-eabi\bin\ld.exe: region `FLASH' overflowed by 146048 bytes
collect2.exe: error: ld returned 1 exit status

Any suggestions as to how I can fix this?

Many thanks,

K

HP
Senior III

you'll have to look at you linker script again. the error says that the ExtFlashSection will not fit in the region 'FLASH' which means that you're still pointing it at the internal memory and not the QSPI as you intended.

kjtl
Associate II

Apologies, I may have posted this in the wrong thread.

I am unable to compile the project after following the tutorial posted byMartin on TGFX and CubeIDE integration. I am also a noob and have no idea how to edit the linker script. What might be the reason he is able to compile without doing so? Is it due to the size of my TGFX project?

Thanks for bearing with me.

HP
Senior III

yes, that's exactly the reason. if you use a full background image from the designer, they take up 255kB each. combine that with buttons and other fun stuff you quickly run out of memory!

i've made a couple of videos on the process of integrating TouchGFX into CubeIDE - maybe they can be of some help? look for the selected answer in this very thread 🙂