Closed JF002 closed 1 year ago
for me the used memory is always 0. Even tough the custom alloc defines are set the pvPortMalloc
function is never used in the simulator (at least for me)
#define LV_MEM_CUSTOM_INCLUDE <FreeRTOS.h> /*Header for the dynamic memory function*/
#define LV_MEM_CUSTOM_ALLOC pvPortMalloc /*Wrapper to malloc*/
#define LV_MEM_CUSTOM_FREE vPortFree /*Wrapper to free*/
otherwise this PR would be fine to merge as it still works with the current main branch without the memory allocation changes
edit: nevermind, I just needed to properly recompile. Now changing memory is showing
@NeroBurner I agree with all your comments, and thanks for applying the changes in the code! I'll merge the branch in InfiniTime soon so we can merge this one in InfiniSim :)
you're welcome. Always nice to see a project being used and improved :smiling_face_with_three_hearts:
Integration of this PR from InfiniTime.
Since FreeRTOS.h, portmacro_cmsis.h and task.h are now built in C (by lv_mem.c), I had to change some includes and declarations to make them compatible with a C compiler.
Integrating the new memory management from InfiniTime in InfiniSim is not easy because InfiniSim does not include the whole FreeRTOS. Which means that, for example, pvPortMalloc() and vPortFree() are not accessible from InfiniSim. As a first step, I provided custom implementations for pvPortMalloc(), vPortFree() which are based on ... malloc(). These function keep track of the memory that is currently allocated so that xPortGetFreeHeapSize(), xPortGetMinimumEverFreeHeapSize() return something.
Not that this implementation do not keep track of all the memory allocations done in InfiniTime. It can only "see" those done via pvPortMalloc(). It means that the available memory displayed by InfiniSim will probably be very optimistic.