cancel
Showing results for 
Search instead for 
Did you mean: 

Inconsistent use of TEXT_LOCATION_FLASH_ATTRIBUTE breaks OTA asset binary sharing

grisa199678
Associate

We are implementing a software-driven OTA update system using TouchGFX and a 64MB external QSPI flash. We store the following asset sections in QSPI:

  • ExtFlashSection

  • FontFlashSection

  • TextFlashSection

These are bundled into an ExternalFlash.bin asset file, which should be shared between firmware partitions (A/B). Since the data contains only static assets, it must remain bank-independent for OTA to work properly.

 

Problem:

In the generated TypedTextDatabase.cpp, the following array is incorrectly marked with TEXT_LOCATION_FLASH_ATTRIBUTE:

TEXT_LOCATION_FLASH_PRAGMA
const touchgfx::TypedText::TypedTextData* const typedTextDatabaseArray[] TEXT_LOCATION_FLASH_ATTRIBUTE = {
    typedText_database_GB,
    typedText_database_ESP
};

This array is placed into TextFlashSection, which is part of ExternalFlash.bin. However, the array contains pointers to other flash-resident data (typedText_database_GB, etc.), which are already placed correctly in TextFlashSection.

Storing the array itself in flash causes absolute addresses to be written into ExternalFlash.bin, which ties it to the current firmware bank — defeating OTA partition independence.

 

Inconsistency in Code Generation:

This issue appears to be a code generation oversight, because in other sections (e.g., ExtFlashSection, FontFlashSection), the generated arrays do not use TEXT_LOCATION_FLASH_ATTRIBUTE. For example:

const touchgfx::Font* const fontList[] = {
    &font_roboto_16_4bpp,
    &font_roboto_24_4bpp
};

These arrays are placed in RAM, and only reference data located in external flash — which is the correct and expected behavior.

So, it's clear this is not a design choice, but a developer inconsistency in how typedTextDatabaseArray is handled.

 

 

Proposed Fix:

Remove the TEXT_LOCATION_FLASH_ATTRIBUTE (and pragma) from the array declaration in TypedTextDatabase.cpp:

const touchgfx::TypedText::TypedTextData* const typedTextDatabaseArray[] = {
    typedText_database_GB,
    typedText_database_ESP
};

With this fix:

  • The array is stored in RAM (in firmware partition A or B)

  • It references data in external flash (QSPI-mapped)

  • The asset binary remains bank-independent

Target Setup:

  • MCU: STM32F769NIHx

  • Board: STM32F769I-DISCO

  • TouchGFX Version: 4.24.2

  • External Flash: 64MB QSPI

  • Asset Sections Used: ExtFlashSection, FontFlashSection, TextFlashSection

1 ACCEPTED SOLUTION

Accepted Solutions

Hello Ciobanu

This makes sense. I will make a bug report on this for future versions.

You can fix this in your code if you want.

In the file: touchgfx/framework/tools/textconvert/Templates/TypedTextDatabase.cpp.temp

Either do this in your installation (c:/TouchGFX/4.24.x/ typically) or in the Middlewares/ST/TouchGFX folder in a specific project.

After the modification, delete the generated/texts folder and generate code again.

Another way is to modify the Makefile to remove the line (using perl or sed or a more modern tool) after each code generation or before compilation.

Best Regards

 

 

View solution in original post

2 REPLIES 2

Hello Ciobanu

This makes sense. I will make a bug report on this for future versions.

You can fix this in your code if you want.

In the file: touchgfx/framework/tools/textconvert/Templates/TypedTextDatabase.cpp.temp

Either do this in your installation (c:/TouchGFX/4.24.x/ typically) or in the Middlewares/ST/TouchGFX folder in a specific project.

After the modification, delete the generated/texts folder and generate code again.

Another way is to modify the Makefile to remove the line (using perl or sed or a more modern tool) after each code generation or before compilation.

Best Regards

 

 

Hello Flemming,
 
Will apply the temporary solution described.
Looking forward for the next version to be released and migrate to it.
 
Thank you for the patience and feedback.
 
Wish you a great week and holidays.

Grigore