Skip to content

Svc::TlmPacketizer: shrink per-channel packetOffset storage from FwSignedSizeType to I16 - #3

Open
Mikefly123 wants to merge 1 commit into
fix/sched-tick-drop-annotationsfrom
fix/tlmpacketizer-i16-offset
Open

Svc::TlmPacketizer: shrink per-channel packetOffset storage from FwSignedSizeType to I16#3
Mikefly123 wants to merge 1 commit into
fix/sched-tick-drop-annotationsfrom
fix/tlmpacketizer-i16-offset

Conversation

@Mikefly123

Copy link
Copy Markdown

What

TlmPacketizer::TlmEntry stores FwSignedSizeType packetOffset[MAX_PACKETIZER_PACKETS]
per channel. The value is a byte offset into a ComBuffer-sized packet (bounded by
FW_COM_BUFFER_MAX_SIZE, typically a few hundred bytes) or the -1 "not in this
packet" sentinel -- a 64-bit signed type per slot is 4-8x oversized. Shrinks the array
to I16 (keeps the -1 sentinel; supports packet offsets to 32 KB) with a
config-time FW_ASSERT range guard retightened at the single assignment site in
setPacketList. No other changes needed: the sentinel comparisons and buffer-index
uses compile cleanly with I16 via integer promotion.

Why

On small targets this field dominates the component's footprint. Diff is 3 lines +
2 comment lines.

Validation

Measured on a real CubeSat deployment (MAX_PACKETIZER_CHANNELS=202,
MAX_PACKETIZER_PACKETS=22, RP2350/Zephyr, PROVES v5e flight board):

  • -27,472 B BSS in CdhCore::tlmSend (60,480 -> 33,008 B, -45%)
  • Svc/TlmPacketizer UTs: 12/12 passed (1 pre-existing skip, present in stock config too)
  • HWIL-verified: clean boot, no fault/reboot over session; telemetry decodes
    bit-correct (49 distinct channels, sane values); NO_OP round-trip PASS; SEND_PKT
    PASS for Beacon and Health packets; live heap walk (sys_heap) matches the
    nm-predicted BSS delta exactly -- free-at-boot grew 11,504 -> 38,976 B (+239%),
    reclaimed BSS moved 1:1 into the malloc arena.

Base branch note

This PR targets pcr-usp-base, a branch pinned at 8a62e455a90b6d4f498c332d45d65a2a819988d8
(the v4.2.2-era commit that lib/fprime is pinned to in
proves-core-reference#439),
not devel, which has diverged significantly from that pinned commit.

Provenance

This change was not carried as a reusable branch on Mikefly123/fprime; it was
prototyped directly against 8a62e455 and applied here from the source patch
(fprime-tlmpacketizer-i16-offset.patch, see
proves-core-reference bench-diag logs) onto pcr-usp-base. Byte-equivalent by
construction (the patch applied cleanly with no fuzz).

Related

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 97e39638-818e-47e5-bbbb-42b0e8ec4365

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

…gnedSizeType to I16

TlmEntry stores FwSignedSizeType packetOffset[MAX_PACKETIZER_PACKETS] per
channel. The value is a byte offset into a ComBuffer-sized packet (bounded
by FW_COM_BUFFER_MAX_SIZE, typically a few hundred bytes) or the -1
'not in this packet' sentinel -- a 64-bit signed type per slot is 4-8x
oversized. Shrink to I16 (keeps the -1 sentinel; supports packet offsets
to 32 KB) with a config-time FW_ASSERT range guard at the single
assignment site in setPacketList.

Validated on a real CubeSat deployment (MAX_PACKETIZER_CHANNELS=202,
MAX_PACKETIZER_PACKETS=22, RP2350/Zephyr, v5e flight board):
- -27,472 B BSS (60,480 -> 33,008 B, -45%) in CdhCore::tlmSend
- Svc/TlmPacketizer UTs: 12/12 passed (1 pre-existing skip)
- HWIL-verified: clean boot, NO_OP round-trip, packetized telemetry
  decodes bit-correct, SEND_PKT works; live heap walk matches nm
  prediction exactly (free-at-boot 11,504 -> 38,976 B)

Tracked by Open-Source-Space-Foundation/proves-core-reference#469.
@Mikefly123
Mikefly123 force-pushed the fix/tlmpacketizer-i16-offset branch from 6a26dce to a80c4f6 Compare July 31, 2026 03:00
@Mikefly123
Mikefly123 changed the base branch from pcr-usp-base to fix/sched-tick-drop-annotations July 31, 2026 03:00
@Mikefly123

Copy link
Copy Markdown
Author

Stack position 3/3 (top) of stack nasa#6: #1#2#3, base fix/sched-tick-drop-annotations (rebased onto #2, force-pushed). Linked via gh stack link. Stack-top tree verified byte-identical to feat/proves-usp-radio@baf163f.

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.

1 participant