Skip to main content
justin11
Senior
October 25, 2024
Solved

TouchGFX Crash with multiple text boxes

  • October 25, 2024
  • 4 replies
  • 3029 views

Hi,

I have a custom board project which I have been running for over a year and im looking to add some features to the layout. The screen is a 240x320 layout and the MCU is a STM32H757. I am running touch GFX 4.20 and it will be difficult for me to upgrade from this due to the ties within the cubide and code base.

Im looking to add a page with multiple test boxes,as i need to update sensor readings to the screen. Originally i built this in custom containers as i would normally, but it kept crashing on creating on the new page. So i have worked back making the page more and more simple untill i found a threashold of it occuring when i have 38 default text boxes on the screen (see pic), the text boxes have no buffers allocated to them and this is on a fresh screen so no functions or code running.

if i lower the number of text boxes to 34 its fine.

is this a limitation of 4.20 ?

I've tried increasing the canvas buffer and rtos heap and task memory but nothing resolves this crash (HardFault exception), i've attached the memory address in the diassembler.

 

 

Screenshot 2024-10-25 185641.png

justin11_0-1729879736002.png

 

Best answer by justin11

Im running an STM32H757 so i should have pleanty of RAM

I think i have managed to resolve this. I changed the following task buffer size. this was originally 1024. no changing it to 2048 i've not seen the crashes.

// frertos.c

uint32_t guiBuffer[2048]; // Increase buffer size for gui task

// Update thread definition for gui

osThreadStaticDef(gui, Gui_Task, osPriorityNormal, 0, 2048, guiBuffer, &guiControlBlock);

4 replies

ferro
Lead
October 25, 2024

Hi @justin11 , what does function call stack say ?

justin11
justin11Author
Senior
October 25, 2024

This is the call stack at the point it crashed

justin11_0-1729891184598.png

 

 

ferro
Lead
October 25, 2024

Thanks. This does not look familiar sorry. So is this the only screen you,ve got ? are you adding TextAreas in GfxDesigner so they are in Base class ? You mantioned heap so probably not.

justin11
justin11Author
Senior
October 25, 2024

justin11_1-1729891253995.png

 

ferro
Lead
October 25, 2024

72 == sizeof ( touchgfx::TextArea )

 

 

if i lower the number of text boxes to 34 its fine.

 

72*34 = 2448 bytes

So you are creating them on heap. Does this happen if you add them from an array of lets say 50 TextArea ?

ferro
Lead
October 28, 2024

When you link you app what does console say about ROM/RAM usage

ferro_1-1730145082168.png

justin11
justin11AuthorBest answer
Senior
October 28, 2024

Im running an STM32H757 so i should have pleanty of RAM

I think i have managed to resolve this. I changed the following task buffer size. this was originally 1024. no changing it to 2048 i've not seen the crashes.

// frertos.c

uint32_t guiBuffer[2048]; // Increase buffer size for gui task

// Update thread definition for gui

osThreadStaticDef(gui, Gui_Task, osPriorityNormal, 0, 2048, guiBuffer, &guiControlBlock);

ferro
Lead
October 29, 2024

Interesting that is happend with this specific screen - cannot see obvious reason for that as memory for screen objects is(should be) already alocated elsewhere, not on thread stack. Good to know.

There are some config options for freeRTOS to see how much/maximum of stack usage

configRECORD_STACK_HIGH_ADDRESS

configCHECK_FOR_STACK_OVERFLOW

uxTaskGetStackHighWaterMark