Skip to content
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 #97, Remove dead code checks: NULL bufptr and RunStatus_SYS_EXCEPTION #98

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions fsw/inc/cs_msg.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
*/
typedef struct
{
uint8 CmdCounter; /**< \brief CS Application Command Counter */
uint8 CmdErrCounter; /**< \brief CS Application Command Error Counter */
uint8 CommandCounter; /**< \brief CS Application Command Counter */
uint8 CommandErrorCounter; /**< \brief CS Application Command Error Counter */
uint8 ChecksumState; /**< \brief CS Application global checksum state */
uint8 EepromCSState; /**< \brief CS EEPROM table checksum state */
uint8 MemoryCSState; /**< \brief CS Memory table checksum state */
Expand Down
162 changes: 81 additions & 81 deletions fsw/inc/cs_msgdefs.h

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions fsw/src/cs_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ void CS_AppMain(void)
/* Performance Log (start time counter) */
CFE_ES_PerfLogEntry(CS_APPMAIN_PERF_ID);

if ((Result == CFE_SUCCESS) && (BufPtr != NULL))
if (Result == CFE_SUCCESS)
{
/* Process Software Bus message */
Result = CS_AppPipe(BufPtr);
Expand Down Expand Up @@ -116,7 +116,7 @@ void CS_AppMain(void)
} /* end run loop */

/* Check for "fatal" process error */
if (CS_AppData.RunStatus == CFE_ES_RunStatus_APP_ERROR || CS_AppData.RunStatus == CFE_ES_RunStatus_SYS_EXCEPTION)
if (CS_AppData.RunStatus == CFE_ES_RunStatus_APP_ERROR)
{
/* Send an error event with run status and result */
CFE_EVS_SendEvent(CS_EXIT_ERR_EID, CFE_EVS_EventType_ERROR, "App terminating, RunStatus:0x%08X, RC:0x%08X",
Expand Down Expand Up @@ -249,7 +249,7 @@ CFE_Status_t CS_AppPipe(const CFE_SB_Buffer_t *BufPtr)
CFE_EVS_SendEvent(CS_MID_ERR_EID, CFE_EVS_EventType_ERROR, "Invalid command pipe message ID: 0x%08lX",
(unsigned long)CFE_SB_MsgIdToValue(MessageID));

CS_AppData.HkPacket.Payload.CmdErrCounter++;
CS_AppData.HkPacket.Payload.CommandErrorCounter++;
break;
}

Expand Down Expand Up @@ -284,7 +284,7 @@ void CS_ProcessCmd(const CFE_SB_Buffer_t *BufPtr)
case CS_RESET_CC:
if (CS_VerifyCmdLength(&BufPtr->Msg, sizeof(CS_NoArgsCmd_t)))
{
CS_ResetCmd((CS_NoArgsCmd_t *)BufPtr);
CS_ResetCountersCmd((CS_NoArgsCmd_t *)BufPtr);
}
break;

Expand Down Expand Up @@ -565,7 +565,7 @@ void CS_ProcessCmd(const CFE_SB_Buffer_t *BufPtr)
"Invalid ground command code: ID = 0x%08lX, CC = %d",
(unsigned long)CFE_SB_MsgIdToValue(MessageID), CommandCode);

CS_AppData.HkPacket.Payload.CmdErrCounter++;
CS_AppData.HkPacket.Payload.CommandErrorCounter++;
break;
} /* end switch */
}
Expand Down
24 changes: 12 additions & 12 deletions fsw/src/cs_app_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ void CS_DisableAppCmd(const CS_NoArgsCmd_t *CmdPtr)
#endif

CFE_EVS_SendEvent(CS_DISABLE_APP_INF_EID, CFE_EVS_EventType_INFORMATION, "Checksumming of App is Disabled");
CS_AppData.HkPacket.Payload.CmdCounter++;
CS_AppData.HkPacket.Payload.CommandCounter++;
}
}

