Skip to content

Upgrade to F Prime 4.3.0 - #508

Closed
nateinaction wants to merge 3 commits into
Open-Source-Space-Foundation:mainfrom
nateinaction:upgrade/fprime-4.3.0
Closed

Upgrade to F Prime 4.3.0#508
nateinaction wants to merge 3 commits into
Open-Source-Space-Foundation:mainfrom
nateinaction:upgrade/fprime-4.3.0

Conversation

@nateinaction

Copy link
Copy Markdown
Collaborator

Upgrades the project to F´ 4.3.0, tracking nasa/fprime v4.3.0 and the matching fprime-zephyr#27.

What's here

  • Bump lib/fprime to v4.3.0 and pull the matching tooling via lib/fprime/requirements.txt.
  • fprime-zephyr: merge upstream (std::atomic shim for the lockless priority queue, RawTime rework, ADC driver) and reapply the install DESTINATION / FPRIME_INSTALL_DEST / counting-semaphore-stub changes 4.3.0 needs (see fprime-zephyr#27).
  • fprime-extras: config modules can no longer depend on Fw_Types, since Fw/FPrimeBasicTypes.h now includes config-generated type aliases.
  • Refresh the project config overrides with the constants 4.3.0 added: CpuAffinities modules, FrameContext secondary-header/sequence-flag/PVN fields, SaIndexUnset, SequenceArgumentsMaxSize, FW_COUNTING_SEMAPHORE_HANDLE_MAX_SIZE, FW_STRICT_ASSERTIONS, FW_DIRECT_PORT_CALLS, FW_ASSERTIONS_ALWAYS_ABORT, FW_SERIALIZE_FORCE_INLINE_LBB and Svc::CmdDispatcherCfg.
  • Command handlers now take non-primitive arguments by const reference.
  • CmdSeqIn carries Svc::SeqArgs, so sequence start ports and callers pass it through.
  • Deployments model as FPP systems: add Top/system.fpp and mark the topology as a deployment topology.
  • Omit the telemetry channels 4.3.0 added (CS_CurrentSequence, FilesReceivedFailed, EventsDropped) from the packet set.
  • Zephyr builds C++14, which 4.3.0 requires.

Two runtime faults found bringing the upgrade up on hardware, and their fixes:

  • Kernel panic on boot. Enabling 4.3.0's FW_DIRECT_PORT_CALLS default reorders component initialization so LoadSwitch read its GPIO before ZephyrGpioDriver had configured the pin spec, tripping a Zephyr __ASSERT in gpio_pin_get_dt and panicking the kernel during topology setup. The board enumerated USB but never downlinked a frame. Root cause was ModeManager::init() doing port I/O from init() (which runs before connectComponents()/configureTopology()) — that was never valid, direct port calls just made it deterministic. Fixed by moving the load-switch state restore into restorePersistentState(), called from setupTopology() after configureTopology(), so direct port calls could be turned back on.
  • Malformed uplinked commands. In 4.3.0, Fw::Buffer::setData() implies advance(), which also shrinks the size. TcSecurityDeframer's old setData(ptr + header) followed by setSize(size - header - trailer) subtracted the header twice, so uplinked commands reached SpacePacketDeframer short by the header length and were rejected. Fixed by using Fw::Buffer::advance() instead.

Testing

Bench: 19 passed, 6 skipped, 4 failed — identical to the pre-upgrade indirect-port-call build, so no regression. Flash 64.64%, RAM 56.70%.

- Bump lib/fprime to v4.3.0 and pull the matching tooling in via
  lib/fprime/requirements.txt.
- fprime-zephyr: merge upstream (std::atomic shim for the lockless
  priority queue, RawTime rework, ADC driver) and reapply the install
  DESTINATION / FPRIME_INSTALL_DEST / counting-semaphore-stub changes
  that 4.3.0 needs.
- fprime-extras: config modules can no longer depend on Fw_Types, since
  Fw/FPrimeBasicTypes.h now includes config-generated type aliases.
- Refresh the project config overrides with the constants 4.3.0 added:
  CpuAffinities modules, FrameContext secondary-header/sequence-flag/PVN
  fields, SaIndexUnset, SequenceArgumentsMaxSize,
  FW_COUNTING_SEMAPHORE_HANDLE_MAX_SIZE, FW_STRICT_ASSERTIONS,
  FW_DIRECT_PORT_CALLS, FW_ASSERTIONS_ALWAYS_ABORT,
  FW_SERIALIZE_FORCE_INLINE_LBB and Svc::CmdDispatcherCfg.
- Command handlers now take non-primitive arguments by const reference.
- CmdSeqIn carries Svc::SeqArgs, so sequence start ports and callers
  pass it through.
- Deployments model as FPP systems: add Top/system.fpp and mark the
  topology as a deployment topology.
- Omit the telemetry channels 4.3.0 added (CS_CurrentSequence,
  FilesReceivedFailed, EventsDropped) from the packet set.
- Zephyr builds C++14, which 4.3.0 requires.
Two runtime faults found on the bench with the upgraded firmware:

- Keep indirect port calls. Enabling 4.3.0's FW_DIRECT_PORT_CALLS default
  reorders component initialization so LoadSwitch reads its GPIO before
  ZephyrGpioDriver has configured the pin spec, tripping a Zephyr
  __ASSERT in gpio_pin_get_dt and panicking the kernel during topology
  setup. The board enumerated USB but never downlinked a frame.
- Use Fw::Buffer::advance() in TcSecurityDeframer. In 4.3.0 setData()
  implies advance(), which also shrinks the size, so the old
  setData(ptr + header) followed by setSize(size - header - trailer)
  subtracted the header twice. Uplinked commands then reached
  SpacePacketDeframer short by the header length and were rejected as
  malformed.
ModeManager::init() called loadState(), which drives the load switches
via gpioGet_out/gpioSet_out. init() runs inside initComponents(), the
first step of setupTopology -- before connectComponents() wires the
ports and before configureTopology() opens the GPIO drivers. Reading an
unconfigured gpio_dt_spec trips a Zephyr __ASSERT inside gpio_pin_get_dt
and panics the kernel during startup, so the board enumerated USB but
never downlinked a frame.

Doing port I/O from init() was never valid; taking 4.3.0's
FW_DIRECT_PORT_CALLS default of 1 just made it deterministic. Replace
the init() override with restorePersistentState(), called from
setupTopology() after configureTopology(), and turn direct port calls
back on.

Bench: 19 passed, 6 skipped, 4 failed -- identical to the indirect
build, so no regression. Flash 64.64%, RAM 56.70%.
@coderabbitai

coderabbitai Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant