Skip to content

cherry-pick: WASI component pipeline (#446), bare-metal port (#448, #449), H3 migration tests (#450) to main - #451

Merged
gg582 merged 4 commits into
mainfrom
chore/main-picks-baremetal
Oct 26, 2026
Merged

gg582 merged 4 commits into
mainfrom
chore/main-picks-baremetal

Conversation

@gg582

@gg582 gg582 commented Oct 26, 2026

Copy link
Copy Markdown
Member

Summary

Cherry-picks the dev merges since #445 that belong on main, in dev order (git cherry-pick -x):

#448's tools/stm32-spike/ is removed again by #449, which supersedes it. It is kept so that the history matches dev. Doxygen and benchmark-report auto-commits stay divergent, as before.

Conflict resolution

Submodule gitlinks are unchanged by the picks. main keeps its own lsquic pin (2b30189).

How it was verified

On the picked tree, with main's submodule pins (lsquic 2b30189 built fresh for this check):

  • make -j16 all and make -k test: all targets pass, exit 0
  • make baremetal-smoke: PASS (with and without an RTC)
  • make wasip2-smoke: PASS
  • check_test_wiring, check_api_baseline (incl. the v4 guarantee), check_env_knobs, check_api_test_coverage, check_inline_exports, malloc_lint.sh, scripts/ci unit tests: OK

gg582 and others added 4 commits October 26, 2026 19:51
…eline (#446)

* feat(wasm): replace Emscripten browser bundle with WASI component pipeline (closes #203)

* ci(wasm): install wasmtime in component pipeline job for abi-layout check

(cherry picked from commit f6c7cfe)
Builds the socket-free CWIST core (the WASIP2 source set minus sqlite)
with arm-none-eabi-gcc for Cortex-M7, links a hello firmware driven only
through cwist_app_dispatch_memory(), and runs it under qemu-arm with
semihosting output. The shim/ headers and fw/port.c stand in for the
platform layer Phase 1 has to add; nothing in src/ or include/ changes.

(cherry picked from commit 67abb2d)
…e 1) (#449)

* feat(port): bare-metal Cortex-M build on capability guards (#447 Phase 1)

- include/cwist/sys/platform.h: CWIST_PLATFORM_HOSTED / _NO_PROC /
  _NO_SOCKETS derived from the target, plus CWIST_BAREMETAL (inferred for
  ARM EABI toolchains with no OS macro). Every __wasi__/__EMSCRIPTEN__ and
  CWIST_WASI_NO_SOCKETS capability guard now tests these; WASI-only API
  sites (wasi-libc getentropy, wasi:sockets quirks) keep their own tests.
  The rewrite is token-identical on native, CWIST_TINY, wasip2 and
  Emscripten builds (preprocessed output compared TU by TU).
- http.c: the socket worker runtime, send, direct-writer and receive
  sections compile only with sockets; bare metal keeps parse, route and
  serialize. Headers newlib does not ship are skipped on bare metal.
- include/cwist/sys/port.h: firmware hooks cwist_port_entropy() and
  cwist_port_monotonic_ns(), plain link-time symbols with no default.
- src/sys/port/baremetal.c: single-threaded pthread, clock_gettime,
  nanosleep, sched_yield, timegm and Cortex-M 64-bit __atomic helpers on
  top of newlib's own declarations (-D_POSIX_THREADS etc.).
- Entropy: siphash seeds come from the TRNG hook on bare metal and abort
  on failure instead of degrading to clock+rand(); session secrets and
  seq-auth nonces use the hook too.
- Date: no Date header when time() fails (no RTC), per RFC 9110 6.6.1,
  instead of 29 NUL bytes from the never-filled cache.
- gc.c: hash connection handles in 64 bits; a 33-bit shift of a 32-bit
  uintptr_t (wasm32, Cortex-M) was undefined.
- log_async takes the no-thread path on bare metal as on WASM.
- make baremetal / baremetal-smoke: libcwist_baremetal.a for Cortex-M7 and
  a hello firmware run under qemu-arm, with and without an RTC. Replaces
  the Phase 0 tools/stm32-spike harness.

* docs(api): record the bare-metal port hooks in the API baseline

cwist_port_entropy() and cwist_port_monotonic_ns() are new additive API
in <cwist/sys/port.h>; no existing entry changes.

* test(port): host unit test for the bare-metal port hooks

The API test-coverage ratchet needs every public function exercised by a
wired unit test; cwist_port_entropy() and cwist_port_monotonic_ns() are
firmware hooks that hosted builds never call.

- Move clock_gettime/nanosleep/timegm into src/sys/port/baremetal_time.c
  so the host can build it with those names renamed.
- tests/test_baremetal_port.c builds siphash.c and baremetal_time.c as
  CWIST_BAREMETAL without libcwist.a and checks: the siphash seed comes
  only from cwist_port_entropy() and the process aborts when the hook
  fails; CLOCK_MONOTONIC and nanosleep() run on cwist_port_monotonic_ns();
  timegm() matches known instants and the host libc across ~80 years.
- clock_gettime() drops its NULL check: POSIX does not require one and
  glibc's nonnull attribute lets the compiler delete it anyway.

(cherry picked from commit cd89984)
@github-actions

Copy link
Copy Markdown
Contributor

This PR targets main, but CWIST's contribution flow lands work on dev first (see CONTRIBUTING.md). Automatic redirect onto dev failed -- the commits didn't cherry-pick cleanly (likely a real content conflict against dev's current state, not just a base-branch mismatch).

A maintainer needs to recreate this PR's commits against dev by hand (git cherry-pick, preserving authorship) and close this one in favor of the recreation. Labeled needs-manual-dev-redirect for visibility.

@gg582
gg582 merged commit 3b16354 into main Oct 26, 2026
41 checks passed
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.

2 participants