nasa / fprime

F´ - A flight software and embedded systems framework
https://fprime.jpl.nasa.gov
Apache License 2.0
9.95k stars 1.28k forks source link

FPP with `NATIVE_INT_TYPE` compiles but GDS fails to start #2788

Open kbotteon opened 1 week ago

kbotteon commented 1 week ago
F´ Version 3.4.3
Affected Component fprime-util

Problem Description

An event, and presumably other typed elements, can be specified with an argument of type NATIVE_INT_TYPE and this will build fine. However, when launching GDS, it fails with

[ERROR] Parsing error: Could not find type NATIVE_INT_TYPE
[ERROR] Failed to run application ...
[INFO] Shutting down F prime due to error. Failed to run HTML GUI

Context / Environment

Execute fprime-util version-check and share the output.

└──> fprime-util version-check
Operating System: Linux
CPU Architecture: x86_64
Platform: Linux-4.18.0-513.18.1.el8_9.x86_64-x86_64-with-glibc2.28
Python version: 3.11.5
CMake version: 3.26.5
Pip version: 24.0
Pip packages:
    fprime-tools==3.4.4
    fprime-gds==3.4.3
    fprime-fpp-*==2.1.0a3

How to Reproduce

Introduce an event like

        event REJECTED_EXEC (
            cmdType: ProjectName.CmdIdType
            portNo: NATIVE_INT_TYPE
        ) 

Then build and run GDS.

Expected Behavior

Either the application should fail to compile, or GDS should start with the resulting dictionary.

LeStarch commented 1 week ago

@bocchino can you weigh in?

bocchino commented 1 week ago

As matters currently stand, (1) you cannot use a type alias like FwFooType in the GDS interface and (2) the FPP checker does not enforce this rule -- it lets the type through so the error occurs in the GDS as reported. We have an open issue https://github.com/nasa/fpp/issues/113 to fix (1) and an open issue https://github.com/nasa/fpp/issues/236 to fix (2).

Until these issue are closed, you just have to know the rules and obey them manually. I anticipate that (2) will be fixed before (1). That is, step 1 of the fix will be that you can't use FwFooType in the GDS interface but the checker will enforce the rule; and step 2 of the fix will be that the model knows what the alias for FwFooType is, so you can use it in the GDS interface.

Finally, in any event you should avoid using NATIVE_INT_TYPE. As of FPP v2.1.0, this type will no longer be supported. You should switch to using a fixed-width type like FwSizeType or FwIndexType.