h1romas4 / m5stamp-c3wamr

This repository demonstrates the use of [WebAssembly Micro Runtime (WAMR)](https://github.com/bytecodealliance/wasm-micro-runtime) on M5Stamp C3 to run WebAssembly applications.

Home Page:https://another.maple4ever.net/archives/3866/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

m5stamp-c3wamr

This repository demonstrates the use of WebAssembly Micro Runtime (WAMR) on M5Stamp C3 to run WebAssembly applications.

Demo

🎥 Demo Movie

Require

get_idf or (Windows) ESP-IDF command prompt

# Linux or macOS ->
$ alias get_idf='. $HOME/esp/esp-idf/export.sh'
$ get_idf
# <-

Detecting the Python interpreter
... snip ...
Done! You can now compile ESP-IDF projects.
Go to the project directory and run:

  idf.py build

$ echo ${IDF_PATH}
/home/hiromasa/devel/toolchain/esp/esp-idf

$ riscv32-esp-elf-gcc -v
Using built-in specs.
COLLECT_GCC=riscv32-esp-elf-gcc
... snip ...
gcc version 12.2.0 (crosstool-NG esp-12.2.0_20230208)

Build

  1. git clone and build (Please add --recursive)
git clone --recursive https://github.com/h1romas4/m5stamp-c3warm
cd m5stamp-c3warm
idf.py build
  1. Write Partition table
idf.py partition-table-flash
  1. Write WebAssembly(.wasm) to SPIFFS
parttool.py write_partition --partition-name=wasm --partition-subtype=spiffs --input resources/spiffs_wasm.bin
  1. Write main program to go!
idf.py flash monitor

Note

Create SPIFFS partition file from file system

python ${IDF_PATH}/components/spiffs/spiffsgen.py 0x20000 resources/wasm resources/spiffs_wasm.bin

Build (.wasm to .aot)

(WIP) This repository does not yet support loading of riscv32 AOT file.

$ wamrc --version
wamrc 1.3.1
$ cd resources/wasm/
wamrc --target=riscv32 -o 3dcube-riscv32.aot 3dcube.wasm

Schematic

https://github.com/h1romas4/m5stamp-c3dev

M5Stack Core2 (ESP32/Xtensa) version

https://github.com/h1romas4/m5stamp-c3wamr/tree/target-m5stack

Demo

Dependencies

Thanks for all the open source.

Name Version License
esp-idf release/v5.1 BSD License
arduino-esp32 3.0.2 LGPL-2.1 License
WebAssembly Micro Runtime (WAMR) 2.1.1 Apache-2.0 License
AssemblyScript 0.27.29 Apache-2.0 License
Adafruit_GFX 1.11.9 BSD License
Adafruit_BusIO 1.14.5 MIT License
Adafruit-ST7735-Library 1.10.3 MIT License

License

MIT License

About

This repository demonstrates the use of [WebAssembly Micro Runtime (WAMR)](https://github.com/bytecodealliance/wasm-micro-runtime) on M5Stamp C3 to run WebAssembly applications.

https://another.maple4ever.net/archives/3866/


Languages

Language:C++ 48.7%Language:TypeScript 19.3%Language:JavaScript 19.0%Language:CMake 5.7%Language:CSS 2.8%Language:HTML 2.5%Language:C 2.0%