Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

boards/esp32s3: move QEMU toywasm to different defconfig #15874

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fdcavalcanti
Copy link
Contributor

Note: Please adhere to Contributing Guidelines.

Summary

This PR creates a separate defconfig for running WebAssembly in QEMU for the ESP32S3.
The extra granularity speeds up the build for most use cases where WebAssembly is not needed.
Also adds CONFIG_ESP32S3_QEMU_IMAGE=y to qemu_debug, otherwise QEMU will not be able to run.

Impact

Impact on user: New defconfig for using WebAssembly with QEMU.

Impact on build: Speeds up esp32s3:qemu_debug. If user requires QEMU with WebAssembly out-of-the-box should now use esp32s3:qemu_toywasm.

Impact on hardware: No.

Impact on documentation: No.

Impact on security: No.

Impact on compatibility: No.

Testing

Building

Build each of the defconfigs normally.

  • ./tools/configure.sh esp32s3-devkit:qemu_debug or ./tools/configure.sh esp32s3-devkit:qemu_toywasm
  • make

Running

Test each with QEMU using the following command:

  • qemu-system-xtensa -nographic -machine esp32s3 -drive file=nuttx.merged.bin,if=mtd,format=raw

Results

  • qemu_debug:
$ qemu-system-xtensa -nographic -machine esp32s3 -drive file=nuttx.merged.bin,if=mtd,format=raw
Adding SPI flash device
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x1 (POWERON),boot:0x4 (SPI_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:2
load:0x3fc95890,len:0x99c
load:0x40374000,len:0x5c68
SHA-256 comparison failed:
Calculated: efd78defa836593f218dd24d5177e42076679ad199102350dba2707efd3c463c
Expected: 00000000c0990000000000000000000000000000000000000000000000000000
Attempting to boot anyway...
entry 0x40374e70
*** Booting NuttX ***
dram: lma 0x00000020 vma 0x3fc95890 len 0x99c    (2460)
iram: lma 0x000009c4 vma 0x40374000 len 0x5c68   (23656)
padd: lma 0x00006638 vma 0x00000000 len 0x99c0   (39360)
imap: lma 0x00010000 vma 0x42030000 len 0x30730  (198448)
padd: lma 0x00040738 vma 0x00000000 len 0xf8c0   (63680)
dmap: lma 0x00050000 vma 0x3c010000 len 0x4d98   (19864)
total segments stored 6

NuttShell (NSH) NuttX-10.4.0
nsh> ps
  PID GROUP CPU PRI POLICY   TYPE    NPX STATE    EVENT     SIGMASK            STACK COMMAND
    0     0   0   0 FIFO     Kthread   - Assigned           0000000000000000 0003056 CPU0 IDLE
    1     0   1   0 FIFO     Kthread   - Running            0000000000000000 0003056 CPU1 IDLE
    2     0 --- 100 RR       Kthread   - Waiting  Semaphore 0000000000000000 0004024 lpwork 0x3fc95890 0x3fc958c0
    3     3   0 100 RR       Task      - Running            0000000000000000 0008144 nsh_main
    4     0 --- 255 RR       Kthread   - Waiting  Semaphore 0000000000000000 0000696 spiflash_op 0x3fc9a59c
    5     0 --- 255 RR       Kthread   - Waiting  Semaphore 0000000000000000 0000696 spiflash_op 0x3fc9a59c
    6     0 --- 223 RR       Kthread   - Waiting  Semaphore 0000000000000000 0004048 rt_timer
  • qemu_toywasm:
$ qemu-system-xtensa -nographic -machine esp32s3 -drive file=nuttx.merged.bin,if=mtd,format=raw
Adding SPI flash device
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x1 (POWERON),boot:0x4 (SPI_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:2
load:0x3fc958a0,len:0x9cc
load:0x40374000,len:0x5c68
SHA-256 comparison failed:
Calculated: e7b3e69fa907cecd43f0c07b7610e833510eb5602493dfe3b714ec0df88cade9
Expected: 0000000090990000000000000000000000000000000000000000000000000000
Attempting to boot anyway...
entry 0x40374e70
*** Booting NuttX ***
dram: lma 0x00000020 vma 0x3fc958a0 len 0x9cc    (2508)
iram: lma 0x000009f4 vma 0x40374000 len 0x5c68   (23656)
padd: lma 0x00006668 vma 0x00000000 len 0x9990   (39312)
imap: lma 0x00010000 vma 0x42030000 len 0x59a78  (367224)
padd: lma 0x00069a80 vma 0x00000000 len 0x6578   (25976)
dmap: lma 0x00070000 vma 0x3c010000 len 0xdd80   (56704)
total segments stored 6

NuttShell (NSH) NuttX-10.4.0
nsh> toywasm
Usage:
        toywasm [OPTIONS] [--] <MODULE> [WASI-ARGS...]
Options:
        --allow-unresolved-functions
[...]

@github-actions github-actions bot added Board: xtensa Size: M The size of the change in this PR is medium labels Feb 19, 2025
@nuttxpr
Copy link

nuttxpr commented Feb 19, 2025

[Experimental Bot, please feedback here]

Fill In The Commit Message: This PR contains a Commit with an Empty Commit Message. Please fill in the Commit Message with the PR Summary.

This PR appears to meet the NuttX requirements. The summary is clear, concise, and explains the motivation and technical details of the change. The impact section is thorough, addressing all the required points. The testing section provides sufficient detail to reproduce the tests and demonstrates that the changes function as intended. The provided logs show the successful boot of both configurations and the availability of the toywasm command in the qemu_toywasm configuration, which is the expected outcome.

@tmedicci
Copy link
Contributor

Can you please update the associated entries in Documentation/platforms/xtensa/esp32s3/boards/esp32s3-devkit/index.rst, @fdcavalcanti ?

@fdcavalcanti fdcavalcanti force-pushed the feature/move-s3-qemu-toywasm branch from 44aa3e7 to ebc490e Compare February 20, 2025 16:31
@fdcavalcanti
Copy link
Contributor Author

Can you please update the associated entries in Documentation/platforms/xtensa/esp32s3/boards/esp32s3-devkit/index.rst, @fdcavalcanti ?

Thanks for reminding. Documentation updated.

@github-actions github-actions bot added the Area: Documentation Improvements or additions to documentation label Feb 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Documentation Improvements or additions to documentation Board: xtensa Size: M The size of the change in this PR is medium
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants