fprime

框架

nasa/fprime

航天飞行软件与嵌入式系统框架,支持快速开发。

项目简介

F´ 是 NASA JPL 开发的组件驱动框架,用于构建飞行软件和嵌入式系统。提供建模工具、C++ 内核和可重用组件,适用于小型卫星和仪器。

README 预览

A Flight-Proven, Multi-Platform, Open-Source Flight Software Framework\n\n\n\n\n#\nF´ (F Prime) is a component-driven framework that enables rapid development and deployment of spaceflight and other embedded software applications. Originally developed at the [Jet Propulsion Laboratory](https://www.jpl.nasa.gov/), F´ has been successfully deployed on [several space applications](https://fprime.jpl.nasa.gov/overview/projects/). It is tailored but not limited to small-scale spaceflight systems such as CubeSats, SmallSats, and instruments.\n\n**Please Visit the F´ Website:** [https://fprime.jpl.nasa.gov](https://fprime.jpl.nasa.gov/) for more information.\n\n\n## What does F´ provide\n\n- An architecture that decomposes flight software into discrete components with well-defined interfaces\n- A C++ framework that provides core capabilities such as message queues and threads\n- Modeling tools for specifying components and connections and automatically generating code\n- A growing collection of ready-to-use components\n- Testing tools for testing flight software at the unit and integration levels.\n\nLearn more about [F´ key features](https://fprime.jpl.nasa.gov/overview).\n\n\n## System Requirements\n\nThe following system requirements apply to your workstation for developing F´ applications. To see the list of supported platforms on which F´ applications can run on, see [Supported Platforms](./docs/user-manual/framework/supported-platforms.md).\n\n1. Linux, Windows with WSL, or macOS operating system\n\n2. [git](https://git-scm.com/)\n\n3. [Python 3.10+](https://www.python.org/downloads/), [virtual environments](https://docs.python.org/3/library/venv.html), and [PIP](https://pypi.org/project/pip/)\n\n4. [Clang](https://clang.llvm.org/) or [GNU C and C++ compilers](https://gcc.gnu.org/) (e.g. gcc and g++)\n\n\nClick to Expand: How to Verify System Requirements\n\n2. `git --version`\n\n3. `python --version` and `python -m venv -h`. Your system might use an alternate like `

常见问题 (5)

故障排除
如何修复 F´ Svc/Health 单元测试中的不可达测试体?

编辑 Svc/Health/test/ut/HealthTester.cpp。移除 warningTlm() 中过早的 return;,使针对 ISF-HTH-002 的警告超时断言得以运行,并验证预期的 HLTH_PING_WARN 事件。同样移除 nominal2CmdsDuringTlm() 中过早的 return;,然后处理由禁用/启用命令发出的 HLTH_CHECK_ENABLE 事件——在后续的零事件断言之前清除这些预期事件。无需修改生产代码。重新构建并运行 Svc_Health_ut_exe;所有 11 个测试都应通过。

来源 Issue #6147
故障排除
如何修复在 STOP_XMIT_CATALOG 之后执行 BUILD_CATALOG 时,因迟到的 fileDone 到达而引发的 F´ DpCatalog FATAL assert?

此问题已在 F´ PR #5797 中修复,并于 2026-09-30 合并到 devel 分支。请将你的 F´ 检出或依赖更新到包含该 PR 的 devel 提交,然后重新构建:

git fetch origin
git merge origin/devel   # 或根据需要 rebase/cherry-pick PR #5797

该修复将对滞留 fileDone 的处理改为使用现有的恢复路径,而不再在 DpCatalog.cpp:801 处触发 FW_ASSERT;它会清除传输状态,完成任何等待中的命令,并发出一个警告事件。

在修复之前的受影响提交上,作为变通方法,请将命令串行化执行:在 STOP_XMIT_CATALOG 之后,等待 FileDownlink 返回当前文件的 fileDone(STATUS_OK),然后再发出 BUILD_CATALOG。不要在前一个文件仍在传输时使用 CLEAR_CATALOG 后再接 BUILD_CATALOG,因为这会触发相同的断言。

来源 Issue #5777
故障排除
如何修复 F´ GDS 在使用旧版字典或接收到未知数据包描述符时静默停止下行链路/遥测的问题?

将 fprime-gds 升级到包含 PR #368 修复的发布版本,或安装已打补丁的 main 分支:

pip install --upgrade fprime-gds
# 或者,如有需要:
pip install "fprime-gds @ git+https://github.com/nasa/fprime-gds.git@main"

故障发生在 Distributor.on_recv 中:它捕获了 DeserializeException,但未捕获 EnumMismatchException,因此未知的描述符会导致接收线程终止。在旧版本中,这可能表现为 ValueError: 65536 is not a valid DataDescType;而在 v4.4.0 上则可能静默失败。该补丁会捕获 EnumMismatchException,记录一条警告,跳过有问题的数据包,并继续处理。

临时解决方案:使用由连接到 GDS 的那个确切部署构建所生成的字典——不要将 v4.0.0 的字典与 v4.4.0 的部署混用。对于因数据损坏导致的数据包,必须进行升级,因为匹配的字典无法防止此类问题。

来源 Issue #6148
故障排除
如何修复在使用 --name 时出现的 fprime-merge-dictionary 错误 "match() missing 1 required positional argument: 'string'"?

这是 fprime-merge-dictionary CLI 中的一个验证 bug:标识符正则表达式在调用时未传入用户提供的名称,并且使用的是前缀匹配,而不是匹配整个字符串。

临时解决方法:省略 --name;这样命令会使用生成的部署名称:

fprime-merge-dictionary --output combined.json first.json second.json

永久修复:将 fprime-gds 更新到包含该修复的版本,或者将 parse_arguments() 中的名称验证从如下调用:

re.match(IDENTIFIER_PATTERN)

修改为:

re.fullmatch(IDENTIFIER_PATTERN, args.name)

fullmatch 确保像 Combined 这样的有效标识符能够被接受,而像 Combined-extra 或 Combined\n 这样的无效值会在输出文件被写入之前被拒绝。

来源 Issue #6060
故障排除
如何修复 fprime CommandDispatcher 单元测试中 TESTCASE 编号重复或乱序的问题?

在 fprime v4.4.1 中,这是 TEST_CASE 可追溯性标签中一个仅影响外观的复制粘贴错误,而非 GoogleTest 失败或功能性缺陷。编辑 Svc/CmdDispatcher/test/ut/CommandDispatcherTestMain.cpp,将标称测试保留在 102.1.x 下,将非标称测试保留在 102.2.x 下,并按源代码顺序分配唯一 ID。一种有效的重新编号方式是:将 ClearSequenceTracker 从 102.1.3 改为 102.2.6;将 CommandQueueOverflow 从重复的 102.2.5 改为 102.2.7;将现有的 102.2.9、102.2.6、102.2.7 和 102.2.8 测试分别重新编号为 102.2.8、102.2.9、102.2.10 和 102.2.11。使用 cd Svc/CmdDispatcher && fprime-util check --ut 进行验证。维护者指出,这些编号标签已弃用,因此保持其原样不会影响测试执行。

来源 Issue #6154