How to add frozen modules to webassembly port? #9562
-
I am trying unsuccessfully to freeze a Python module in the webassembly port (current git master, emsdk 3.1.17). The module appears and is importable, but something seems to be jumbled up with the qstrs in it: functions appear under wrong or empty names, and strings used within them come out empty. In I had to Minimal reproducing example: diff --git a/ports/webassembly/helloworld.py b/ports/webassembly/helloworld.py
new file mode 100644
index 0000000..a8d8ea5
--- /dev/null
+++ b/ports/webassembly/helloworld.py
@@ -0,0 +1,5 @@
+def hello():
+ print(42, 'Hello World!', 56)
+
+def goodbye():
+ print(87, 'Goodbye World!', 90)
diff --git a/ports/webassembly/manifest.py b/ports/webassembly/manifest.py
new file mode 100644
index 0000000..cc85d6b
--- /dev/null
+++ b/ports/webassembly/manifest.py
@@ -0,0 +1 @@
+module("helloworld.py")
diff --git a/ports/webassembly/mpconfigport.h b/ports/webassembly/mpconfigport.h
index 4fbd922..004d1ba 100644
--- a/ports/webassembly/mpconfigport.h
+++ b/ports/webassembly/mpconfigport.h
@@ -125,6 +125,8 @@
#define MICROPY_ENABLE_SCHEDULER (1)
#define MICROPY_SCHEDULER_DEPTH (1)
+#define MICROPY_MODULE_FROZEN_MPY (1)
+
#define MP_SSIZE_MAX (0x7fffffff)
// #define MICROPY_EVENT_POLL_HOOK {ets_event_poll();}
Actual result:
Expected result:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You'll need to add this line to
|
Beta Was this translation helpful? Give feedback.
You'll need to add this line to
mpconfigport.h
as well: