This package integrates F Prime and Zephyr RTOS allowing F Prime applications to run on the Zephyr RTOS! This document will walk through how to construct an F Prime deployment that works with this package.
Add this module as a submodule to your project (typically in lib/fprime-zephyr) and update the library_locations key in settings.ini to point to it.
[fprime]
...
library_locations: ./lib/fprime-zephyr: ...Finally, you should install the west Python package in your virtual environment. This is used by Zephyr to fetch support modules, and much more!
pip install westTip
Remember to source your project's virtual environment before running the above command.
In order to ease developent and support of F Prime + Zephyr, we recommend projects follow this recommended directory structure.
project-folder/
│
├── proj.conf # REQUIRED: Zephyr Kconfig options for this app
├── west.yml # REQUIRED: West manifest (declares external modules)
├── CMakeLists.txt # Top-level CMake entry for the project (created by fprime-bootstrap)
│
├── .west/ # West workspace metadata
│ └── config # REQUIRED: west configuration for this structure
│
├── Project/ # Your F Prime project
│
├── lib/
│ ├── fprime/ # Core F´ framework (created by fprime-bootstrap)
│ ├── fprime-zephyr/ # Zephyr platform support for F Prime (added as submodule)
│ └── zephyr-workspace/ # Zephyr + modules workspace (created by west update)
│
└── boards/ # OPTIONAL: custom board definitions and overlaysThe initial fprime-bootstrap and git submodule add steps to include this directory in a new project will create most of this structure. Users must create the following files.
proj.conf: contains the Zephyr KConfig options for the projectwest.yml: configuration for the extra modules used by Zephyr.west/config:westtool configuration setup to work with the above recommended structure
Tip
fprime-zephyr provides initial samples for each of these files as linked above.
Caution
Make sure to put the sample in a hidden .west directory, as west requires this for its configuration.
- (Optional)
boards/<overlay>.overlay: Board specific overlay files for configuring the Zephyr Device Tree
Caution
The overlay provided is specific to the RPI Pico 2's M33 processor. Projects should configure their overlay files specifically to their board and usecase. See: Zephyr Device Trees for the whole story.
This step will install Zephyr, its modules, and the necessary Python tooling using your west.yml as the intial configuration. If you followed the recommended structure, installing Zephyr should be as easy as:
cd project-folder
west update
west packages pip --install
west sdk install
Tip
These commands will take quite some time to run.
In order to integrate Zephyr and F Prime CMake systems, you should add the following lines to your top-level CMakeLists.txt file, before the project() call:
# Enable Zephyr when not performing a unit testing build
if (NOT BUILD_TESTING)
find_package(Zephyr HINTS "${CMAKE_CURRENT_LIST_DIR}/lib/zephyr-workspace")
endif()
project(...)
...In order to turn an F Prime deployment into a Zephyr deployment, you need to add the following calls to your deployment's CMakeLists.txt file:
register_fprime_zephyr_deployment(
${FPRIME_CURRENT_MODULE}
SOURCES
"${CMAKE_CURRENT_LIST_DIR}/Main.cpp"
DEPENDS
${FPRIME_CURRENT_MODULE}_Top
)Tip
This will add Main.cpp to the Zephyr app target source list and sets up the topology module as a dependency.
In order to build with F Prime Zephyr, users must specify the BOARD environment variable (used by Zephyr) and the zephyr toolchain used by F Prime.
fprime-util generate -DBOARD=rpi_pico2/rp2350a/m33 zephyr
fprime-util build zephyr