From e8ea6923074bf5939a3e3cdf5c3a08dde653136b Mon Sep 17 00:00:00 2001 From: liamHowatt Date: Thu, 18 Jul 2024 21:08:17 -0400 Subject: [PATCH 1/2] generate LVGL API JSON and pass to gen_mpy.py --- extmod/extmod.mk | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/extmod/extmod.mk b/extmod/extmod.mk index 0cc12052f867..81375bd8b2fd 100644 --- a/extmod/extmod.mk +++ b/extmod/extmod.mk @@ -375,18 +375,34 @@ LVGL_DIR = $(LVGL_BINDING_DIR)/lvgl LVGL_GENERIC_DRV_DIR = $(LVGL_BINDING_DIR)/driver/generic INC += -I$(LVGL_BINDING_DIR) ALL_LVGL_SRC = $(shell find $(LVGL_DIR) -type f -name '*.h') $(LVGL_BINDING_DIR)/lv_conf.h +LVGL_ALL_H = $(BUILD)/lvgl/lvgl_all.h +LVGL_ALL_JSON = $(BUILD)/lvgl/lvgl_all.json LVGL_PP = $(BUILD)/lvgl/lvgl.pp.c LVGL_MPY = $(BUILD)/lvgl/lv_mpy.c LVGL_MPY_METADATA = $(BUILD)/lvgl/lv_mpy.json CFLAGS_EXTMOD += $(LV_CFLAGS) -$(LVGL_MPY): $(ALL_LVGL_SRC) $(LVGL_BINDING_DIR)/gen/gen_mpy.py +ifneq (,$(wildcard $(LVGL_DIR)/scripts/gen_json/gen_json.py)) +$(LVGL_ALL_JSON): $(ALL_LVGL_SRC) $(LVGL_DIR)/scripts/gen_json/gen_json.py + $(ECHO) "LVGL-JSON-GEN $@" + $(Q)mkdir -p $(dir $@) + $(ECHO) "#include \"$(LVGL_DIR)/lvgl.h\"\n#include \"$(LVGL_DIR)/src/lvgl_private.h\"" > $(LVGL_ALL_H) + $(Q)$(PYTHON) $(LVGL_DIR)/scripts/gen_json/gen_json.py --target-header $(LVGL_ALL_H) > $(LVGL_ALL_JSON) +else +$(LVGL_ALL_JSON): + $(ECHO) "LVGL-JSON-GEN $@" + $(Q)mkdir -p $(dir $@) + $(ECHO) "{}" > $(LVGL_ALL_JSON) +endif + +$(LVGL_MPY): $(ALL_LVGL_SRC) $(LVGL_BINDING_DIR)/gen/gen_mpy.py $(LVGL_ALL_JSON) $(ECHO) "LVGL-GEN $@" $(Q)mkdir -p $(dir $@) $(Q)$(CPP) $(CFLAGS_EXTMOD) -DPYCPARSER -x c -I $(LVGL_BINDING_DIR)/pycparser/utils/fake_libc_include $(INC) $(LVGL_DIR)/lvgl.h > $(LVGL_PP) - $(Q)$(PYTHON) $(LVGL_BINDING_DIR)/gen/gen_mpy.py -M lvgl -MP lv -MD $(LVGL_MPY_METADATA) -E $(LVGL_PP) $(LVGL_DIR)/lvgl.h > $@ + $(Q)$(PYTHON) $(LVGL_BINDING_DIR)/gen/gen_mpy.py -M lvgl -MP lv -MD $(LVGL_MPY_METADATA) -E $(LVGL_PP) -J $(LVGL_ALL_JSON) $(LVGL_DIR)/lvgl.h > $@ .PHONY: LVGL_MPY +LVGL_ALL_JSON: $(LVGL_ALL_JSON) LVGL_MPY: $(LVGL_MPY) CFLAGS_EXTMOD += -Wno-unused-function From a190ce41c796b187cd482033c2e58ec849552e15 Mon Sep 17 00:00:00 2001 From: liamHowatt Date: Fri, 19 Jul 2024 08:07:39 -0400 Subject: [PATCH 2/2] update lv_binding_micropython submodule to version with JSON handling --- lib/lv_bindings | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/lv_bindings b/lib/lv_bindings index 918326f5e000..6dff1163cf7d 160000 --- a/lib/lv_bindings +++ b/lib/lv_bindings @@ -1 +1 @@ -Subproject commit 918326f5e00048fda208855c9c9be8b7d1a2444a +Subproject commit 6dff1163cf7d66c4fe3a164f1545e98535220b7b