Expand All @@ -76,7 +76,7 @@ void CS_EnableAppCmd(const CS_NoArgsCmd_t *CmdPtr)
#endif

CFE_EVS_SendEvent(CS_ENABLE_APP_INF_EID, CFE_EVS_EventType_INFORMATION, "Checksumming of App is Enabled");
CS_AppData.HkPacket.Payload.CmdCounter++;
CS_AppData.HkPacket.Payload.CommandCounter++;
}
}

Expand Down Expand Up @@ -108,13 +108,13 @@ void CS_ReportBaselineAppCmd(const CS_AppNameCmd_t *CmdPtr)
CFE_EVS_SendEvent(CS_NO_BASELINE_APP_INF_EID, CFE_EVS_EventType_INFORMATION,
"Report baseline of app %s has not been computed yet", Name);
}
CS_AppData.HkPacket.Payload.CmdCounter++;
CS_AppData.HkPacket.Payload.CommandCounter++;
}
else
{
CFE_EVS_SendEvent(CS_BASELINE_INVALID_NAME_APP_ERR_EID, CFE_EVS_EventType_ERROR,
"App report baseline failed, app %s not found", Name);
CS_AppData.HkPacket.Payload.CmdErrCounter++;
CS_AppData.HkPacket.Payload.CommandErrorCounter++;
}
}

Expand Down Expand Up @@ -153,30 +153,30 @@ void CS_RecomputeBaselineAppCmd(const CS_AppNameCmd_t *CmdPtr)
{
CFE_EVS_SendEvent(CS_RECOMPUTE_APP_STARTED_DBG_EID, CFE_EVS_EventType_DEBUG,
"Recompute baseline of app %s started", Name);
CS_AppData.HkPacket.Payload.CmdCounter++;
CS_AppData.HkPacket.Payload.CommandCounter++;
}
else /* child task creation failed */
{
CFE_EVS_SendEvent(CS_RECOMPUTE_APP_CREATE_CHDTASK_ERR_EID, CFE_EVS_EventType_ERROR,
"Recompute baseline of app %s failed, CFE_ES_CreateChildTask returned: 0x%08X",
Name, (unsigned int)Status);
CS_AppData.HkPacket.Payload.CmdErrCounter++;
CS_AppData.HkPacket.Payload.CommandErrorCounter++;
CS_AppData.HkPacket.Payload.RecomputeInProgress = false;
}
}
else
{
CFE_EVS_SendEvent(CS_RECOMPUTE_UNKNOWN_NAME_APP_ERR_EID, CFE_EVS_EventType_ERROR,
"App recompute baseline failed, app %s not found", Name);
CS_AppData.HkPacket.Payload.CmdErrCounter++;
CS_AppData.HkPacket.Payload.CommandErrorCounter++;
}
}
else
{
/*send event that we can't start another task right now */
CFE_EVS_SendEvent(CS_RECOMPUTE_APP_CHDTASK_ERR_EID, CFE_EVS_EventType_ERROR,
"App recompute baseline for app %s failed: child task in use", Name);
CS_AppData.HkPacket.Payload.CmdErrCounter++;
CS_AppData.HkPacket.Payload.CommandErrorCounter++;
}
}

Expand Down Expand Up @@ -218,14 +218,14 @@ void CS_DisableNameAppCmd(const CS_AppNameCmd_t *CmdPtr)
"CS unable to update apps definition table for entry %s", Name);
}

CS_AppData.HkPacket.Payload.CmdCounter++;
CS_AppData.HkPacket.Payload.CommandCounter++;
}

else
{
CFE_EVS_SendEvent(CS_DISABLE_APP_UNKNOWN_NAME_ERR_EID, CFE_EVS_EventType_ERROR,
"App disable app command failed, app %s not found", Name);
CS_AppData.HkPacket.Payload.CmdErrCounter++;
CS_AppData.HkPacket.Payload.CommandErrorCounter++;
}
} /* end InProgress if */
}
Expand Down Expand Up @@ -266,13 +266,13 @@ void CS_EnableNameAppCmd(const CS_AppNameCmd_t *CmdPtr)
"CS unable to update apps definition table for entry %s", Name);
}

