Skip to main content
Associate III
May 7, 2024
Solved

Using FontFlashSection in QSPI Flash Memory

  • May 7, 2024
  • 4 replies
  • 3798 views

Hello,

I've created a test touchGFX project for stm32h747i-disco by using TouchGFX Designer-4.21.4. It has only one screen that has one background image and one text. You can see it below:

Screenshot_1.png

When I generate the code by using TouchGFX Designer-4.21.4 and when I compile and download it with stm32CubeIDE, it works without any problem. 

But when I write this linker code to move FontFlashSection into QSPI flash memory, it stucks in the ErrorHandler.

 

FontFlashSection :
{
	*(FontFlashSection FontFlashSection.*)
	*(.gnu.linkonce.r.*)
 . = ALIGN(0x4);
} >QSPI

 

image.png

ExtFlashSection, FontSearchFlashSection and TextFlashSection work in the QSPI flash memory without any problem. But when I add FontFlashSection as well to the QSPI Flash, the code somehow stucks in the ErrorHandler. 

 

What else should I do to use FontFlashSection in QSPI Flash memory? What am I missing? Can you help me for this? I need to use FontFlashSection in the QSPI Flash memory. Thank you for the answers :)

Best answer by MM..1

As i said, this sentence in linker script set in code address for reading fonts from RAM, but RAM is empty after sw start, because system loader not preload from QSPI. This must do your code in main before use fonts...

Simply after init QSPI memcpy fontsize area to ram choiced in ld.

4 replies

GökhanAuthor
Associate III
May 7, 2024

Do you have any suggestion for this?

Tesla DeLorean
Guru
May 7, 2024

Not sure

If you can track down what's calling Error_Handler() it might shed some light on the issue.

HardFault_Handler() might occur if the memory isn't properly mapped when data is copied out of it.

Perhaps there are some DISCO/EVAL examples using the fonts, and you might be able to check the linker scripts there, or the ELF file construction.

The H747I-DISCO should have it's External Loader, so the data should be in memory successfully.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
GökhanAuthor
Associate III
May 9, 2024

Thank you for the answer. I tracked down in the code. After the function being called below, it goes to the ErrorHandler.

const uint8_t* GeneratedFont::getPixelData(const GlyphNode* glyph) const
{
 const uint8_t* const* table = (const uint8_t* const*)glyphData;
 return &(table[glyph->unicode / 2048][glyph->dataOffset]);
}

Also, I have checked some of the TouchGFX examples for the stm32h747i-disco. Unfortunately, FontFlashSection is being used in internal flash memory in these examples.

 

 

MM..1
Chief III
May 9, 2024

Seems long problem based on somethink in lib and adressing in memory. Read FontFlashSection in memory mapped SDRAM - STMicroelectronics Community

And if your font info is short try store it in QSPI, but load into some RAM unused segment for example ITCM in linker script...

GökhanAuthor
Associate III
May 10, 2024

It works!!! Thank you so much :)

karsparskambala
Associate II
October 11, 2024

Hi, this topic helped a lot. Thanks to both of you. I am trying to integrate TouchGFX into Zephyr and am having problems with the fonts. Do you have any idea what might be the reason?

 

karsparskambala_0-1728659107365.png