Skip to content

feat: support payloads up to 65,528 bits - #7

Merged
aajll merged 1 commit into
masterfrom
feat/6-larger-payloads
Sep 8, 2026
Merged

aajll merged 1 commit into
masterfrom
feat/6-larger-payloads

Conversation

@aajll

@aajll aajll commented Sep 8, 2026

Copy link
Copy Markdown
Owner

Why

The PEBB persisted parameter image is already 496 bits. Calibration fields will exceed the codec's CAN-FD-derived ceiling, although the flash record has room. A record is not a CAN frame.

Closes #6.
Related: https://github.com/Next-Gen-MP/pebb-firmware/issues/178. A cross-reference comment records the agreed alternative to consumer-side chunking.

Change

  • Accept positive multiples of eight through 65,528 bits, or 8,191 logical octets.
  • Publish PPACK_MAX_PAYLOAD_BITS and use it for runtime and compile-time validation.
  • Replace potentially overflowing field-end addition with ordered subtraction.
  • Preserve function signatures, descriptor layout, bit-copy loops, conversion logic, 32-bit field widths and the 64-bit default buffer.
  • Bump the library version to 2.5.0 and document caller obligations.

Callers must allocate sufficient buffers and enforce transport limits. Valid sizes above 512 bits no longer fail before buffer access. Error rollback, CRC, atomic record publication and format-version policy remain outside ppack.

Verification

Local checks passed:

  • 128 tests per storage model under GCC 14.2 with ASan, UBSan and float-cast-overflow checks.
  • Independent bit-at-a-time reference checks for 2,096,400 legal start/width pairs, plus every legal payload size, boundary bit patterns, mixed types, guards, clearing and malformed geometry.
  • Exact side-by-side comparison with the unmodified 2.4.0 codec, 5,512,760 pack/unpack cases per storage model. The old source is pinned in CI, not copied into the repository.
  • Existing golden-byte fixtures unchanged, plus a 496-bit prefix-preservation test when fields extend beyond bit 512.
  • 100% line coverage: 229/229. 100% branch coverage: 108/108.
  • Maximum default-buffer override passes both storage models. CI retains the 512-bit override and adds 65,528.
  • misch run 0.4.0 reports zero findings. misch deviations validates all existing deviations. No new deviations.
  • TI C2000 22.6.2.LTS and 25.11.1.LTS compile the release library with default and maximum buffer definitions.
  • GCC release build, clangd diagnostics, clang-format no-diff check, 80-column C/header scan and git diff --check pass.

The verification record gives the range argument and reproduction commands. It is not a machine-checked formal proof. No target hardware or instruction-set simulator was available for execution. The consumer still needs target runtime and whole-record recovery tests.

Review

Reviewed the change against issue #6 for correctness, repository standards and scope. No unresolved findings. No pre-commit configuration is present.

Merge only after the Linux/macOS sanitizer and compatibility jobs, both override builds, release build and 100% coverage gate pass.

Flash parameter records need to grow beyond CAN-FD frame capacity. Keep transport limits in callers while retaining descriptor layout, field conversions, wire bytes and the 64-bit default buffer.

Use a shared maximum and overflow-safe field validation. Check every legal field geometry against an independent model and compare legacy pack/unpack results with the pinned 2.4.0 implementation in CI.

Validation: native and simulated-MAU sanitizers, 100% line/branch coverage, zero misch findings or new deviations, and TI C2000 22.6.2/25.11.1 release compilation at default and maximum buffer sizes. Target execution remains a consumer integration check.

Closes #6
@aajll

aajll commented Sep 8, 2026

Copy link
Copy Markdown
Owner Author

Final review completed against issue #6 and the pre-extension source.

  • Correctness: no unresolved findings. Accepted bit indices remain within uint16_t, ordered subtraction avoids range-check wrap, and packing/conversion code is unchanged.
  • Standards: no unresolved findings. No allocations or new MISRA deviations. Format, 80-column scan and clangd diagnostics pass.
  • Spec: all library acceptance criteria are met. Firmware adoption and target execution remain explicitly outside this PR.

CI run 34221909897 passed all six jobs, including Linux/macOS sanitizer and legacy comparison tests, both buffer overrides, release compilation and the 100% line/branch coverage gate. Local misch run reports zero findings and validates all existing deviations. Both TI C2000 toolchains compile at default and maximum buffer sizes.

Merging the tested head c79ad7b634afb36f7513ef6b370b6ee8e2e2b29f with the owner's authorization.

@aajll
aajll merged commit 899dc8d into master Sep 8, 2026
6 checks 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.

feat: extend payload support to 65,528 bits

1 participant