From 38d259e63a2ade56d51ac30f0efb62b62585e7fd Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Mon, 10 Jan 2022 16:34:23 -0500 Subject: [PATCH] Fix #157, adjust padding in msg structs Add explicit spare bytes where the compiler is likely to introduce padding into hte message structures. CFS SB messages should avoid having any implicit padding, whenever possible. --- fsw/src/cf_msg.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/fsw/src/cf_msg.h b/fsw/src/cf_msg.h index 4026e616b..7eb277c07 100644 --- a/fsw/src/cf_msg.h +++ b/fsw/src/cf_msg.h @@ -84,8 +84,8 @@ typedef struct CF_HkChannel_Data uint16 q_size[CF_QueueIdx_NUM]; uint8 poll_counter; uint8 playback_counter; - uint8 frozen; /* NOTE: this could be more than one flag if we ever need it */ - uint8 spare[3]; + uint8 frozen; /* NOTE: this could be more than one flag if we ever need it */ + uint8 spare[7]; /* Structure has uint64 values in the counters, so size should be multiple of 8 */ } CF_HkChannel_Data_t; typedef struct CF_HkPacket @@ -95,6 +95,8 @@ typedef struct CF_HkPacket /* app HK */ CF_HkCmdCounters_t counters; + uint8 spare[4]; /* CF_HkCmdCounters_t is 4 bytes, and CF_HkChannel_Data_t uses uint64 values */ + /* per-channel HK */ CF_HkChannel_Data_t channel_hk[CF_NUM_CHANNELS]; } CF_HkPacket_t; @@ -196,6 +198,7 @@ typedef struct CF_SetParamCmd uint32 value; uint8 key; uint8 chan_num; + uint8 spare[2]; /* Required to make the size a multiple of uint32 */ } CF_SetParamCmd_t; typedef struct CF_TxFileCmd