Closed Virus-V closed 2 years ago
Hi,
Does it help if you increase LV_MEM_SIZE
? E.g. to 48 * 1024.
If not, please enable LV_USE_LOG
and all LV_USE_ASSERT_...
. Hopefully, LVGL sees what's the problem. :slightly_smiling_face:
Hi,
Does it help if you increase
LV_MEM_SIZE
? E.g. to 48 * 1024.If not, please enable
LV_USE_LOG
and allLV_USE_ASSERT_...
. Hopefully, LVGL sees what's the problem. 🙂
I tried to increase the LV_MEM_SIZE to 1MByte, and open all ASSERT checks, the segmentation error still appears.
@@ -42,7 +42,7 @@
#define LV_MEM_CUSTOM 0
#if LV_MEM_CUSTOM == 0
/*Size of the memory available for `lv_mem_alloc()` in bytes (>= 2kB)*/
-# define LV_MEM_SIZE (32U * 1024U) /*[bytes]*/
+# define LV_MEM_SIZE (1024U * 1024U) /*[bytes]*/
/*Set an address for the memory pool instead of allocating it as a normal array. Can be in external SRAM too.*/
# define LV_MEM_ADR 0 /*0: unused*/
@@ -137,7 +137,7 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h"*/
*-----------*/
/*Enable the log module*/
-#define LV_USE_LOG 0
+#define LV_USE_LOG 1
#if LV_USE_LOG
/*How important log should be added:
@@ -173,20 +173,20 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h"*/
*If LV_USE_LOG is enabled an error message will be printed on failure*/
#define LV_USE_ASSERT_NULL 1 /*Check if the parameter is NULL. (Very fast, recommended)*/
#define LV_USE_ASSERT_MALLOC 1 /*Checks is the memory is successfully allocated or no. (Very fast, recommended)*/
-#define LV_USE_ASSERT_STYLE 0 /*Check if the styles are properly initialized. (Very fast, recommended)*/
-#define LV_USE_ASSERT_MEM_INTEGRITY 0 /*Check the integrity of `lv_mem` after critical operations. (Slow)*/
-#define LV_USE_ASSERT_OBJ 0 /*Check the object's type and existence (e.g. not deleted). (Slow)*/
+#define LV_USE_ASSERT_STYLE 1 /*Check if the styles are properly initialized. (Very fast, recommended)*/
+#define LV_USE_ASSERT_MEM_INTEGRITY 1 /*Check the integrity of `lv_mem` after critical operations. (Slow)*/
+#define LV_USE_ASSERT_OBJ 1 /*Check the object's type and existence (e.g. not deleted). (Slow)*/
/*Add a custom handler when assert happens e.g. to restart the MCU*/
-#define LV_ASSERT_HANDLER_INCLUDE <stdint.h>
-#define LV_ASSERT_HANDLER while(1); /*Halt by default*/
+#define LV_ASSERT_HANDLER_INCLUDE <stdlib.h>
+#define LV_ASSERT_HANDLER abort(); /*Halt by default*/
/*-------------
* Others
*-----------*/
/*1: Show CPU usage and FPS count in the right bottom corner*/
-#define LV_USE_PERF_MONITOR 0
+#define LV_USE_PERF_MONITOR 1
/*1: Show the used memory and the memory fragmentation in the left bottom corner
* Requires LV_MEM_CUSTOM = 0*/
Cut the benchmark item to keep only Line, Arc think, Arc thick and all Substr. XXX, segmentation errors will appear very quickly.
--- a/lv_demo_benchmark.c
+++ b/lv_demo_benchmark.c
@@ -532,6 +532,7 @@ static void sub_text_cb(void)
* STATIC VARIABLES
**********************/
static scene_dsc_t scenes[] = {
+#if 0
{.name = "Rectangle", .weight = 30, .create_cb = rectangle_cb},
{.name = "Rectangle rounded", .weight = 20, .create_cb = rectangle_rounded_cb},
{.name = "Circle", .weight = 10, .create_cb = rectangle_circle_cb},
@@ -576,6 +577,7 @@ static scene_dsc_t scenes[] = {
{.name = "Text small compressed", .weight = 3, .create_cb = txt_small_compr_cb},
{.name = "Text medium compressed", .weight = 5, .create_cb = txt_medium_compr_cb},
{.name = "Text large compressed", .weight = 10, .create_cb = txt_large_compr_cb},
+#endif
{.name = "Line", .weight = 10, .create_cb = line_cb},
{.name = "Arc think", .weight = 10, .create_cb = arc_think_cb},
{.name = "Arc thick", .weight = 10, .create_cb = arc_thick_cb},
{.name = "Substr. rectangle", .weight = 10, .create_cb = sub_rectangle_cb},
{.name = "Substr. border", .weight = 10, .create_cb = sub_border_cb},
{.name = "Substr. shadow", .weight = 10, .create_cb = sub_shadow_cb},
{.name = "Substr. image", .weight = 10, .create_cb = sub_img_cb},
{.name = "Substr. line", .weight = 10, .create_cb = sub_line_cb},
{.name = "Substr. arc", .weight = 10, .create_cb = sub_arc_cb},
{.name = "Substr. text", .weight = 10, .create_cb = sub_text_cb},
{.name = "", .create_cb = NULL}
I created a PR, please review : https://github.com/lvgl/lvgl/pull/2860
Perform all steps below and tick them with [x]
Describe the bug
This problem does not appear every time.
When I was porting lvgl and running benchmark on FreeBSD 13 virtual machine, I encountered several segmentation faults and generated coredump.
Use the debugger to trace its call stack and local variables, and find that the access to the draw buffer in the
fill_blended
function is out of bounds.Before the segmentation fault occurs, there will be a phenomenon of blurring.
To Reproduce
Commit ID I use: 5433e0bc2abb6d0db931a1721bf723f4035a73a2
Here is my lv_conf.h header file:
Here is the assertion I added(for testing purposes):
Here is coredump log:
And here is the backtrace:
Expected behavior
Complete the benchmark normally.
Screenshots or video
https://user-images.githubusercontent.com/32447708/143835392-00f78eca-db5f-4d47-868f-1d9203bcb815.mov