From e10a7f5160b135785641d9369b88ab29c3da7199 Mon Sep 17 00:00:00 2001 From: Mathy Vanvoorden Date: Wed, 19 Jun 2024 00:22:58 +0200 Subject: [PATCH] Revert to using LV_STDLIB_MICROPYTHON LV_STDLIB_BUILTIN, while making soft-reboots work, introduces issues with indev (and probably others) so we give up the convenience of soft-reboots in favor of working firmwares. Related: https://github.com/lvgl/lv_binding_micropython/issues/343 --- README.md | 4 +++ binding/binding.cmake | 1 + binding/include/lv_mp_mem_custom_include.h | 33 ++++++++++++++++++++++ binding/lv_conf.h | 13 ++++++--- binding/pycparser | 2 +- 5 files changed, 48 insertions(+), 5 deletions(-) create mode 100644 binding/include/lv_mp_mem_custom_include.h diff --git a/README.md b/README.md index 3a3e860..427e7b4 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,10 @@ Compile adding the `USER_C_MODULES` parameter to the `make` command. make USER_C_MODULES=/path/to/lvgl_esp32_mpy/micropython.cmake ``` +## Broken things + +* [Soft-reboots are not working](https://github.com/lvgl/lv_binding_micropython/issues/343) + ## Missing things Things I'll probably still implement at some point: diff --git a/binding/binding.cmake b/binding/binding.cmake index 4267304..1d3c26d 100644 --- a/binding/binding.cmake +++ b/binding/binding.cmake @@ -65,6 +65,7 @@ file(WRITE ${LVGL_MPY} "") add_library(usermod_lv_bindings INTERFACE) target_sources(usermod_lv_bindings INTERFACE ${LVGL_MPY}) +target_include_directories(usermod_lv_bindings INTERFACE ${LVGL_BINDINGS_DIR}) target_link_libraries(usermod_lv_bindings INTERFACE lvgl_interface) diff --git a/binding/include/lv_mp_mem_custom_include.h b/binding/include/lv_mp_mem_custom_include.h new file mode 100644 index 0000000..4f01220 --- /dev/null +++ b/binding/include/lv_mp_mem_custom_include.h @@ -0,0 +1,33 @@ +/* + * MIT License + * + * Copyright (c) 2019-2021 LVGL + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#ifndef __LV_MP_MEM_CUSTOM_INCLUDE_H +#define __LV_MP_MEM_CUSTOM_INCLUDE_H + +#include +#include +#include + +#endif //__LV_MP_MEM_CUSTOM_INCLUDE_H diff --git a/binding/lv_conf.h b/binding/lv_conf.h index 4039770..3575ca4 100644 --- a/binding/lv_conf.h +++ b/binding/lv_conf.h @@ -64,7 +64,7 @@ * - LV_STDLIB_RTTHREAD: RT-Thread implementation * - LV_STDLIB_CUSTOM: Implement the functions externally */ -#define LV_USE_STDLIB_MALLOC LV_STDLIB_BUILTIN +#define LV_USE_STDLIB_MALLOC LV_STDLIB_MICROPYTHON #define LV_USE_STDLIB_STRING LV_STDLIB_BUILTIN #define LV_USE_STDLIB_SPRINTF LV_STDLIB_BUILTIN @@ -320,10 +320,15 @@ * Others *-----------*/ -#define LV_ENABLE_GLOBAL_CUSTOM 0 +/*Garbage Collector settings + *Used if LVGL is bound to higher level language and the memory is managed by that language*/ +extern void mp_lv_init_gc(); +#define LV_GC_INIT() mp_lv_init_gc() + +#define LV_ENABLE_GLOBAL_CUSTOM 1 #if LV_ENABLE_GLOBAL_CUSTOM - /*Header to include for the custom 'lv_global' function"*/ - #define LV_GLOBAL_CUSTOM_INCLUDE + extern void *mp_lv_roots; + #define LV_GLOBAL_CUSTOM() ((lv_global_t*)mp_lv_roots) #endif /*Default cache size in bytes. diff --git a/binding/pycparser b/binding/pycparser index 3cf6bf5..129d32e 160000 --- a/binding/pycparser +++ b/binding/pycparser @@ -1 +1 @@ -Subproject commit 3cf6bf5eb16f5eadd4a058e41596145c407a79ad +Subproject commit 129d32ef805d715d90a3b2035b13168c17ca63d2