-
Notifications
You must be signed in to change notification settings - Fork 202
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 #488, Remove compiler added padding in tlm packets #662
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Padding shouldn't be added this way -- it isn't a fixed quantity. Furthermore the "ccsds.h" definition should be the source of truth -- that is, it should be the actual definition of the structure without getting into any architecture-specific padding requirements.
The other reason not to do it this way is that the opposite problem exists when extended headers is enabled. This adds 4 bytes to the primary, so now the size of TLM hdr becomes 16 and the CMD header becomes 12, so now CMDs will need padding and TLM packets will not.
The paradigm should be that
ccsds.h
definitions represent the basic fundamental primitives, andcfe_sb.h
structures represent how these are actually realized for use within the software bus and applications.So - in the related PR #678 the
CFE_SB_TlmHdr_t
becomes a padded and aligned version ofCCSDS_TlmSecHdr_t
One can reliably determine the actual amount of padding on the current system by checking
sizeof(CFE_SB_TlmHdr_t) - sizeof(CCSDS_TlmSecHdr_t)
or equivalent...This will work on 32 bit or 64 bit, with or without extended headers, and should continue to work even if the headers are changed in the future.
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.
or what about using a union, like:
typedef union { uint8 Time[CCSDS_TIME_SIZE], TotalSz[10] } CCSDS_TlmSecHdr_t;