F Prime Getting Started

Getting Started with F´

Qertile 郭泰爾
3 min readAug 2, 2022

Enviroment
Linux: Ubuntu LTS 20.04
FPrime: latest / branch: devel
Python: 3.9.11
CMake: 3.24.0
OpenSSL: 1.1.1f

Steps

  • Generate a native build
  • Implement component
  • Implement unit test
  • Build component
  • Build deployment
  • Perform unit test
  • Run the deployment

Generate components

cd fprime/Ref/SignalGen
fprime-util generate

Implement and build components

fprime-util impl
fprime-util impl --ut
fprime-util build

Build Deployment

cd fprime/Ref
fprime-util build

Perform Unit Test

cd fprime/Ref
fprime-util generate --ut
cd fprime/Ref/SignalGen
fprime-util build --ut
fprime-util check

Running the deployment

./build-artifacts/Linux/bin/Ref
# ctrl-C to exit the application

It should be like this, before showing errors.

Description

Terminology

  • Port
    - A connection between Components
    - Act as a defined interface to a component
  • Component
    - The location of program behavior
    - May define Commands, Event, Channels, and Parameters
  • Topology
    - A set of Components and connections
    - Represents the full F’ system
  • Event
    - AKA EVR
    - A history of the system
    - Defined pre-component
  • Channel
    - Represents current system state
    - Defined pre-component
  • Command
    - Consist of opcode, mnemonic, and arguments
    - Defined pre-component
  • Deployment
    - A single instance of F’, represents one build/executable
  • Build Directory/Build Cache
    - Created by Fprime-util
    - Required to build CMake projects
  • Ground System
    - A computer system to collect data from F’ deployment
  • Toolchain
    - A set of build tools to build for a specific architecture

Deployment process

  • Design any unique ports for the Components
    - The port can be built and compiled to make sure it is correct
    - The port will be entirely auto-generated
    - Usually perform unit test until component level
  • Design Components
    - Specifying Ports, Commands, Events, Channels
    - The design is already in-place in the user guide
    - the design is in Ref directory
  • Implement the code
    - Runs the F’ tool suite to generate template stubs
    - Unit test tubs generate in the same way
    - Test tubs could be generated and implemented before Component’s code

Finally, the Component is integrated into the deployment and the entire deployment may be built and installed.

Working the F´ Development Process with fprime-util

  • Build Cache Generation
    - It’s a setup step, not development process
    - Typically done once for each platfom
    - Use generate subcommand to run the tool
    - It takes the toolchain file used in CMake as an optional argument
    - The native toolchain will be used and F´ will be setup to run on the current platform
  • To generate a native build
cd fprime/Ref
fprime-util generate

This will create 2 standard builds
- standard build
- unit test build
User won’t need to generate their own CMake build caches

Generate Cross-Compile of the Ref Application for Raspberry PI Platform

cd fprime/Ref
fprime-util generate raspberrypi

Creating Implementation Stubs

  • Using impl to generate the stubbed implementations of a Component’s C++ file
  • No need to passing a toolchain in this step as the templates are platform independent
cd fprime/Ref/SignalGen
fprime-util impl
  • This will creat <Component>Impl.cpp-template and<Component>Impl.hpp-template
  • The file is ready for C++ developement
  • The command assume a default build has been generated

Creating Unit Test Implementations

  • Using Impl --ut generate the stubbed implementations for creating unit test for Component
  • This step is also platform independent

Generating Unit Test Stubs of SignalGen

  • This step will create some .cppand .hppfiles in a sub folder /test/ut
  • The command assume a default build has been generated
cd fprime/Ref/SignalGen
fprime-util impl --ut

Building Components and Deployments

  • After implemented, we need to build the component and test it.
  • This command will build to “current directory”
cd fprime/Ref/SignalGen
fprime-util build

Build Ref Deployment

  • cd to the deployment directory and run the build command
cd fprime/Ref
fprime-util build

Building and Running Unit Tests

  • generate the unit test cache
  • build the unit test and run with check
cd fprime/Ref
fprime-util generate --ut
cd fprime/Ref/SignalGen
fprime-util build --ut
fprime-util check

--

--

Qertile 郭泰爾
Qertile 郭泰爾

Written by Qertile 郭泰爾

學習路上順便做點筆記留下痕跡OUO,怕以後忘了曾經所學的這些知識。

No responses yet