Skip to content

Add ESP32 example with a portable smoke test - #396

Merged
kateinoigakukun merged 1 commit into
mainfrom
katei/esp32-example
Jul 29, 2026
Merged

Add ESP32 example with a portable smoke test#396
kateinoigakukun merged 1 commit into
mainfrom
katei/esp32-example

Conversation

@kateinoigakukun

@kateinoigakukun kateinoigakukun commented Jul 29, 2026

Copy link
Copy Markdown
Member

Final part of the incremental upstreaming of Embedded Swift support (#357). Follows #395.

Adds Examples/embedded-esp32: an ESP-IDF (v5.5) project that runs WasmKit on an ESP32-C6 with Embedded Swift, plus a portable smoke test.

  • One IDF component per SwiftPM module (wasmtypes, wasmparser, wasmkit, cwasmkit), compiled with -enable-experimental-feature Embedded and no traits enabled.
  • The demo instantiates a module, calls exported functions (add, mul3 calling back into a host mul function), and shows host-error identity: a host function throws DemoHostError(code: 42) and the embedder catches it with catch let error as DemoHostError.
  • smoke-test.sh locates ESP-IDF and the newest Swift development snapshot, patches ESP-IDF's linker template for .got (idempotently), and builds for esp32c6; --qemu additionally builds for esp32c3 and runs the demo under QEMU, asserting the expected output.

Two CI jobs keep this working:

  • build-embedded compile-checks the engine for riscv32-none-none-eabi with Embedded Swift (Utilities/build-embedded.sh) — fast, no ESP-IDF needed.
  • smoke-esp32 runs the full smoke test in the espressif/idf:v5.5 container: installs a Swift development snapshot and Espressif's QEMU, builds for esp32c6 and esp32c3, and boots the demo in QEMU asserting its output.

Verified: esp32c6 build and the QEMU run pass (2 + 3 = 5, 7 * 3 = 21, host error 42).

The Embedded Swift support in the engine (#388#395) was originally developed by @Joannis in #357.

Builds WasmKit for ESP32-C6 via ESP-IDF v5.5 + Embedded Swift (one IDF
component per SwiftPM module) and runs a wasm module on emulated ESP32-C3
in QEMU via Examples/embedded-esp32/smoke-test.sh.

A new build-embedded CI job compile-checks the engine for
riscv32-none-none-eabi with Embedded Swift (Utilities/build-embedded.sh),
so embedded compatibility is maintained without ESP-IDF on the runners.

The Embedded Swift support in the engine was originally developed by
Joannis Orlandos in #357.

Co-authored-by: Joannis Orlandos <joannis@orlandos.nl>
@kateinoigakukun
kateinoigakukun added this pull request to the merge queue Jul 29, 2026
Merged via the queue into main with commit 675bfad Jul 29, 2026
34 of 36 checks passed
@kateinoigakukun
kateinoigakukun deleted the katei/esp32-example branch July 29, 2026 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant