2019-10-31 06:12 AM
Hello,
I want to calculate RAM requirement for one screen with some widgets and images.How can this be done.
Solved! Go to Solution.
2019-11-04 01:39 AM
Hi @ananya,
Here's a way of calculating the size of both worst case View (including widgets) + Presenter or just the size for any screen you want. Then you have some memory for OS / Heap potentially.
int main(int argc, char** argv)
{
....
// Print out size information
printf("*** Memory usage: ***\r\n");
printf("Largest view %lu\r\n", (long unsigned int) sizeof(FrontendHeap::MaxViewType));
printf("Largest presenter %lu\r\n", (long unsigned int) sizeof(FrontendHeap::MaxPresenterType));
printf("Datamodel %lu\r\n", (long unsigned int) sizeof(Model));
printf("Total: %lu\r\n", (long unsigned int) sizeof(FrontendHeap));
printf("*** Screens: ***\r\n");
printf("MyView%lu\r\n", (long unsigned int) sizeof(MyView));
...
}
This code can be run in the simulator.cpp main() method.
/Martin
2019-11-04 01:39 AM
Hi @ananya,
Here's a way of calculating the size of both worst case View (including widgets) + Presenter or just the size for any screen you want. Then you have some memory for OS / Heap potentially.
int main(int argc, char** argv)
{
....
// Print out size information
printf("*** Memory usage: ***\r\n");
printf("Largest view %lu\r\n", (long unsigned int) sizeof(FrontendHeap::MaxViewType));
printf("Largest presenter %lu\r\n", (long unsigned int) sizeof(FrontendHeap::MaxPresenterType));
printf("Datamodel %lu\r\n", (long unsigned int) sizeof(Model));
printf("Total: %lu\r\n", (long unsigned int) sizeof(FrontendHeap));
printf("*** Screens: ***\r\n");
printf("MyView%lu\r\n", (long unsigned int) sizeof(MyView));
...
}
This code can be run in the simulator.cpp main() method.
/Martin
2019-11-04 04:22 AM
When I tried with the above in the main function, I got the following error in IAR.
Error[Pe070]: incomplete type is not allowed
Error[Pe070]: incomplete type is not allowed
Error[Pe070]: incomplete type is not allowed
2019-11-04 04:32 AM
You'd do this for the simulator main.cpp only. The simulator application will output the sizes in a terminal. You won't get anything out of printf in IAR.
/Martin
2020-01-03 02:45 AM
Hi @Martin KJELDSEN ,
When we want to calculate the RAM memory required for GUI,should we consider sum of all the screens' memory requirement?
How should it be calculated?
2020-01-03 01:20 PM
Martin,
Is there a strategy for managing memory for late bound widgets?
I have an application that I would like to allow my users to define their screens by allowing them to load/drop widgets dynamically at runtime. Those dynamically added widgets will then be stored on the SD Card as a file for the next running/startup.
So, basically the screens (pages of a swipe container) will be empty at compile time when TouchGFX tries to decide my Heap size it will be less than needed. I'm guessing I will adjust that for a reasonable heap size, then readjust based on how many widgets the customer drops on the screens?