CS_AppData.HkPacket.Payload.CmdCounter++;
CS_AppData.HkPacket.Payload.CommandCounter++;
}
else
{
CFE_EVS_SendEvent(CS_ENABLE_APP_UNKNOWN_NAME_ERR_EID, CFE_EVS_EventType_ERROR,
"App enable app command failed, app %s not found", Name);
CS_AppData.HkPacket.Payload.CmdErrCounter++;
CS_AppData.HkPacket.Payload.CommandErrorCounter++;
}
} /* end InProgress if */
}
50 changes: 25 additions & 25 deletions fsw/src/cs_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void CS_NoopCmd(const CS_NoArgsCmd_t *CmdPtr)
{
CS_AppData.HkPacket.Payload.CmdCounter++;
CS_AppData.HkPacket.Payload.CommandCounter++;

CFE_EVS_SendEvent(CS_NOOP_INF_EID, CFE_EVS_EventType_INFORMATION, "No-op command. Version %d.%d.%d.%d",
CS_MAJOR_VERSION, CS_MINOR_VERSION, CS_REVISION, CS_MISSION_REV);
Expand All @@ -59,10 +59,10 @@
/* CS Reset Application counters command */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void CS_ResetCmd(const CS_NoArgsCmd_t *CmdPtr)
void CS_ResetCountersCmd(const CS_NoArgsCmd_t *CmdPtr)

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.
{
CS_AppData.HkPacket.Payload.CmdCounter = 0;
CS_AppData.HkPacket.Payload.CmdErrCounter = 0;
CS_AppData.HkPacket.Payload.CommandCounter = 0;
CS_AppData.HkPacket.Payload.CommandErrorCounter = 0;

CS_AppData.HkPacket.Payload.EepromCSErrCounter = 0;
CS_AppData.HkPacket.Payload.MemoryCSErrCounter = 0;
Expand Down Expand Up @@ -203,7 +203,7 @@
CS_ZeroCfeCoreTempValues();
CS_ZeroOSTempValues();

CS_AppData.HkPacket.Payload.CmdCounter++;
CS_AppData.HkPacket.Payload.CommandCounter++;

CFE_EVS_SendEvent(CS_DISABLE_ALL_INF_EID, CFE_EVS_EventType_INFORMATION, "Background Checksumming Disabled");
}
Expand All @@ -217,7 +217,7 @@
{
CS_AppData.HkPacket.Payload.ChecksumState = CS_STATE_ENABLED;

CS_AppData.HkPacket.Payload.CmdCounter++;
CS_AppData.HkPacket.Payload.CommandCounter++;

CFE_EVS_SendEvent(CS_ENABLE_ALL_INF_EID, CFE_EVS_EventType_INFORMATION, "Background Checksumming Enabled");
}
Expand All @@ -239,7 +239,7 @@
CFE_EVS_SendEvent(CS_DISABLE_CFECORE_INF_EID, CFE_EVS_EventType_INFORMATION,
"Checksumming of cFE Core is Disabled");

CS_AppData.HkPacket.Payload.CmdCounter++;
CS_AppData.HkPacket.Payload.CommandCounter++;
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
Expand All @@ -257,7 +257,7 @@

CFE_EVS_SendEvent(CS_ENABLE_CFECORE_INF_EID, CFE_EVS_EventType_INFORMATION, "Checksumming of cFE Core is Enabled");

CS_AppData.HkPacket.Payload.CmdCounter++;
CS_AppData.HkPacket.Payload.CommandCounter++;
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
Expand All @@ -277,7 +277,7 @@
CFE_EVS_SendEvent(CS_DISABLE_OS_INF_EID, CFE_EVS_EventType_INFORMATION,
"Checksumming of OS code segment is Disabled");

CS_AppData.HkPacket.Payload.CmdCounter++;
CS_AppData.HkPacket.Payload.CommandCounter++;
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
Expand All @@ -296,7 +296,7 @@
CFE_EVS_SendEvent(CS_ENABLE_OS_INF_EID, CFE_EVS_EventType_INFORMATION,
"Checksumming of OS code segment is Enabled");

CS_AppData.HkPacket.Payload.CmdCounter++;
CS_AppData.HkPacket.Payload.CommandCounter++;
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
Expand All @@ -316,7 +316,7 @@
CFE_EVS_SendEvent(CS_NO_BASELINE_CFECORE_INF_EID, CFE_EVS_EventType_INFORMATION,
"Baseline of cFE Core has not been computed yet");
}
CS_AppData.HkPacket.Payload.CmdCounter++;
CS_AppData.HkPacket.Payload.CommandCounter++;
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
Expand All @@ -336,7 +336,7 @@
CFE_EVS_SendEvent(CS_NO_BASELINE_OS_INF_EID, CFE_EVS_EventType_INFORMATION,
"Baseline of OS code segment has not been computed yet");
}
CS_AppData.HkPacket.Payload.CmdCounter++;
CS_AppData.HkPacket.Payload.CommandCounter++;
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
Expand Down Expand Up @@ -368,14 +368,14 @@
{
CFE_EVS_SendEvent(CS_RECOMPUTE_CFECORE_STARTED_DBG_EID, CFE_EVS_EventType_DEBUG,
"Recompute of cFE core started");
CS_AppData.HkPacket.Payload.CmdCounter++;
CS_AppData.HkPacket.Payload.CommandCounter++;
}
else /* child task creation failed */
{
CFE_EVS_SendEvent(CS_RECOMPUTE_CFECORE_CREATE_CHDTASK_ERR_EID, CFE_EVS_EventType_ERROR,
"Recompute cFE core failed, CFE_ES_CreateChildTask returned: 0x%08X",
(unsigned int)Status);
CS_AppData.HkPacket.Payload.CmdErrCounter++;
CS_AppData.HkPacket.Payload.CommandErrorCounter++;
CS_AppData.HkPacket.Payload.RecomputeInProgress = false;
}
}
Expand All @@ -384,7 +384,7 @@
/*send event that we can't start another task right now */
CFE_EVS_SendEvent(CS_RECOMPUTE_CFECORE_CHDTASK_ERR_EID, CFE_EVS_EventType_ERROR,
"Recompute cFE core failed: child task in use");
CS_AppData.HkPacket.Payload.CmdErrCounter++;
CS_AppData.HkPacket.Payload.CommandErrorCounter++;
}
}

