Set up custom malloc to use Micropython m_alloc, enabling gc on lvgl. Update makefile to generate lv_mpy.c automatically under /build dir. Use make all to build
This commit is contained in:
parent
14a0dfb556
commit
41b690117b
@ -14,15 +14,15 @@
|
||||
|
||||
/* Memory size which will be used by the library
|
||||
* to store the graphical objects and other data */
|
||||
#define LV_MEM_CUSTOM 0 /*1: use custom malloc/free, 0: use the built-in lv_mem_alloc/lv_mem_free*/
|
||||
#define LV_MEM_CUSTOM 1 /*1: use custom malloc/free, 0: use the built-in lv_mem_alloc/lv_mem_free*/
|
||||
#if LV_MEM_CUSTOM == 0
|
||||
#define LV_MEM_SIZE (64U * 1024U) /*Size memory used by `lv_mem_alloc` in bytes (>= 2kB)*/
|
||||
#define LV_MEM_ATTR /*Complier prefix for big array declaration*/
|
||||
#define LV_MEM_AUTO_DEFRAG 1 /*Automatically defrag on free*/
|
||||
#else /*LV_MEM_CUSTOM*/
|
||||
#define LV_MEM_CUSTOM_INCLUDE <stdlib.h> /*Header for the dynamic memory function*/
|
||||
#define LV_MEM_CUSTOM_ALLOC malloc /*Wrapper to malloc*/
|
||||
#define LV_MEM_CUSTOM_FREE free /*Wrapper to free*/
|
||||
#define LV_MEM_CUSTOM_INCLUDE <lv_mp_mem_custom_include.h> /*Header for the dynamic memory function*/
|
||||
#define LV_MEM_CUSTOM_ALLOC m_malloc /*Wrapper to malloc*/
|
||||
#define LV_MEM_CUSTOM_FREE m_free /*Wrapper to free*/
|
||||
#endif /*LV_MEM_CUSTOM*/
|
||||
|
||||
/*===================
|
||||
|
||||
2
lib/lvgl
2
lib/lvgl
@ -1 +1 @@
|
||||
Subproject commit dcb575424654cf6299e88f56cc11d1854bbf330d
|
||||
Subproject commit 3f72c7c905fe86d1946972e3c74aff4ffd3d56c3
|
||||
7
ports/unix/lv_mp_mem_custom_include.h
Normal file
7
ports/unix/lv_mp_mem_custom_include.h
Normal file
@ -0,0 +1,7 @@
|
||||
#ifndef __LV_MP_MEM_CUSTOM_INCLUDE_H
|
||||
#define __LV_MP_MEM_CUSTOM_INCLUDE_H
|
||||
|
||||
#include <py/mpconfig.h>
|
||||
#include <py/misc.h>
|
||||
|
||||
#endif //__LV_MP_MEM_CUSTOM_INCLUDE_H
|
||||
@ -49,8 +49,8 @@
|
||||
#define MICROPY_ENABLE_GC (1)
|
||||
#define MICROPY_ENABLE_FINALISER (1)
|
||||
#define MICROPY_STACK_CHECK (1)
|
||||
#define MICROPY_MALLOC_USES_ALLOCATED_SIZE (1)
|
||||
#define MICROPY_MEM_STATS (1)
|
||||
#define MICROPY_MALLOC_USES_ALLOCATED_SIZE (0)
|
||||
#define MICROPY_MEM_STATS (0)
|
||||
#define MICROPY_DEBUG_PRINTERS (1)
|
||||
#define MICROPY_ENABLE_SCHEDULER (1)
|
||||
#define MICROPY_MODULE_BUILTIN_INIT (1)
|
||||
|
||||
15
py/py.mk
15
py/py.mk
@ -120,12 +120,20 @@ $(BUILD)/extmod/modbtree.o: CFLAGS += $(BTREE_DEFS)
|
||||
endif
|
||||
|
||||
#LittlevGL
|
||||
|
||||
|
||||
LVGL_DIR = lib/lvgl
|
||||
$(info BUILD=$(BUILD) PWD=$(PWD) PY_SRC=$(PY_SRC))
|
||||
QSTR_GLOBAL_DEPENDENCIES += $(BUILD)/micropython/lv_mpy.c
|
||||
$(BUILD)/micropython/lv_mpy.c: $(TOP)/$(LVGL_DIR)/micropython/gen_mpy.py $(TOP)/$(LVGL_DIR)/lv_objx/*.h
|
||||
$(ECHO) "LVGL-GEN $@"
|
||||
$(Q)mkdir -p $(BUILD)/micropython
|
||||
$(Q)$(PYTHON) $(TOP)/$(LVGL_DIR)/micropython/gen_mpy.py -X anim -X group -I $(TOP)/$(LVGL_DIR)/micropython/pycparser/utils/fake_libc_include $(TOP)/$(LVGL_DIR)/lv_objx/*.h > $(BUILD)/micropython/lv_mpy.c
|
||||
|
||||
CFLAGS_MOD += -Wno-unused-function
|
||||
|
||||
INC += -I$(TOP)/$(LVGL_DIR)
|
||||
|
||||
SRC_MOD += $(addprefix $(LVGL_DIR)/,\
|
||||
SRC_MOD += $(BUILD)/micropython/lv_mpy.c \
|
||||
$(addprefix $(LVGL_DIR)/,\
|
||||
lv_core/lv_group.c \
|
||||
lv_core/lv_indev.c \
|
||||
lv_core/lv_obj.c \
|
||||
@ -213,7 +221,6 @@ SRC_MOD += $(addprefix $(LVGL_DIR)/,\
|
||||
lv_themes/lv_theme_night.c \
|
||||
lv_themes/lv_theme_templ.c \
|
||||
lv_themes/lv_theme_zen.c \
|
||||
micropython/lv_mpy.c \
|
||||
)
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user