Skip to content

feat: Zephyr calculator, anti-pinch controller + OSxCAR WASM compilation#62

Merged
avrabe merged 1 commit intomainfrom
feat/examples-osxcar
Mar 21, 2026
Merged

feat: Zephyr calculator, anti-pinch controller + OSxCAR WASM compilation#62
avrabe merged 1 commit intomainfrom
feat/examples-osxcar

Conversation

@avrabe
Copy link
Contributor

@avrabe avrabe commented Mar 21, 2026

Summary

Zephyr Calculator (closes #21)

  • 14 WASM functions: arithmetic, accumulator (memory-backed), bitwise, comparison
  • ARM Thumb-2 assembly + Zephyr app with 32-assertion self-test
  • west build -b qemu_cortex_m3 examples/zephyr-calculator

Anti-Pinch Window Controller (safety-critical automotive)

  • Inspired by OSxCAR demo
  • 11 functions: jam detection, PWM soft-start/stop, position tracking
  • Integer-only, STPA-linked rivet artifacts (AP-001..003)

OSxCAR WASM Compilation Test

  • Fetches real production WASM from osxcar.de
  • Extracts 3 components (anti-pinch, motor-driver, soft-start-stop) from base64-encoded JS
  • All 3 compile to ARM Cortex-M ELF via synth:
    • Anti-pinch: 13KB WASM → 8,392 bytes ARM (aptiv:antipinch/anti-pinch-v2@0.1.0)
    • Motor driver: 2.5KB → 1,844 bytes ARM
    • Soft start: 1.8KB → 1,728 bytes ARM

Test plan

  • cargo test --workspace — 851 tests, 0 failures
  • cargo clippy — clean
  • bash tests/integration/fetch_osxcar_wasm.sh — 3/3 components compile
  • synth compile calculator.wat — 14 functions, 238 bytes
  • synth compile anti_pinch.wat — 11 functions, 1,494 bytes

🤖 Generated with Claude Code

Zephyr calculator (#21):
- 14 exported functions (add/sub/mul/div_safe, accumulator, bitwise, min/max/abs)
- ARM Thumb-2 assembly + Zephyr app with self-test suite
- Build: west build -b qemu_cortex_m3 examples/zephyr-calculator

Anti-pinch window controller (safety-critical automotive):
- 11 exported functions: init, set_target, update_current, tick, check_jam, etc.
- Debounced jam detection, soft-start/stop PWM ramping, position tracking
- Integer-only arithmetic (fixed-point 0.1% resolution)
- STPA-linked rivet artifacts (AP-001..003, AP-VER-001)
- Build: west build -b qemu_cortex_m3 examples/anti-pinch-controller

OSxCAR WASM compilation test:
- Fetches real anti-pinch WASM from https://osxcar.de/insights/demonstration/
- Extracts base64-encoded modules from JavaScript component files
- Compiles all 3 components (anti-pinch, motor-driver, soft-start-stop) through synth
- Anti-pinch: 13KB WASM → 8,392 bytes ARM code (3 functions)
- Motor driver: 2.5KB WASM → 1,844 bytes ARM code (3 functions)
- Soft start: 1.8KB WASM → 1,728 bytes ARM code (2 functions)

Closes #21

Implements: FR-002
Implements: FR-005
Implements: AP-001
Trace: skip

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@avrabe avrabe merged commit 26c56a8 into main Mar 21, 2026
6 checks passed
@avrabe avrabe deleted the feat/examples-osxcar branch March 21, 2026 19:11
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.

Create Zephyr calculator application

1 participant