-
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
Memory alignment issues in Software Bus #313
Comments
Imported from trac issue 282. Created by jphickey on 2019-04-25T09:54:14, last modified: 2019-08-14T14:09:53 |
One option I'm considering, aligning the pointer and then declaring it aligned: https://gcc.gnu.org/onlinedocs/gcc-3.3/gcc/Type-Attributes.html |
I thought I had a fix for at least some of these items..... let me check my un-merged branches. In general I prefer to avoid anything compiler-specific unless absolutely necessary. |
My bad, I mistakenly wrote a new issue about this, not realizing that this one was already open - which is #437. This doesn't fix everything though - we still have (genuine) issues with respect to casting the message buffer types - |
Include in the basic warning set. Note that at this time the CFE does not build cleanly on all architectures with this warning enabled, pending resolution of issue nasa#313.
Seeing similar with ES:
|
similar with SB:
and TIME:
and in cmdUtil:
|
Targeting 7.0 to allow major tlm packet updates. Errors don't show up in 32bit build for MCP750 with CCSDS Version 2 set so not critical to 6.8. |
The CFE code has some problem areas for CPUs that have strict memory alignment requirements (e.g. SPARC). Casting from a type with smaller requirements to a type with larger requirements generates a compile time warning and may induce a runtime exception if the memory actually is not aligned.
The following errors exist in the SB subsystem:
{{{
/cfe/fsw/cfe-core/src/sb/cfe_sb_api.c: In function 'CFE_SB_ZeroCopyGetPtr':
/cfe/fsw/cfe-core/src/sb/cfe_sb_api.c:1853:12: warning: cast increases required alignment of target type [-Wcast-align]
return (CFE_SB_Msg_t *)address;
^
/cfe/fsw/cfe-core/src/sb/cfe_sb_api.c: In function 'CFE_SB_ZeroCopyReleasePtr':
/cfe/fsw/cfe-core/src/sb/cfe_sb_api.c:1896:35: warning: cast increases required alignment of target type [-Wcast-align]
(uint32 *) (((uint8 *)Ptr2Release) - sizeof(CFE_SB_BufferD_t)));
^
/cfe/fsw/cfe-core/src/sb/cfe_sb_buf.c: In function 'CFE_SB_GetBufferFromCaller':
/cfe/fsw/cfe-core/src/sb/cfe_sb_buf.c:107:30: warning: cast increases required alignment of target type [-Wcast-align]
CFE_SB_BufferD_t *bd = (CFE_SB_BufferD_t *)(((uint8 *)Address) - sizeof(CFE_SB_BufferD_t));
^
/cfe/fsw/cfe-core/src/sb/cfe_sb_util.c: In function 'CFE_SB_GetMsgTime':
/cfe/fsw/cfe-core/src/sb/cfe_sb_util.c:280:21: warning: cast increases required alignment of target type [-Wcast-align]
TlmHdrPtr = (CFE_SB_TlmHdr_t *)MsgPtr;
^
/cfe/fsw/cfe-core/src/sb/cfe_sb_util.c: In function 'CFE_SB_SetMsgTime':
/cfe/fsw/cfe-core/src/sb/cfe_sb_util.c:345:21: warning: cast increases required alignment of target type [-Wcast-align]
TlmHdrPtr = (CFE_SB_TlmHdr_t *) MsgPtr;
^
}}}
NOTE: This is related to PSP ticket [cfs_psp:41]
The text was updated successfully, but these errors were encountered: