From 620ee357238257e2822e78b791e8c69958ac4f9e Mon Sep 17 00:00:00 2001 From: Shlomo Zippel Date: Tue, 8 Apr 2025 11:53:44 -0700 Subject: [PATCH 01/10] allow external USER_C_MODULES from command line --- ports/esp32/esp32_common.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/esp32/esp32_common.cmake b/ports/esp32/esp32_common.cmake index 750d8e5c65c..d4f07da7609 100644 --- a/ports/esp32/esp32_common.cmake +++ b/ports/esp32/esp32_common.cmake @@ -11,7 +11,7 @@ endif() # Include core source components. include(${MICROPY_DIR}/py/py.cmake) -set(USER_C_MODULES "${MICROPY_DIR}/user_modules/lv_binding_micropython/micropython.cmake") +list(APPEND USER_C_MODULES "${MICROPY_DIR}/user_modules/lv_binding_micropython/micropython.cmake") # CMAKE_BUILD_EARLY_EXPANSION is set during the component-discovery phase of # `idf.py build`, so none of the extmod/usermod (and in reality, most of the From 22c6adde7053b9a37b798d4eda3f4ebfbb0cad0a Mon Sep 17 00:00:00 2001 From: Shlomo Zippel Date: Thu, 8 May 2025 10:46:57 -0700 Subject: [PATCH 02/10] changes for webassembly target --- ports/webassembly/Makefile | 4 +- ports/webassembly/index.html | 109 ++++++++++++++++++ ports/webassembly/variants/lvgl/manifest.py | 1 + .../variants/lvgl/mpconfigvariant.h | 3 + .../variants/lvgl/mpconfigvariant.mk | 6 + 5 files changed, 122 insertions(+), 1 deletion(-) create mode 100644 ports/webassembly/index.html create mode 100644 ports/webassembly/variants/lvgl/manifest.py create mode 100644 ports/webassembly/variants/lvgl/mpconfigvariant.h create mode 100644 ports/webassembly/variants/lvgl/mpconfigvariant.mk diff --git a/ports/webassembly/Makefile b/ports/webassembly/Makefile index 435636531cc..d3543ea8f32 100644 --- a/ports/webassembly/Makefile +++ b/ports/webassembly/Makefile @@ -46,6 +46,7 @@ INC += -I$(BUILD) INC += -I$(VARIANT_DIR) CFLAGS += -std=c99 -Wall -Werror -Wdouble-promotion -Wfloat-conversion +CFLAGS += -Wno-unused-function CFLAGS += -Os -DNDEBUG CFLAGS += $(INC) @@ -95,6 +96,7 @@ JSFLAGS += --js-library library.js JSFLAGS += -s SUPPORT_LONGJMP=emscripten JSFLAGS += -s MODULARIZE -s EXPORT_NAME=_createMicroPythonModule + ################################################################################ # Source files and libraries. @@ -130,7 +132,7 @@ OBJ += $(addprefix $(BUILD)/, $(SRC_C:.c=.o)) ################################################################################ # Main targets. -.PHONY: all repl min test test_min +.PHONY: all repl min test test_min all: $(BUILD)/micropython.mjs diff --git a/ports/webassembly/index.html b/ports/webassembly/index.html new file mode 100644 index 00000000000..30aa2a9a05a --- /dev/null +++ b/ports/webassembly/index.html @@ -0,0 +1,109 @@ + + + + + µPy + term.js REPL + + + + + + +
+
+ +
+ + + + + + \ No newline at end of file diff --git a/ports/webassembly/variants/lvgl/manifest.py b/ports/webassembly/variants/lvgl/manifest.py new file mode 100644 index 00000000000..f51b7ba7cef --- /dev/null +++ b/ports/webassembly/variants/lvgl/manifest.py @@ -0,0 +1 @@ +include("$(PORT_DIR)/variants/pyscript/manifest.py") diff --git a/ports/webassembly/variants/lvgl/mpconfigvariant.h b/ports/webassembly/variants/lvgl/mpconfigvariant.h new file mode 100644 index 00000000000..ed8e8128035 --- /dev/null +++ b/ports/webassembly/variants/lvgl/mpconfigvariant.h @@ -0,0 +1,3 @@ +#define MICROPY_CONFIG_ROM_LEVEL (MICROPY_CONFIG_ROM_LEVEL_FULL_FEATURES) +#define MICROPY_GC_SPLIT_HEAP (1) +#define MICROPY_GC_SPLIT_HEAP_AUTO (1) diff --git a/ports/webassembly/variants/lvgl/mpconfigvariant.mk b/ports/webassembly/variants/lvgl/mpconfigvariant.mk new file mode 100644 index 00000000000..8cbbe254c45 --- /dev/null +++ b/ports/webassembly/variants/lvgl/mpconfigvariant.mk @@ -0,0 +1,6 @@ +JSFLAGS += -s ALLOW_MEMORY_GROWTH +JSFLAGS += -s USE_SDL=2 +CFLAGS_EXTMOD += -DMICROPY_SDL=1 +LV_CFLAGS += -DMICROPY_SDL=1 + +FROZEN_MANIFEST ?= variants/lvgl/manifest.py \ No newline at end of file From 562f70a6844b519b73f9d5670ab9f5ce60b371f2 Mon Sep 17 00:00:00 2001 From: Shlomo Zippel Date: Thu, 8 May 2025 17:53:28 -0700 Subject: [PATCH 03/10] small fixes --- ports/webassembly/index.html | 2 +- ports/webassembly/variants/lvgl/manifest.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ports/webassembly/index.html b/ports/webassembly/index.html index 30aa2a9a05a..cdb5872d7fa 100644 --- a/ports/webassembly/index.html +++ b/ports/webassembly/index.html @@ -41,7 +41,7 @@