cancel
Showing results for 
Search instead for 
Did you mean: 

TouchGFX Code optimization for Size

wasi785
Associate II

Hi, I am working on the Touchgfx Version4.21.0 and STM32CubeIDE Version 1.11.2

Existing Config: Flash Memory : 2MB RAM: 512KB

We have 14 Screens Its consuming Memory around 79.72%.

Still We have to Add 4 to 5 more screens after adding those Its Increases upto 99%, due to memory limitations we are not able to Add those screens.

Can You Please Provide the best Solution to reduce the memory consumption.

Attached the File "memory_consumption_by_file.txt" of Table for reference to Memory Consumption by generated and written code files. Excluded Generated Fonts, Images and Texts Code as Its configured to store in External Memory.

 

4 REPLIES 4
JTP1
Lead

Hello

Have you allready set optimization to 'optimize for size' in G++ compiler settings ? It makes big difference in most cases.

Br JTP

Hi, Thanks for the Reply.

We have not set the Optimization level to 'optimize for size' in G++ compiler settings.

After setting the Optimization level to -Os (Optimization for size), Its minimizing the memory usage, But We are facing some Issues, like We have to erase the external memory first and Program the board 2 or 3 times, then It works.

Do you have any best configuration in (-Os) Optimaztion for Size, which will not affect functionality of the code.

 

What board do you need to program 2 or 3 times for a binary to stick? Sounds like an issue with the programming process or loaders that you need to fix.

Optimization catches a lot of latent coding issues, if you need the code and data sizes to shrink you need the optimizer to be able to do it's job, focus on fixing your code so it's correct and robust.

Set warning levels very high and understand what code has the most issues. Perhaps run it through static analysis tools to identify coding issues and styles which lead to errors in logic and functionality.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
wasi785
Associate II

I am sorry for the late reply.  

We have 7 inch LCD Board with Microcontroller STM32H745BIT. that we need to Program.

Programming process and external loader works well.

I will try with Optimization and by setting warning levels high and run it through static analysis tools.

Thanks.