75 views
in System Integration by

Hello EW Team,

I am working on plotting graph with data received every 50ms from another device (iMXRT1060) using Device Object. I have checked the RAM usage (PFA image).
OBSERVATION 1: Graph is successfully plotted for first 6 tests. While executing 7th time, EwProcess() is not getting executed. Regarding Memory Allocation:

#define EW_FRAME_BUFFER_ADDR  DisplayInfo.FrameBuffer
#define EW_FRAME_BUFFER_SIZE  EW_FRAME_BUFFER_WIDTH * EW_FRAME_BUFFER_HEIGHT * EW_FRAME_BUFFER_DEPTH    //480*272*2 = 261,120
#define EW_DOUBLE_BUFFER_SIZE  EW_FRAME_BUFFER_SIZE        //480*272*2 = 261,120
#define EW_MEMORY_POOL_ADDR      DisplayInfo.MemoryPool
#define EW_MEMORY_POOL_SIZE      EW_FRAME_BUFFER_SIZE +  EW_FRAME_BUFFER_SIZE //480*272*2*2 

aDisplayInfo->FrameBuffer    = (void*)os_mem_alloc(EW_FRAME_BUFFER_SIZE);    // EW_FRAME_BUFFER_ADDR;
aDisplayInfo->DoubleBuffer   = (void*)os_mem_alloc(EW_DOUBLE_BUFFER_SIZE);    // EW_DOUBLE_BUFFER_ADDR;
aDisplayInfo->MemoryPool    = (void*)os_mem_alloc(EW_MEMORY_POOL_SIZE);    // EW_MEMORY_POOL_SIZE;

OBSERVATION 2: Graph is successfully plotted for first 13 tests. While executing 14th time, EwProcess() is not getting executed. Regarding Memory Allocation, only change is in Memory Pool Size:

#define EW_MEMORY_POOL_SIZE      EW_FRAME_BUFFER_SIZE +  EW_FRAME_BUFFER_SIZE +  EW_FRAME_BUFFER_SIZE //480*272*2*3

QUERY 1: How shall I check the Memory usage? As soon as I add

#ifdef EW_PRINT_MEMORY_USAGE
    EwPrintProfilerStatistic( 1 );
#endif

in my code, EwProcess() doesn't execute at all. However, I get the following in my Serial Logs, for first observation.

220909 12:56:35.38 GuiThread      OS_mem_alloc   : Alloc Size = 261120, 0x3fc00, at address 0x807da6e0
220909 12:56:35.38 GuiThread      OS_mem_alloc   : Alloc Size = 261120, 0x3fc00, at address 0x8081a300
220909 12:56:35.38 GuiThread      OS_mem_alloc   : Alloc Size = 522240, 0x7f800, at address 0x80859f20

QUERY 2: After plotting the graph, seems that data is still there in Device Object. If this is correct, then how should I free the memory allocated at the end of test so that fresh data is plotted; currently I am Clearing the screen using     ChartsCoordList_ClearList( &_this->CoordList ); at the end of test. Does it clears the memory allocated to DeviceObject?

Thanks in advance,

Vandana Matai

1 Answer

0 votes
by

Hi Vandana,

thank you for the provided explanations and observations - nevertheless, it is not still clear to me how your system initialization and your main loop are implemented.

First of all, I'm confused because the MemoryPool is not a member of the DisplayInfo structure. The DisplayInfo structure keeps the framebuffers, which can be allocated statically or (in your case) dynamically. The memory pool is the memory area that is given to the Embedded Wizard GUI application in order to manage the memory for the GUI application (Chora objects, graphical objects, strings, ...). This is provided typically as a static piece of memory, but it can be also allocated by an OS. In any case, the allocation of framebuffers and memory pools has to be done within the initialization of the system - in EwInit(). If you do that within EwProcess() - which represents the main loop of the GUI application - you will do further allocations with every call of EwProcess().

Can you check that and present your current implementation?

Furthermore, please make sure that the console outputs are working properly, then you can activate the monitoring of the RAM usage.

Concerning your second question: It is not clear to me, which memory you mean. If you are talking about Chora objects, then you do not have to care about freeing. All objects that are no more used are freed automatically by the GarbageCollection - for this purpose, the function EwReclaimMemory() of the Runtime Environment is called.

Let me know some more details about your tests.

Best regards,

Manfred.

 

 

 

by

Hello Manfred,

Here are the findings:

1. Added all #define from ewconfig.h in our code. Found that now halt is in 10th cycle. But still plotting is very slow. (updated ew_main.h @line 340 to 360 is attached in folder for reference). Also printed all the additional info.