Expand Down Expand Up @@ -416,14 +416,14 @@
{
CFE_EVS_SendEvent(CS_RECOMPUTE_OS_STARTED_DBG_EID, CFE_EVS_EventType_DEBUG,
"Recompute of OS code segment started");
CS_AppData.HkPacket.Payload.CmdCounter++;
CS_AppData.HkPacket.Payload.CommandCounter++;
}
else /* child task creation failed */
{
CFE_EVS_SendEvent(CS_RECOMPUTE_OS_CREATE_CHDTASK_ERR_EID, CFE_EVS_EventType_ERROR,
"Recompute OS code segment failed, CFE_ES_CreateChildTask returned: 0x%08X",
(unsigned int)Status);
CS_AppData.HkPacket.Payload.CmdErrCounter++;
CS_AppData.HkPacket.Payload.CommandErrorCounter++;
CS_AppData.HkPacket.Payload.RecomputeInProgress = false;
}
}
Expand All @@ -432,7 +432,7 @@
/*send event that we can't start another task right now */
CFE_EVS_SendEvent(CS_RECOMPUTE_OS_CHDTASK_ERR_EID, CFE_EVS_EventType_ERROR,
"Recompute OS code segment failed: child task in use");
CS_AppData.HkPacket.Payload.CmdErrCounter++;
CS_AppData.HkPacket.Payload.CommandErrorCounter++;
}
}

