-
Notifications
You must be signed in to change notification settings - Fork 207
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
Fix #663, more consistent use of data types #1003
Fix #663, more consistent use of data types #1003
Conversation
Pushed a draft/preview commit as discussed in the 2020-11-04 CCB. This has all the API changes but the unit test updates are not complete. |
General summary of what's being proposed:
|
Also note that this sweep also caught a bunch of issues in the old SB message API - which if its being deprecated, we can just ignore those. But we should decide whether the new MSG API should use |
I also noticed a bunch of type issues (maybe some of the same?), fixed what I saw in #998. Mostly using uint16 for message size all over, which is a bug since it can't represent the full size CCSDS message. Agree that size_t could replace CFE_MSG_Size_t. The less one-off types the better in my mind. Maybe get #998 in first, then fix? Could we use a more descriptive name than CFE_ES_MemOffset_Atom_t? Really it's a conversion instead of the atomic type, isn't it? I think of it as the native to tlm conversion for size_t... Is the CDS offset type just for the PSP? If so I say we get that fixed also. It stands out as unique. |
This will conflict with #998, but I like your change better (using size_t for the verify command length). I would prefer separating the concept of the atomic type (which could be native) with the conversion to fit in telemetry. I'd also prefer the default behavior to use 64 bit's for memory addresses... if a user wants to use just 32 bit they can, but I'd rather default to consistent sized messages across 64/32 and valid data in both. |
Yes, I think the best approach would be to embrace
Yes, perhaps we should bring up/revisit the whole "_Atom_t" suffix thing in general.... the genesis of the type suffixes was to facilitate automation/tool-chaining of these types - and use a different suffix for enums, strings, structures, etc. It is currently documented in https://github.com/nasa/cFE/blob/main/docs/cFS_IdentifierNamingConvention.md#typedefs (unfortunately just noticed that github doesn't render the table data in this MD file correctly either -- another issue?). At any rate, this is the pattern that I still try to follow for CMD/TLM types. I still think its a useful thing to have a different suffix, maybe "Atom" is confusing and we could do something else. It is intended to convey that it is a scalar, as opposed a compound type (struct/string/array) etc. Maybe "Scalar"?
Not just CDS - all the memory blocks incl. reserved area and RAM disk are done with uint32 sizes - and these are especially problematic because they pass by pointer - not by value - so any change would NOT be backward compatible. Because any change to this API would not be backward compatible - my recommendation is to rethink/redesign this API and make it more future proof, such as:
Then the PSP can also provide separate constants for BlockId corresponding to the ramdisk, reserved area, cds, etc. The important thing is we can add/extend these constants without breaking or changing the general API. The current calls have a separate dedicated call for each memory section. So making it more extensible we can more easily have separate sections for ES/EVS/TIME (I think there is another issue related to this) |
Rather than directly referencing a constant, prefer to use the sizeof() operator on the instance or type whenever possible.
Update use of uint32 to size_t in UT support code
Fix all use of uint32 for sizes, replace with size_t Scrub all other types to make sure use is consistent, using proper typedef whenever available.
Fix all use of uint32 for sizes, replace with size_t Scrub all other types to make sure use is consistent, using proper typedef whenever available.
Fix all use of uint32 for sizes, replace with size_t Scrub all other types to make sure use is consistent, using proper typedef whenever available.
Fix all use of uint32 for sizes, replace with size_t Scrub all other types to make sure use is consistent, using proper typedef whenever available.
Fix all use of uint32 for sizes, replace with size_t Scrub all other types to make sure use is consistent, using proper typedef whenever available.
9ed226c
to
2cea88d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we change the word "proposed" here? Feels like its incomplete...
CCB 2020-11-18 APPROVED
|
Are all |
Describe the contribution
Define and Use data types more consistently across CFE.
Replace many uses of generic uint16/uint32 with a more purpose-specific typedef. Replace all sizes with
size_t
across the API.Fixes #663
Testing performed
Build and sanity test CFE
Expected behavior changes
None, but does affect API. The API changes should be largely backward compatible, however.
System(s) tested on
Ubuntu 20.04, 64-bit
Contributor Info - All information REQUIRED for consideration of pull request
Joseph Hickey, Vantage Systems, Inc.
EDIT: Also fixed #843