Skip to content

Commit 8306c8d

Browse files
committed
Update docs
1 parent 3de3336 commit 8306c8d

File tree

2 files changed

+44
-42
lines changed

2 files changed

+44
-42
lines changed

BUILDING.md

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
2+
# Build `wasm2mpy`
3+
4+
> [!WARNING]
5+
> **This is a Proof-of-Concept, not optimized or ready for actual use.**
6+
7+
You'll need:
8+
9+
- Python 3
10+
- `pip install --upgrade pyelftools ar`
11+
- `wasm2c` from [WABT](https://github.com/WebAssembly/wabt/releases/tag/1.0.36)
12+
- Latest [MicroPython](https://github.com/micropython/micropython) source code
13+
- Target architecture toolchain
14+
15+
Set up the environment and build the `.mpy` module from `.wasm`:
16+
17+
```sh
18+
export MPY_DIR=/path/to/micropython
19+
export PATH=/opt/wabt/bin:$PATH
20+
export PATH=/opt/xtensa-lx106-elf/bin:$PATH
21+
export PATH=/opt/xtensa-esp32-elf/bin:$PATH
22+
pip install -U pyelftools
23+
make ARCH=xtensawin APP=zig # x86, x64, armv6m, armv7m, armv7emsp, armv7emdp, xtensa, xtensawin
24+
```
25+
26+
Output:
27+
28+
```log
29+
W2C test/zig.wasm
30+
GEN build/zig.config.h
31+
CC runtime/runtime.c
32+
CC runtime/wasm-rt-mem-impl.c
33+
CC runtime/wasm-rt-impl.c
34+
CC .wasm/wasm.c
35+
LINK build/runtime/runtime.o
36+
arch: EM_XTENSA
37+
text size: 3524
38+
rodata size: 850
39+
bss size: 144
40+
GOT entries: 57
41+
GEN zig.mpy
42+
```

README.md

+2-42
Original file line numberDiff line numberDiff line change
@@ -36,50 +36,10 @@
3636
- **iMXRT1062** 600MHz: `1911.437`
3737
- **i5-8250U** 1.6GHz: `18696.248`
3838

39-
## Compile
40-
41-
> [!IMPORTANT]
42-
> **This is a Proof-of-Concept, not optimized or ready for actual use.**
43-
44-
You'll need:
45-
46-
- Python 3
47-
- `pip install --upgrade pyelftools ar`
48-
- `wasm2c` from [WABT](https://github.com/WebAssembly/wabt/releases/tag/1.0.36)
49-
- Latest [MicroPython](https://github.com/micropython/micropython) source code
50-
- Target architecture toolchain
51-
52-
Set up the environment and build the `.mpy` module from `.wasm`:
53-
54-
```sh
55-
export MPY_DIR=/path/to/micropython
56-
export PATH=/opt/wabt/bin:$PATH
57-
export PATH=/opt/xtensa-lx106-elf/bin:$PATH
58-
export PATH=/opt/xtensa-esp32-elf/bin:$PATH
59-
pip install -U pyelftools
60-
make ARCH=xtensawin APP=zig # x86, x64, armv6m, armv7m, armv7emsp, armv7emdp, xtensa, xtensawin
61-
```
62-
63-
Output:
64-
65-
```log
66-
W2C test/zig.wasm
67-
GEN build/zig.config.h
68-
CC runtime/runtime.c
69-
CC runtime/wasm-rt-mem-impl.c
70-
CC runtime/wasm-rt-impl.c
71-
CC .wasm/wasm.c
72-
LINK build/runtime/runtime.o
73-
arch: EM_XTENSA
74-
text size: 3524
75-
rodata size: 850
76-
bss size: 144
77-
GOT entries: 57
78-
GEN zig.mpy
79-
```
80-
8139
## Upload and Run
8240

41+
Follow the [build instructions](BUILDING.md)
42+
8343
```sh
8444
mpremote cp zig.mpy :lib/
8545
mpremote exec "import zig; zig.setup()"

0 commit comments

Comments
 (0)