Expand Down Expand Up @@ -481,15 +481,15 @@
(unsigned int)(CmdPtr->Payload.Address), (int)(CmdPtr->Payload.Size));

CS_AppData.ChildTaskID = ChildTaskID;
CS_AppData.HkPacket.Payload.CmdCounter++;
CS_AppData.HkPacket.Payload.CommandCounter++;
}
else /* child task creation failed */
{
CFE_EVS_SendEvent(CS_ONESHOT_CREATE_CHDTASK_ERR_EID, CFE_EVS_EventType_ERROR,
"OneShot checkum failed, CFE_ES_CreateChildTask returned: 0x%08X",
(unsigned int)Status);

CS_AppData.HkPacket.Payload.CmdErrCounter++;
CS_AppData.HkPacket.Payload.CommandErrorCounter++;
CS_AppData.HkPacket.Payload.RecomputeInProgress = false;
CS_AppData.HkPacket.Payload.OneShotInProgress = false;
}
Expand All @@ -500,15 +500,15 @@
CFE_EVS_SendEvent(CS_ONESHOT_CHDTASK_ERR_EID, CFE_EVS_EventType_ERROR,
"OneShot checksum failed: child task in use");

CS_AppData.HkPacket.Payload.CmdErrCounter++;
CS_AppData.HkPacket.Payload.CommandErrorCounter++;
}
} /* end if CFE_PSP_MemValidateRange */
else
{
CFE_EVS_SendEvent(CS_ONESHOT_MEMVALIDATE_ERR_EID, CFE_EVS_EventType_ERROR,
"OneShot checksum failed, CFE_PSP_MemValidateRange returned: 0x%08X", (unsigned int)Status);

CS_AppData.HkPacket.Payload.CmdErrCounter++;
CS_AppData.HkPacket.Payload.CommandErrorCounter++;
}
}

Expand All @@ -533,7 +533,7 @@
CS_AppData.ChildTaskID = CFE_ES_TASKID_UNDEFINED;
CS_AppData.HkPacket.Payload.RecomputeInProgress = false;
CS_AppData.HkPacket.Payload.OneShotInProgress = false;
CS_AppData.HkPacket.Payload.CmdCounter++;
CS_AppData.HkPacket.Payload.CommandCounter++;
CFE_EVS_SendEvent(CS_ONESHOT_CANCELLED_INF_EID, CFE_EVS_EventType_INFORMATION,
"OneShot checksum calculation has been cancelled");
}
Expand All @@ -542,13 +542,13 @@
CFE_EVS_SendEvent(CS_ONESHOT_CANCEL_DELETE_CHDTASK_ERR_EID, CFE_EVS_EventType_ERROR,
"Cancel OneShot checksum failed, CFE_ES_DeleteChildTask returned: 0x%08X",
(unsigned int)Status);
CS_AppData.HkPacket.Payload.CmdErrCounter++;
CS_AppData.HkPacket.Payload.CommandErrorCounter++;
}
}
else
{
CFE_EVS_SendEvent(CS_ONESHOT_CANCEL_NO_CHDTASK_ERR_EID, CFE_EVS_EventType_ERROR,
"Cancel OneShot checksum failed. No OneShot active");
CS_AppData.HkPacket.Payload.CmdErrCounter++;
CS_AppData.HkPacket.Payload.CommandErrorCounter++;
}
}
2 changes: 1 addition & 1 deletion fsw/src/cs_cmds.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void CS_NoopCmd(const CS_NoArgsCmd_t *CmdPtr);
*
* \sa #CS_RESET_CC
*/
void CS_ResetCmd(const CS_NoArgsCmd_t *CmdPtr);
void CS_ResetCountersCmd(const CS_NoArgsCmd_t *CmdPtr);

/**
* \brief process a background checking cycle
Expand Down
Loading
Loading