feat(esp-idf): ESP-IDF network host for AtomS3R and Tab5 (stack C) - #307
Draft
HalfSweet wants to merge 2 commits into
Draft
feat(esp-idf): ESP-IDF network host for AtomS3R and Tab5 (stack C)#307HalfSweet wants to merge 2 commits into
HalfSweet wants to merge 2 commits into
Conversation
…ork task, bindings, AtomS3R and Tab5 (stack C) hosts/esp-idf (stacked PR C of three, on top of B's core): the product-host half of the network stack for ESP-IDF v6.0.2 — a QuickJS-ng guest owned by one task, fixed-rate frame() ticks with pnet_runtime_begin_tick before each, the globalThis.net / ws / httpd bindings, a network task under the runtime lock, the ESP-TLS TlsProvider with the IDF certificate bundle, board bring-up for the AtomS3R (native Wi-Fi) and the Tab5 (ESP32-P4 rev 1.3 + ESP32-C6 over SDIO), the headless smoke app and the firmware template, plus tools/net-peer.ts — the independent workstation peer.
…ne, real clock trust, plan-derived policy (stack C) The review fixes for the ESP-IDF host (stack C): - Cadence (reviewer item 5): tick k is scheduled at t0 + k/tick_hz on the microsecond timer instead of pdMS_TO_TICKS(1000/60) = 16 ms (62.5 Hz against a 60 Hz __simHz); late ticks still get their one turn, only a host more than 0.5 s behind drops ticks (stats.frames_skipped). Both boards report 1800 frames per 30.0 s. - Lifecycle (item 6): start() unwinds everything it created on any failure (TLS provider included, the network task joined when the guest task fails); stop() publishes a waiter, waits for both tasks' exit flags and frees only then (a wedged task is leaked with an error, never freed under); a QuickJS interrupt handler bounds a guest turn in progress while stopping; NULL guards on the failed-boot path. - Clock trust (item 7): plat_clock_trusted delegates to cfg.wall_clock_trusted (none = never trusted = TLS fails closed); the board layer latches the state from a completed SNTP sync and every re-sync, or an explicit setter — not time(NULL) > 2024. - Policy (item 1): the smoke firmware embeds the canonical ResolvedNetworkPolicy of its Build Plan. examples/net-smoke/pocket.json is a format-3 manifest; tools/esp-idf.ts (run by main/CMakeLists.txt) merges the rig's Kconfig endpoints, resolves the plan against the private atoms3r-dev / tab5-dev profiles (tools/esp-idf-profile.ts) and writes network-policy.json, host-inputs.h (plan hash, features → mounted roles) and app.js; main.c authors nothing. The bindings use the two-phase poll. README: the plan flow, the honest soak record, the TLS-under-lock stall. - Hardware: AtomS3R and Tab5 rebuilt, flashed, SMOKE PASS 26/26 each with the plan-derived policy and TLS under the SNTP-latched clock trust.
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
Stack C of 3 (on top of #306, stack B).
hosts/esp-idf: the ESP-IDF v6.0.2 product host — a QuickJS-ng guest owned by one task, fixed-rateframe()ticks withpnet_runtime_begin_tickbefore each, thenet/ws/httpdbindings, a network task under the runtime lock, the ESP-TLS provider with the IDF certificate bundle, board bring-up for the AtomS3R and the Tab5, the headless smoke app and firmware template, andtools/net-peer.ts(the independent workstation peer).Review-round changes in this PR (reviewer items 5, 6, 7, 1)
t0 + k / tick_hzon the microsecond timer instead ofpdMS_TO_TICKS(1000/60)= 16 ms (62.5 Hz against a 60 Hz__simHz). Late ticks still get their one turn (Law 3); only a host more than 0.5 s behind drops ticks (stats.frames_skipped). Both boards now report 1800 frames per 30.0 s.start()unwinds everything it created on any failure (TLS provider included; the network task is joined when the guest task fails);stop()publishes a waiter, waits for both tasks' exit flags and frees only then — a wedged task is leaked with an error, never freed under; a QuickJS interrupt handler bounds a guest turn in progress while stopping (stop_turn_budget_ms); NULL guards on the failed-boot path;guest_boot_failedand the plan hash in stats.plat_clock_trusteddelegates tocfg.wall_clock_trusted(none = never trusted = TLS fails closed); the board layer latches the state from a completed SNTP sync (and every re-sync via the SNTP notification) or an explicit setter — nottime(NULL) > 2024.ResolvedNetworkPolicyof its Build Plan:examples/net-smoke/pocket.jsonis a format-3 manifest;tools/esp-idf.ts(run bymain/CMakeLists.txt) merges the rig's Kconfig endpoints, resolves the plan against the privateatoms3r-dev/tab5-devprofiles (tools/esp-idf-profile.ts) and writesnetwork-policy.json,host-inputs.h(plan hash, features → mounted roles) andapp.js;main.cauthors nothing. The bindings use the two-phase poll. The README documents the plan flow, restates the soak record honestly (the earlier "12 minutes" was frames ÷ 60 on the 62.5 Hz host) and notes the ESP-TLS-under-lock stall the overload guard now makes visible.Hardware
AtomS3R (ESP32-S3) and Tab5 (ESP32-P4 rev 1.3 + C6): rebuilt, flashed, SMOKE PASS 26/26 each (plaintext suite against
tools/net-peer.tsand board-to-board, TLS block against public hosts and badssl.com under the SNTP-latched clock trust), with the plan hash logged at boot and the embedded plan policy.