mirror of
https://github.com/ruvnet/RuView.git
synced 2026-04-28 14:09:33 +00:00
ADR-081: implement Layers 1/2/4 end-to-end + host tests + QEMU hooks
Turns the ADR-081 scaffolding into a working adaptive CSI mesh kernel:
Layer 1 radio abstraction has an ESP32 binding and a mock binding; Layer 2
adaptive controller runs on FreeRTOS timers; Layer 4 feature-state packet
is emitted at 5 Hz by default, replacing raw ADR-018 CSI as the default
upstream.
New files:
firmware/esp32-csi-node/main/adaptive_controller_decide.c (pure policy)
firmware/esp32-csi-node/main/rv_radio_ops_mock.c (QEMU binding)
firmware/esp32-csi-node/tests/host/Makefile (host tests)
firmware/esp32-csi-node/tests/host/test_adaptive_controller.c
firmware/esp32-csi-node/tests/host/test_rv_feature_state.c
firmware/esp32-csi-node/tests/host/esp_err.h (shim)
firmware/esp32-csi-node/tests/host/.gitignore
Modified:
adaptive_controller.c — includes pure decide.c; emit_feature_state()
wired into fast loop (200 ms = 5 Hz)
rv_radio_ops_esp32.c — get_health() fills pkt_yield + send_fail
csi_collector.{c,h} — pkt_yield/send_fail accessors (ADR-081 L1)
rv_feature_state.h — packed size corrected to 60 bytes
(was incorrectly 80 in initial commit)
main.c — mock binding registered under mock CSI
CMakeLists.txt — rv_radio_ops_mock.c under CSI_MOCK_ENABLED
scripts/validate_qemu_output.py — 3 new ADR-081 checks (17/18/19)
docs/adr/ADR-081-*.md — status → Accepted (partial);
implementation-status matrix; measured
benchmarks (decide 3.2 ns, CRC32 614 ns);
bandwidth 300 B/s @ 5 Hz (99.7% vs raw);
verification section
CHANGELOG.md — artifact-level entries
Tests (host, gcc -O2 -std=c11):
test_adaptive_controller: 18/18 pass, decide() = 3.2 ns/call
test_rv_feature_state: 15/15 pass, CRC32(56 B) = 614 ns/pkt, 87 MB/s
sizeof(rv_feature_state_t) == 60 asserted
IEEE CRC32 known vectors verified
Deferred (tracked in ADR-081 roadmap Phase 3/4):
Layer 3 mesh-plane message types, role-assignment FSM, Rust-side mirror
trait in crates/wifi-densepose-hardware/src/radio_ops.rs.
This commit is contained in:
parent
9648a47fdc
commit
d53e29506e
18 changed files with 966 additions and 107 deletions
50
firmware/esp32-csi-node/tests/host/Makefile
Normal file
50
firmware/esp32-csi-node/tests/host/Makefile
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
# Host-side unit tests for ADR-081 pure-C logic.
|
||||
#
|
||||
# These tests exercise adaptive_controller_decide() and the rv_feature_state
|
||||
# helpers (CRC32, finalize) using plain gcc/clang, with a minimal esp_err.h
|
||||
# shim. No ESP-IDF, no FreeRTOS, no QEMU required.
|
||||
#
|
||||
# Usage:
|
||||
# cd firmware/esp32-csi-node/tests/host
|
||||
# make
|
||||
# ./test_adaptive_controller
|
||||
# ./test_rv_feature_state
|
||||
|
||||
MAIN_DIR := ../../main
|
||||
CC ?= cc
|
||||
CFLAGS ?= -O2 -std=c11 -Wall -Wextra -Wno-unused-parameter \
|
||||
-D_POSIX_C_SOURCE=199309L \
|
||||
-I. -I$(MAIN_DIR)
|
||||
LDLIBS ?= -lrt
|
||||
|
||||
# Pure-C sources under test. We compile only the files that have no
|
||||
# ESP-IDF dependency in their bodies: rv_feature_state.c is 100% pure.
|
||||
# adaptive_controller.c uses FreeRTOS for the timer plumbing, so for the
|
||||
# host test we compile only the decide() portion by isolating it in a
|
||||
# small unity file (TEST_ADAPT_PURE below).
|
||||
FEATURE_STATE_SRCS := $(MAIN_DIR)/rv_feature_state.c
|
||||
|
||||
# adaptive_controller.c pulls in FreeRTOS headers that don't exist on
|
||||
# host; we include its decide() function by defining TEST_ADAPT_PURE
|
||||
# before including the .c. The decide() body itself has no ESP-IDF deps.
|
||||
# Simpler: just recompile decide() here via a small shim.
|
||||
|
||||
TESTS := test_adaptive_controller test_rv_feature_state
|
||||
|
||||
all: $(TESTS)
|
||||
|
||||
test_adaptive_controller: test_adaptive_controller.c $(MAIN_DIR)/adaptive_controller_decide.c $(MAIN_DIR)/adaptive_controller.h $(MAIN_DIR)/rv_radio_ops.h
|
||||
$(CC) $(CFLAGS) test_adaptive_controller.c $(MAIN_DIR)/adaptive_controller_decide.c -o $@ $(LDLIBS)
|
||||
|
||||
test_rv_feature_state: test_rv_feature_state.c $(FEATURE_STATE_SRCS) $(MAIN_DIR)/rv_feature_state.h $(MAIN_DIR)/rv_radio_ops.h
|
||||
$(CC) $(CFLAGS) test_rv_feature_state.c $(FEATURE_STATE_SRCS) -o $@ $(LDLIBS)
|
||||
|
||||
check: all
|
||||
./test_adaptive_controller
|
||||
@echo ""
|
||||
./test_rv_feature_state
|
||||
|
||||
clean:
|
||||
rm -f $(TESTS) *.o
|
||||
|
||||
.PHONY: all check clean
|
||||
Loading…
Add table
Add a link
Reference in a new issue