Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions docs/implementation/K210_SPEC_MAPPING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# K210 implementation mapping

Informative mapping of firmware 0.9.0 at [baseline commit](https://github.com/aztechell/hackylens/commit/15acdd519874a09645d036b036f37273462fbe09) to the [candidate specification](../spec/v0.1/README.md). This is not a passing conformance report. Existing [architecture](../ARCHITECTURE.md) and [technical references](../spec/README.md) remain authoritative for concrete APIs.

| K210 choice | Portable requirement |
| --- | --- |
| Core 0 services/UI, core 1 VM/decoder | Serialized authority and bounded handoff, not core count |
| app.toml, generated C registry | Static validated semantic composition |
| MicroPython embed, 128 KiB GC heap | Declared finite engine resources |
| Single-slot RPC, uncached alias, barriers | Synchronized bounded handoff |
| Stable-address sessions and generation tokens | Non-aliasing ownership and lifetime |
| BASE/OVERLAY, fixed framebuffer | Declared features and transaction semantics |
| WDT1 reset | Independent recovery and autostart suppression |
| DVP, KPU, frame arena | Explicit borrows and shared services |
| littlefs, FAT32, HMPY | Separate storage and wire contracts |

## Traceability

Candidate evidence sources only; no tests were run for this mapping. Paths are repository-relative.

| Requirements | Existing contracts and code | Candidate tests/evidence |
| --- | --- | --- |
| ARC | docs/ARCHITECTURE.md; docs/RAM_BUDGET.md; tools/architecture_layers.toml | tests/test_app_architecture.py; tests/test_service_architecture.py; tests/test_resources.py; tests/test_app_sdk.py |
| CMP | docs/spec/APP_MANIFEST.md; tools/app_manifest.py; tools/app_composition.py; tools/app_registry.py | tests/test_app_manifest.py; tests/test_app_composition.py; tests/test_app_registry.py |
| LIF | docs/spec/APP_RUNTIME.md; firmware/src/app_runtime/runtime.c; sdk/include/hackylens/app/runtime.h; firmware/src/runtime/app_runtime_integration.c | tests/test_app_runtime_v2.py; tests/app_runtime_v2_harness.c; tests/app_runtime_mixed_harness.c; tests/app_runtime_production_harness.c |
| OWN | docs/spec/CAPABILITY_API.md; docs/spec/APP_SDK.md; firmware/src/services/frame_pool.c; frame_workspace.h; media_workspace.h | tests/test_camera_stream_lease.py; tests/test_shared_buffer.py; tests/test_app_runtime_v2.py |
| TIM, ERR, S-TIME | docs/spec/capabilities/TIME.md; firmware/include/hackylens/capability/common.h | tests/test_time_capability.py; tests/time_capability_harness.c |
| S-INPUT | docs/spec/capabilities/INPUT.md | tests/test_input_capability.py; tests/input_capability_harness.c |
| S-LIGHT | docs/spec/capabilities/LIGHTS.md | tests/test_lights_capability.py; tests/lights_capability_harness.c |
| S-DISP, S-RENDER | docs/spec/capabilities/DISPLAY.md; docs/spec/APP_RUNTIME.md | tests/display_normative_suite.c; tests/test_display_contract.py; tests/app_runtime_display_harness.c |
| S-LINK | docs/spec/capabilities/EXTERNAL_LINK.md | tests/external_link_normative_suite.c; tests/test_external_link_contract.py |
| S-POWER | docs/spec/capabilities/POWER.md | tests/test_power_off.py; tests/test_power_bus.py |
| S-ACCEL | docs/spec/capabilities/ACCELEROMETER.md | tests/test_accelerometer.py |
| SCR | docs/MICROPYTHON_API.md; docs/MICROPYTHON_RESEARCH.md; firmware/src/services/micropython_runtime.c; firmware/src/services/core1_executor.c; firmware/src/apps/micropython/micropython_bindings.c | tests/test_micropython_runtime.py; tests/test_micropython_bindings.py; tests/test_service_bindings.py; tests/test_micropython_app.py |
| REC | docs/WDT_HARDWARE_ACCEPTANCE.md | historical physical WDT1 test on both boards, 0.8.0-wdtfi at c57c81d; tests/test_hmpy_acceptance.py |

## Open conformance questions

- Core permits headless devices; current production integration opens BASE before start. Do not claim headless K210 qualification without testing.
- Cooperative deadlines do not preempt arbitrary native code. Audit finite provider steps, cancellation and exceptional cleanup; sampled host latency is not WCET.
- Native generations, script run IDs and operation tokens have different lifetimes. Script run ID wraps; verify non-aliasing of outstanding references rather than assuming all counters never wrap.
- Verify physical quiescence or quarantine of reachable borrowed storage after failed retirement. Logical invalidation alone is insufficient.
- Verify shared service semantics across native/script, not equal BASE/OVERLAY latency.
- Historical WDT hardware acceptance uses an earlier fault-injection build. Repeat for the claimed revision and publish raw logs where available. Reset hash preservation does not prove arbitrary power-cut consistency.
- Camera, vision, data and audio operation schemas are not yet frozen in the architecture specification. Existing SDK/wire contracts remain independent.
- Both physical boards use K210; fake/K210 normative tests share production code. No second SoC or independent runtime has been qualified.
- The new profile definitions and generalized requirements are proposed, not automatically proven by existing tests. Map each applicable requirement to actual pass/fail evidence using the [conformance plan](../spec/v0.1/CONFORMANCE.md).

## Research evidence

[UART Logger](../UART_LOGGER_STUDY.md), [Object Gate](../OBJECT_GATE_STUDY.md) and [Sky Glide](../SKY_GLIDE_STUDY.md) measure native/script workloads; [raw data](../research/) are separate. [Python-to-C](../PYTHON_TO_C.md) documents manual migration. These support research, not complete conformance. No particular benchmark ratio or RPC batching implementation is required by the specification.
10 changes: 10 additions & 0 deletions docs/spec/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Technical references

## Candidate architecture specification

- [HackyLens Architecture Specification v0.1](v0.1/README.md)
- [Portable service contracts](v0.1/SERVICES.md)
- [Conformance plan](v0.1/CONFORMANCE.md)
- [K210 implementation mapping](../implementation/K210_SPEC_MAPPING.md)

The candidate specification has an independent version. The concrete firmware
contracts below remain unchanged; no conformance claim is made by extraction.

[Architecture](../ARCHITECTURE.md) describes the current implementation.
These references describe public interfaces, resource lifetimes and physical
board constraints. Headers and behavioral tests should change with their docs.
Expand Down
33 changes: 33 additions & 0 deletions docs/spec/v0.1/CONFORMANCE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Conformance plan v0.1

Proposed evidence protocol, not an executable suite or passing report.
Normative requirements: [Architecture](README.md) and [Services](SERVICES.md).

A claim identifies exact implementation and specification revisions, profiles, features, bindings, configuration, limits, test revision, environment and results. Each applicable requirement needs PASS, FAIL, NOT RUN or NOT APPLICABLE with reason. Missing evidence is not PASS. An untested mandatory requirement prevents an unqualified claim. Host tests establish semantics; structural review establishes boundaries and bounded storage; target tests establish physical behavior. A fake backend is not an independent runtime.

| Case | Requirements | Required observation |
| --- | --- | --- |
| CT-01 | ARC-01..04 | Review declaration, dependency graph and capacities; exhaust bounded pools; no competing authority or unbounded growth. |
| CT-02 | CMP-01..03 | Duplicate IDs, missing required service, optional absence, reordered inputs and disabled app; correct rejection and stable registry identity. |
| CT-03 | LIF-01..03 | Launch A, switch B, reentrant close during start, ordered events; one foreground, clear state, no dispatch after close. |
| CT-04 | LIF-04, TIM-01 | Missed periods, budget excess, clock regression and overflow; no catch-up, common unwind. |
| CT-05 | LIF-05..06, ERR-02 | Inject validation, preparation, start, event, render, close and stop failures; exact callback counts/order and first error. |
| CT-06 | LIF-07..08, OWN-04..05 | Expired deadline, clock failure and safe-off failure; same deadline throughout, all cleanup attempted, local quarantine before reuse. |
| CT-07 | LIF-09, OWN-02 | Stale context/session/token after switch/reopen; reject without mutating new state; verify non-aliasing at identity exhaustion. |
| CT-08 | OWN-01..05, ERR-01 | Conflicting claims, copied handle, invalid buffer, cancellation and failed retirement; no unauthorized effects or premature reuse. |
| CT-09 | TIM-01..03, S-TIME-01 | Target/cancel/expiry race, excessive interval, overflow, freeze/regression; unchanged deadline and declared check bounds. |
| CT-10 | S-INPUT-01..02 | Transitions, holds, two readers and overflow; exact masks/lost count, independent resync. |
| CT-11 | S-LIGHT-01..02 | Overlap/disjoint claims, invalid values, expired close and failed safe-off; atomic claims and local quarantine. |
| CT-12 | S-DISP-01..02 | Clipping, zero area, overflow, stride, invalid state, stale borrow and failed present; correct pixels/trace and ownership. |
| CT-13 | S-RENDER-01..02 | Initial render, busy display, repeated and in-render invalidation, null render, callback/present failure; runtime transaction ownership. |
| CT-14 | S-LINK-01..02 | Mode conflict, invalid config, active switch, partial transfer, cancel, stale token and retirement failure; no stale buffer access. |
| CT-15 | S-POWER-01 | Unsupported action, pending preparation, expiry, hardware failure; no premature action, mount restoration where applicable. |
| CT-16 | S-ACCEL-01 | Absent, settling, signed sample, I/O error, unsupported motion; unchanged output on failure. |
| CT-17 | SCR-01..03 | Same shared service from native/script, normalized result and conflict parity; inspect common provider; saturate and stress handoff. |
| CT-18 | SCR-04..05, OWN-03..05 | Exit, exception, STOP, timeout, launcher close and delayed handoff; no reuse before quiescence; documented failure path. |
| CT-19 | REC-01..02 | Physical non-cooperation injection; independent recovery event, cause, suppressed autostart and committed data preservation where supported. |
| CT-20 | ARC-03, LIF-08, SCR-02..05 | Repeated launch/stop at capacity; report high-water and residual ownership; no monotonic growth of retained run-owned resources. |

Adapters translate calls and results but MUST NOT implement the behavior under test. Extract binding-neutral fixtures and trace oracles from existing harnesses; run against another implementation. Report timing endpoints and configured limits separately from sampled latency; percentiles are not WCET. Physical connector claims require an external peer. Recovery needs observed independent recovery, not only post-reset status. Fault injection is isolated from production.

Minimum report fields: specification, implementation revision, configuration, profiles, extensions/bindings, declared limits, suite revision, case results with evidence, unresolved requirement IDs. No independent suite execution is asserted by this document.
Loading