This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 0f43be2c0771861f17620a692e93a4ba4eb49fb6
Author: YAMAMOTO Takashi <[email protected]>
AuthorDate: Wed Dec 6 23:23:23 2023 +0900

    Document esp32s3-devkitc:toywasm kconfig
---
 .../xtensa/esp32s3/boards/esp32s3-devkit/index.rst | 48 ++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git 
a/Documentation/platforms/xtensa/esp32s3/boards/esp32s3-devkit/index.rst 
b/Documentation/platforms/xtensa/esp32s3/boards/esp32s3-devkit/index.rst
index 27852d0850..99f76d576a 100644
--- a/Documentation/platforms/xtensa/esp32s3/boards/esp32s3-devkit/index.rst
+++ b/Documentation/platforms/xtensa/esp32s3/boards/esp32s3-devkit/index.rst
@@ -460,6 +460,54 @@ To test it, just run the following::
 
 Where x in the timer instance.
 
+toywasm
+-------
+
+This config is an example to use toywasm.
+
+This example uses littlefs on the SPI flash to store wasm modules.
+
+Note: This example assumes a board with 32MB flash. To use a smaller one,
+tweak the --img-size option and CONFIG_ESP32S3_STORAGE_MTD_SIZE.
+
+Note: To use flash larger than 4MB, you need to install a custom bootloader.
+https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-guides/bootloader.html#spi-flash-configuration
+
+1. Create a littlefs image which contains wasm modules.
+
+   https://github.com/jrast/littlefs-python/blob/master/examples/mkfsimg.py
+   is used in the following example::
+
+      % python3 mkfsimg.py \
+        --img-filename ..../littlefs.bin \
+        --img-size 31981568 \
+        --block-size 4096 \
+        --prog-size 256 \
+        --read-size 256 \
+        --name-max 32 \
+        --disk-version 2.0 \
+        ..../wasm_module_dir
+
+2. Build a NuttX binary as usual with this config.
+
+3. Write the NuttX binary and the filesystem image to the board::
+
+      % esptool.py \
+        -c esp32s3 \
+        -p /dev/tty.SLAB_USBtoUART \
+        -b 921600 \
+        write_flash \
+        -fs detect \
+        -fm dio \
+        -ff 40m \
+        0x10000 nuttx.bin \
+        0x180000 ..../littlefs.bin
+
+4. Mount the filesystem and run a wasm module on it::
+
+      nsh> mount -t littlefs /dev/esp32s3flash /mnt
+      nsh> toywasm --print-stats --wasi /mnt/....
+
 twai
 ----
 

Reply via email to