-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Constants Across Platforms #530
Comments
We should put some thought into where these live with respect to the proposal in #405 if the GDS will be maintained separately from the F Prime source tree, since there would be GDS dependencies on these constants. |
@timcanham has a good point. With just a couple languages involved, it seems like an Interface Control Document (ICD) should be sufficient, especially since constants shouldn't be redefined often. The various languages/components could implement it, referring to the ICD, with distinct tests to verify that the values continue to line up with the ICD. The other option is to put them in a language-independent config file, but then there's the question of where to put the config file so all languages have easy access at build time. |
On the Python side, I'd suggest creating a separate |
The constants are controlled by projects that adapt F´ and may be different per-deployment (at least some of them). Thus, although they change infrequently, a project may need to run with multiple definitions much like how configuration. Thus I am wondering if we need a set of "default" constants and a way to override them from a configuration file.
@timcanham @billallen256 thoughts? |
Excellent idea. The question is the the format. Should we introduce yaml at this point, or should we use FPP or XML? |
@timcanham yaml was just a toy example to convey the use of a file that could be read in by many languages. I will take the action to talk to the F´´ team to see what confirmation formats they are comfortable with. Ideally we would choose a format that works with the three languages we use commonly:
|
@LeStarch thanks for the explanation. It sounds like they are more like configs than constants (configurable constants?). I know it sounds boring, but |
As of |
If we are going to do this effort, we should try to generate some shared constants so we can use them in the software and in the GDS, like command packet descriptor byte size, etc. i.e. it would be good to generate .h and python files from the FPP constants. |
As part of this fix we should enforce that command dictionary string lengths are no longer than the system max string length. If a user sets a command argument longer than the max string length, it's currently possible to generate invalid command sequences by suppling a string longer than command dispatcher supports ( |
Fixed a misspelled attribute in codegen/gds_dictgen (closes nasa#530)
Core shared constants needed across both the Ground Data System (GDS) and Flight Software (FSW).
Implementation Recommendations:
module SharedConstants {
# Command and Telemetry Framing
constant MAX_PACKET_SIZE: U32 = 4096
constant HEADER_SIZE: U32 = 64
...
# System Identifiers
constant MAX_COMPONENT_ID: U32 = 256
...
}
|
A more few additions to make it more robust:
Implementation Suggestions:
def validate_constants():
assert is_power_of_two(BUFFER_SIZE), "Buffer size must be power of 2"
assert MAX_PACKET_SIZE <= MAX_BUFFER_SIZE, "Packet cannot exceed buffer"
assert MAX_FILE_PATH > MAX_FILENAME_LEN, "File path must exceed filename"
// Generated header
#define CONSTANT_USED(x) _mark_constant_used(#x)
void _mark_constant_used(const char* constant_name); These enhancements would:
|
A lot has happened in the configuration world in the past few years with so much interest (and disgust) around templating for things like Helm. For example Pkl has templating and some of the validation features already, and can output to other formats like JSON. It also allows for defaults that can be overridden. https://pkl-lang.org/blog/introducing-pkl.html Jsonnet is also worth taking a look at. |
fprime-jsonnet-config.txt
|
Pkl is Apache 2 as well: https://github.com/apple/pkl/blob/main/LICENSE.txt |
Understood. |
This ticket will be planned for post v3.7.0 as we are dependent on upcoming FPP work |
Feature Description
Constants (max lengths, framing tokens) etc should be available across the GDS, Autocoder and FSW such that missmatches are properly handles.
The text was updated successfully, but these errors were encountered: