Skip to content

proto: C1-G airborne = "AP would mix", layout-independent version handshake, protocol v5 - #18

Merged
bugobliterator merged 10 commits into
masterfrom
feat/c1g-airborne-spool
Oct 10, 2026
Merged

bugobliterator merged 10 commits into
masterfrom
feat/c1g-airborne-spool

Conversation

@bugobliterator

@bugobliterator bugobliterator commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

C1-G: RateCommand.airborne is true when ArduPilot would mix (spool state), not when it believes it is flying; the M4 uses it to hold ground idle with zero differential authority while armed and not airborne. Semantics only (no field or size change).

Layout-independent version handshake (review finding on #9): a frozen 64 B bootstrap area at offset 0 of the split region (one 32 B half per core: magic, sequence, protocol version, layout hash, session, mismatchSeen), written seqlock-style by its single owner. Each core reads the peer half, so peers with different slot layouts now report VERSION_MISMATCH instead of appearing as "M4 not connected". Versioned slots start at 64. Protocol version 5, kLayoutHash 0x901359E1.

Pre-v5 peers publish no bootstrap half and use slots 64 bytes lower: they still appear disconnected (arming refused), not mismatched. Covered by a legacy-v4 peer in the POSIX multiprocess tests.

Also: null-base guards in the bootstrap functions; reverse (M4-TX/M7-RX) duplex coverage for registerAll.

Companion updates needed to pair with this release (v5):

  • ArduPilot CubeFramework integration: bump the CubeFramework submodule to this commit; call SplitLayout::publishBootstrap() after registerAll() and poll readPeerBootstrap() into the VERSION_MISMATCH pre-arm path (SITL gets the publish through PosixSplit::start).
  • Betaflight: bump lib/modules/CubeFrameworkSplit to this commit; same publish/poll on hardware.
  • Both: drop any hardcoded protocol 4 / 0xFC153163.

Testing: host CTest 19/19 on macOS and on Linux gcc 13 with ASan/UBSan; POSIX multiprocess tests 5/5 repeated on both; sim self-tests pass; SplitLayout/ShMemTransport/HSEM cross-compile for cortex-m7 and cortex-m4 without warnings. Not tested on hardware.

AI-assisted: implemented with Claude Code; reviewed with Copilot.

🤖 Generated with Claude Code

https://claude.ai/code/session_01KqxcxgduRYDCp2rs1XqK5M

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The semantic contract, version gate, layout hash, documentation, and compatibility tests are consistent.

0 open findings

What changed in this PR

Updates the split-core protocol contract for C1-G ground-idle semantics and rejects incompatible v3 peers.

Changes:

  • Redefines RateCommand.airborne as “ArduPilot would mix.”
  • Bumps the protocol version to 4 with the corresponding layout hash.
  • Adds v3 incompatibility coverage to layout and multiprocess tests.
File Description
CubePilotFW/​SplitProtocol.h Bumps the protocol version to 4.
proto/​Rc.proto Documents the revised airborne semantics.
docs/​cuberacer-split.md Updates the protocol contract and compatibility guidance.
tests/​split_layout_test.cpp Updates golden values and v3 rejection checks.
tests/​posix_multiprocess_test.cpp Tests v3 rejection in both core roles.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The semantic contract, compatibility versioning, hash assertions, and cross-process rejection coverage are consistent.

0 open findings

🧠 Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The implementation conflicts with the documented v4 deployment contract and does not faithfully test pre-bootstrap peers.

3 open findings

🧠 Review effort: Balanced

Comment thread CubePilotFW/SplitProtocol.h Resolved
Comment thread tests/posix_multiprocess_test.cpp Resolved
Comment thread sim/README.md Resolved
@bugobliterator
bugobliterator force-pushed the feat/c1g-airborne-spool branch from 38aa771 to 8996d60 Compare October 10, 2026 03:46
Base automatically changed from feat/c1f-crashflip to master October 10, 2026 03:56
bugobliterator and others added 6 commits October 10, 2026 15:04
The meaning of RateCommand.airborne changes, so the version moves to 4
and kLayoutHash changes through the version seed only (0xFC153163;
slots unchanged). The CoreInfo gate refuses a v3 peer on both cores:
a v3 M7 with a C1-G M4 would cut M4 authority when land_complete_maybe
flickers in flight.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit fc72b25)
…l v5

Each core publishes magic, protocol version, layout hash, session and
mismatchSeen in its own 32-byte half (M7 at 0, M4 at 32), written as a
seqlock without HSEM. Its layout is frozen, so cores with different slot
layouts can still compare versions. Slots move up by 64 bytes; golden
total 1984 and hash 0x901359E1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KqxcxgduRYDCp2rs1XqK5M
start() takes the protocol version and layout hash to publish (default:
this build) so SITL overrides reach the bootstrap area. The test peer
emulates builds with other versions and moved slots: both cores report
the mismatch from the bootstrap area and see the peer's mismatchSeen,
where CoreInfo alone times out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KqxcxgduRYDCp2rs1XqK5M
publishBootstrap and setBootstrapMismatchSeen write nothing and
readPeerBootstrap returns Absent, before deriving the half pointer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KqxcxgduRYDCp2rs1XqK5M
bugobliterator and others added 4 commits October 10, 2026 15:04
posix_peer legacy-v4 publishes no bootstrap half, registers the v4
slots (64 bytes lower) and sends v4 CoreInfo. In either role the v5
side reports "not connected" and the v4 side times out; the v5 half and
CoreInfo frame are checked afterwards. The bootstrap mode returns 39 if
CoreInfo arrives without a peer half.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KqxcxgduRYDCp2rs1XqK5M
@bugobliterator
bugobliterator force-pushed the feat/c1g-airborne-spool branch from 8996d60 to ee84385 Compare October 10, 2026 04:06
@bugobliterator bugobliterator changed the title proto: C1-G, RateCommand.airborne means "AP would mix", protocol v4 proto: C1-G airborne = "AP would mix", layout-independent version handshake, protocol v5 Oct 10, 2026
@bugobliterator
bugobliterator requested a balanced review from Copilot October 10, 2026 04:06

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The cross-core shared-memory synchronization and deployment compatibility changes remain unverified on hardware.

0 open findings

3 resolved since last review

🧠 Review effort: Balanced

@bugobliterator
bugobliterator merged commit 9b75338 into master Oct 10, 2026
1 check passed
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.

2 participants