2. Yes, I am sure. Although, there are two things to be mentioned, firstly, I am calling EwBspClockTickIncrement() from our 1ms_tick() function (ew_main.c @line 50). And secondly, updateProg_Counter() is called in our code every 50ms, while executing the test, to update X and Y coord (ew_main.c @line 400).

3. No, nothing is modified in /PlatformPackage. But in GeneratedCode/Application.c file, I have used one extern boolean variable for clearing the graph plot at the end of every result (Application.c @line 216).

4. PFA  Folder which has:

4.1 Project Created in EW

4.2 Used Code in our Project (generatedCode, PlatformPackage, ew_main.h and ew_main.c)

4.3 Two text docx of Log; ew_query7 which has Error Code 10 and ew_query8 which as Error Code3,4 observed after adding configuration as mentioned by you in point 1.

 

Thanks & Regards,

Vandana Matai

by

Hi Vandana,

it is very difficult to give you helpful support... Overall, I'm not very happy with the status of the project - for several reasons:

1.) The approach that you have chosen to draw the graph is several years old - the example you have used is neither part of the installed examples nor part of the Build Environment. The Charts::Graph class is only for compatibility - but no more recommended for new developments. Let me recommend to use vector graphics - see Stroked Path and Path Data. Of course, the current implementation should work also and I'm sure this is not the root cause. But anyhow, for a new development vector graphics is the better choice.

2.) Manual modifications in the generated code should be considered as "no go". There should be never a reason to "patch" the generated code.

3.) All files from the Build Environment (e.g. /TargetSpecific, main.c, ewmain.c, ewconfig.c) are ripped apart and partially copied into other files.

4.) It is not possible to run the project in the Prototyper and it is not possible to run the project on the EVK.

I assume that the error is somehow related to your start / stop activities (which happens outside of the GUI project) - but I have no chance to debug that. In the video there appears some other screens, which are not part of the Embedded Wizard project. Very confusing.

Honestly speaking, I would start from scratch and try to keep a proper software architecture. Once the porting to your target is done, test applications (e.g. GraphicsAccelerator demo provided in /Examples of the Build Environment) should run stable for hours and days.

Btw: We are offering Port and Verification as a service - maybe this is interesting for you.

Sorry - but I cannot solve the integration issue without having the board on the table...

Best regards,

Manfred.

by
Hi Manfred,

Thank you for all the support provided. As per your suggestion,I'll start from scratch and use vector graphics this time.
Regarding all files from the Build Environment, we have own bsp/pxp files in project so I can't use /Source or /TargetSpecific completely as it is.
Thank you for offering Port and Verification as a service - we may consider this after a few more trials.

Best regards,
Vandana Matai
by

Hello Manfred,

PFA stroked path Project and respective console log;  Project and Console1 with 200 edges, Console 2 with 250 edges. This time also graph gets disappeared.

I have involved: 

#define EW_PRINT_MEMORY_USAGE
// #define EW_DUMP_HEAP

#define EW_MAX_STRING_CACHE_SIZE      0x4000
#define EW_MAX_SURFACE_CACHE_SIZE   0x800000
#define EW_MAX_GLYPH_SURFACE_WIDTH       256
#define EW_MAX_GLYPH_SURFACE_HEIGHT      256
#define EW_MAX_NO_OF_GLYPHS                0
#define EW_MAX_ISSUE_TASKS               100

#define EW_LAZY_LOAD_BITMAPS                              1
#define EW_LAZY_LOAD_BITMAPS_IF_ANIMATED_ONLY             1
#define EW_DISCARD_BITMAPS                                1
#define EW_DISCARD_BITMAPS_IF_ANIMATED_ONLY               1
#define EW_DISCARD_BITMAPS_IF_NOT_USED_IN_CURRENT_UPDATE  0
#define EW_DISCARD_BITMAPS_IF_NOT_USED_IN_RECENT_UPDATES  0
#define EW_CACHE_OFFSCREEN_SURFACES                       0

from ew_config.h

NOTE: This time I am not editing any Package or Generated Code files except EwBspClockTickIncrement() is called from our 1ms_tick() function.

Sorry for bothering again,

Vandana Matai

ago by
Hi Vandana,

as mentioned in one of the comments above, I do not believe that the using vector graphs will solve the issue. It was recommended to have good implementation from the beginning of your project.

Can you try to run one of the provided examples with endless animations (e.g. GraphicsAccelerator demo) on your hardware and run that for some hours? Just to ensure that - without any events or data from outside - the GUI application is running stable.

I assume that the issue is somehow related to the integration.

Let me know the outcome.

Best regards,

Manfred.

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint

...