Repository navigation
cherry-pick: WASI component pipeline (#446), bare-metal port (#448, #449), H3 migration tests (#450) to main - #451
Merged
Merged
Conversation
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)
(cherry picked from commit cb9d8d4)
Contributor
|
This PR targets A maintainer needs to recreate this PR's commits against |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Cherry-picks the dev merges since #445 that belong on main, in dev order (
git cherry-pick -x):f6c7cfe36feat(wasm): replace Emscripten browser bundle with WASI component pipeline (feat(wasm): replace Emscripten browser bundle with WASI component pipeline #446)67abb2d45tools(stm32-spike): Phase 0 Cortex-M7 feasibility harness (epic: bare-metal STM32 (Cortex-M) port via the dispatch_memory core + lwIP #447) (tools(stm32-spike): Phase 0 Cortex-M7 feasibility harness (#447) #448)cd8998477feat(port): bare-metal Cortex-M build on capability guards (epic: bare-metal STM32 (Cortex-M) port via the dispatch_memory core + lwIP #447 Phase 1) (feat(port): bare-metal Cortex-M build on capability guards (#447 Phase 1) #449)cb9d8d45btest(http3): add connection migration checks (test(http3): add connection migration checks #450)#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
.gitignore. main'stutorials/*/build/andbuild-tutorials/lines are kept. Theexample/wasm-service-worker/entries are taken from dev: thebuild/directory replaces the oldapp.js/app.wasmartifacts.docs/api/v4.0-api-baseline.txt. Regenerated withmake api-baselinefrom main's headers. The diff adds onlycwist_port_entropyandcwist_port_monotonic_ns(functions 781 → 783).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
2b30189built fresh for this check):make -j16 allandmake -k test: all targets pass, exit 0make baremetal-smoke: PASS (with and without an RTC)make wasip2-smoke: PASScheck_test_wiring,check_api_baseline(incl. the v4 guarantee),check_env_knobs,check_api_test_coverage,check_inline_exports,malloc_lint.sh,scripts/ciunit tests: OK