How to debug a stack overflow error in a nRF5340

I am getting this error on the 7th time I perform an action:

[00:02:31.772,277] <err> lvgl: (151.772, +67506)         lv_mem_realloc: couldn't allocate memory       (in lv_mem.c line #211)
[00:02:31.772,521] <err> lvgl: (151.772, +0)     lv_mem_buf_get: Asserted at expression: buf != NULL (Out of memory, can't allocate a new buffer (increase your LV_MEM_SIZE/heap size))   (in lv_mem.c line #312)

I understand it's an lvgl error and could be specific to lvgl but I think, considering it's only happening on the 7th time I perform an action, that it's a memory problem someplace else. I was thinking being able to print the available RAM would help. Is there a way to do that? Is there a way to see what variables are in RAM?

I'm using Zephyr with the VSC connect add-in.

Parents Reply
  • Thank you. I will review the sample in the link you provided. I used the sample code to get started but in real world applications the usage of lvgl is likely to be different. For example, they don't show how to switch screens in the example, but that is a common use case. Additionally, they don't show how to display images from files in the sample, but it is a feature of lvgl. I think what I am looking to understand is how to debug the issue when it happens. My initial thought was printing the RAM to narrow down where it might be happening. I could use Nordic debugging tools but don't have the RAM tab for some reason. Is there something you would do at this point given that the code has evolved far beyond the sample?

Children
No Data
Related