Skip to content

Provide a standard solution for "compacting" F Prime ports on constrained systems #3986

@celskeggs

Description

@celskeggs
F´ Version latest
Affected Component fpp autocode

Feature Description

On a microcontroller project that I'm working on, the overhead of F Prime components and ports is too high. I have constrained code memory, constrained data memory, and stringent performance requirements.

Port definitions and port calls in F Prime tend to be large:

  1. It take many instructions to execute each port call. These instructions both take up valuable code space and slow down microcontroller execution every time the port call is invoked. They cannot be optimized out even under Link Time Optimization because the port function pointer acts as an "optimization barrier." I've previously shared detailed examples of this with the F Prime team, but I'm happy to dig them up again if it would be useful.
  2. Port definitions take up R/W data memory rather than R/O data memory, and they tend to be large: Each output port on our platform is 24 bytes, and each input port on our platform is 40 bytes. If we have 5 instances of a component with 49 input ports and 4 output ports (yes, we have a real-world use case for that), that's already over 10 KiB of mutable port data that will never need to change after initialization. For reference, the minimum R/W data memory per component on our platform is 16 bytes, so port definitions dominate the overhead of using F Prime.

We can contort our design to avoid these costs, but then the resulting codebase will be more difficult for us to develop and maintain, and less reusable by future missions.

I would like F Prime to find a way to "compact" port calls and port definitions, both in terms of number of instructions and mutability of data. The current approach of dynamically initializing port connections at runtime, even though the topologies are known at compile time, appears to be the underlying cause of these problems.

Rationale

Better support for using F Prime for microcontroller software.

Metadata

Metadata

Assignees

Labels

FPPIssues related to FPP

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions