cancel
Showing results for 
Search instead for 
Did you mean: 

Using any type of text causes HardFault

HMehr.14
Associate II

Hello,

I followed this guide (https://touchgfx.zendesk.com/hc/en-us/articles/115002741432-Create-custom-Application-Template) to adding TouchGFX to my existing project.

I'm working with IAR 8.30.1 and tgfx 4.10.0 and STM32F429ZG and FreeRTOS V9.0.0 ( with `heap_4.c` as memory manager ).

Everything works well now, except texts. Every time I added components that contain text, Hard Fault occurs during redraw (*.invalidate()) it.

I added 

virtual void handleTickEvent() { container.invalidate(); }

to my ScreenView class to verifying DMA2D and LTDC configurations. All components work well. But existing just a text component causes HardFault.

By tracking `LR` and `PC`, I find out that HardFault occures in `TextProvider` class.

I think stack corrupted. Due to often times, `PC` is in the `DataSection`.

I increased the stack size of my GUI task and `configTOTAL_HEAP_SIZE` of FreeRTOS configuration, But results not changed. Is there any other stack size ( or heap size ) limitation?

Or, May I has been configured `BoardConfiguration.cpp`, `STM32F4DMA.cpp` or `STM32F4HAL.cpp` in a wrong way ?

For more details :

0690X000008BDbFQAW.png

Please share your suggestions about my problem with me.

Thanks in advance.

34 REPLIES 34
ASmer.1
Associate II

Martin,

I didn't have time to further investigate the issue, however QSPI is initialized before TGFX. I have all assets including fonts in external memory. I believe RPipi is correct that something is being messed up as widgets are added removed. All worked well - including texts in external flash- fo certain point (lets say 8 text area's) Adding one more caused HT. Removing added area didn't cure the issue. Only removing all text area's got rid of HT. For now i left text in internal flash. Will have closer look at it when time allows.

Okay, let me know. You can just post to this thread and i'll try to help.

I have the same exact behavior. All assets work fine in External QSPI memory. Bitmaps, fonts, etc. But as soon as I add a single TextArea widget, I get a HardFault. When removing the QSPI directive from the linker, and placing text in the internal flash, all works. I'm really at a loss on this one and haven't seen much in the way of helpful hints.

 

I had the same problem. My solution was to use the "Unmapped storage format" in the TouchGFX Designer.

MSecr.1
Associate III

I was facing that specific issue due to a stack overflow, so make sure you allocated enough memory for the stack