Skip to content
Merged
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
13 changes: 13 additions & 0 deletions .github/workflows/add-to-project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Add Issue or PR to Project

on:
issues:
types: [opened]
pull_request_target:
types: [opened, ready_for_review, converted_to_draft]

jobs:
add-to-project:
name: Add issue or pull request to project
uses: nasa/cFS/.github/workflows/add-to-project-reusable.yml@dev
secrets: inherit
23 changes: 23 additions & 0 deletions .github/workflows/build-run-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Build and Run

on:
push:
branches:
- dev
- main
pull_request:
types:
- opened
- reopened
- synchronize
workflow_dispatch:
schedule:
# 10:45 PM UTC every Sunday
- cron: '45 22 * * 0'
jobs:
build-run:
name: Build and run with startup msg verification
uses: nasa/cFS/.github/workflows/build-run-app-reusable.yml@dev
with:
dependency: nasa/sample_lib
app-entrypoint-suffix: Main
3 changes: 2 additions & 1 deletion .github/workflows/codeql-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ on:
jobs:
codeql:
name: Codeql Analysis
uses: nasa/cFS/.github/workflows/codeql-reusable.yml@main
uses: nasa/cFS/.github/workflows/codeql-reusable.yml@dev
with:
component-path: apps/sample_app
prep: 'make prep; make -C build/tools/elf2cfetbl'
make: 'make -C build/native/default_cpu1/apps/sample_app'
dependency: nasa/sample_lib
7 changes: 6 additions & 1 deletion .github/workflows/format-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,18 @@ name: Format Check

# Run on all push and pull requests
on:
push:
branches:
- dev
- main
pull_request:
types:
- opened
- reopened
- synchronize
workflow_dispatch:

jobs:
format-check:
name: Run format check
uses: nasa/cFS/.github/workflows/format-check.yml@main
uses: nasa/cFS/.github/workflows/format-check.yml@dev
4 changes: 2 additions & 2 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ on:

jobs:
static-analysis:
name: Run cppcheck
uses: nasa/cFS/.github/workflows/static-analysis.yml@main
name: Static Analysis
uses: nasa/cFS/.github/workflows/app-static-analysis-reusable.yml@dev
23 changes: 23 additions & 0 deletions .github/workflows/unit-test-coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Unit Test and Coverage

on:
push:
branches:
- dev
- main
pull_request:
types:
- opened
- reopened
- synchronize
workflow_dispatch:
schedule:
# 10:50 PM UTC every Sunday
- cron: '50 22 * * 0'

jobs:
unit-test-coverage:
name: Run unit test and coverage
uses: nasa/cFS/.github/workflows/unit-test-coverage-reusable.yml@dev
with:
dependency: nasa/sample_lib
1 change: 0 additions & 1 deletion config/default_sample_app_msgdefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ typedef struct SAMPLE_APP_HkTlm_Payload
{
uint8 CommandCounter;
uint8 CommandErrorCounter;
uint8 spare[2];
} SAMPLE_APP_HkTlm_Payload_t;

#endif
52 changes: 36 additions & 16 deletions fsw/src/sample_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ void SAMPLE_APP_Main(void)
}
else
{
CFE_EVS_SendEvent(SAMPLE_APP_PIPE_ERR_EID, CFE_EVS_EventType_ERROR,
CFE_EVS_SendEvent(SAMPLE_APP_PIPE_ERR_EID,
CFE_EVS_EventType_ERROR,
"SAMPLE APP: SB Pipe Read Error, App Will Exit");

SAMPLE_APP_Data.RunStatus = CFE_ES_RunStatus_APP_ERROR;
Expand Down Expand Up @@ -130,18 +131,22 @@ CFE_Status_t SAMPLE_APP_Init(void)
/*
** Initialize housekeeping packet (clear user data area).
*/
CFE_MSG_Init(CFE_MSG_PTR(SAMPLE_APP_Data.HkTlm.TelemetryHeader), CFE_SB_ValueToMsgId(SAMPLE_APP_HK_TLM_MID),
CFE_MSG_Init(CFE_MSG_PTR(SAMPLE_APP_Data.HkTlm.TelemetryHeader),
CFE_SB_ValueToMsgId(SAMPLE_APP_HK_TLM_MID),
sizeof(SAMPLE_APP_Data.HkTlm));

/*
** Create Software Bus message pipe.
*/
status = CFE_SB_CreatePipe(&SAMPLE_APP_Data.CommandPipe, SAMPLE_APP_PLATFORM_PIPE_DEPTH,
status = CFE_SB_CreatePipe(&SAMPLE_APP_Data.CommandPipe,
SAMPLE_APP_PLATFORM_PIPE_DEPTH,
SAMPLE_APP_PLATFORM_PIPE_NAME);
if (status != CFE_SUCCESS)
{
CFE_EVS_SendEvent(SAMPLE_APP_CR_PIPE_ERR_EID, CFE_EVS_EventType_ERROR,
"Sample App: Error creating SB Command Pipe, RC = 0x%08lX", (unsigned long)status);
CFE_EVS_SendEvent(SAMPLE_APP_CR_PIPE_ERR_EID,
CFE_EVS_EventType_ERROR,
"Sample App: Error creating SB Command Pipe, RC = 0x%08lX",
(unsigned long)status);
}
}

Expand All @@ -153,8 +158,10 @@ CFE_Status_t SAMPLE_APP_Init(void)
status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(SAMPLE_APP_SEND_HK_MID), SAMPLE_APP_Data.CommandPipe);
if (status != CFE_SUCCESS)
{
CFE_EVS_SendEvent(SAMPLE_APP_SUB_HK_ERR_EID, CFE_EVS_EventType_ERROR,
"Sample App: Error Subscribing to HK request, RC = 0x%08lX", (unsigned long)status);
CFE_EVS_SendEvent(SAMPLE_APP_SUB_HK_ERR_EID,
CFE_EVS_EventType_ERROR,
"Sample App: Error Subscribing to HK request, RC = 0x%08lX",
(unsigned long)status);
}
}

Expand All @@ -166,8 +173,10 @@ CFE_Status_t SAMPLE_APP_Init(void)
status = CFE_SB_Subscribe(CFE_SB_ValueToMsgId(SAMPLE_APP_CMD_MID), SAMPLE_APP_Data.CommandPipe);
if (status != CFE_SUCCESS)
{
CFE_EVS_SendEvent(SAMPLE_APP_SUB_CMD_ERR_EID, CFE_EVS_EventType_ERROR,
"Sample App: Error Subscribing to Commands, RC = 0x%08lX", (unsigned long)status);
CFE_EVS_SendEvent(SAMPLE_APP_SUB_CMD_ERR_EID,
CFE_EVS_EventType_ERROR,
"Sample App: Error Subscribing to Commands, RC = 0x%08lX",
(unsigned long)status);
}
}

Expand All @@ -176,22 +185,33 @@ CFE_Status_t SAMPLE_APP_Init(void)
/*
** Register Example Table(s)
*/
status = CFE_TBL_Register(&SAMPLE_APP_Data.TblHandles[0], "ExampleTable", sizeof(SAMPLE_APP_ExampleTable_t),
CFE_TBL_OPT_DEFAULT, SAMPLE_APP_TblValidationFunc);
status = CFE_TBL_Register(&SAMPLE_APP_Data.TblHandles[0],
"ExampleTable",
sizeof(SAMPLE_APP_ExampleTable_t),
CFE_TBL_OPT_DEFAULT,
SAMPLE_APP_TblValidationFunc);
if (status != CFE_SUCCESS)
{
CFE_EVS_SendEvent(SAMPLE_APP_TABLE_REG_ERR_EID, CFE_EVS_EventType_ERROR,
"Sample App: Error Registering Example Table, RC = 0x%08lX", (unsigned long)status);
CFE_EVS_SendEvent(SAMPLE_APP_TABLE_REG_ERR_EID,
CFE_EVS_EventType_ERROR,
"Sample App: Error Registering Example Table, RC = 0x%08lX",
(unsigned long)status);
}
else
{
status = CFE_TBL_Load(SAMPLE_APP_Data.TblHandles[0], CFE_TBL_SRC_FILE, SAMPLE_APP_PLATFORM_TABLE_FILE);
}

CFE_Config_GetVersionString(VersionString, SAMPLE_APP_CFG_MAX_VERSION_STR_LEN, "Sample App", SAMPLE_APP_VERSION,
SAMPLE_APP_BUILD_CODENAME, SAMPLE_APP_LAST_OFFICIAL);
CFE_Config_GetVersionString(VersionString,
SAMPLE_APP_CFG_MAX_VERSION_STR_LEN,
"Sample App",
SAMPLE_APP_VERSION,
SAMPLE_APP_BUILD_CODENAME,
SAMPLE_APP_LAST_OFFICIAL);

CFE_EVS_SendEvent(SAMPLE_APP_INIT_INF_EID, CFE_EVS_EventType_INFORMATION, "Sample App Initialized.%s",
CFE_EVS_SendEvent(SAMPLE_APP_INIT_INF_EID,
CFE_EVS_EventType_INFORMATION,
"Sample App Initialized.%s",
VersionString);
}

Expand Down
4 changes: 2 additions & 2 deletions fsw/src/sample_app.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ typedef struct
/*
** Command interface counters...
*/
uint8 CmdCounter;
uint8 ErrCounter;
uint8 CommandCounter;
uint8 CommandErrorCounter;

/*
** Housekeeping telemetry packet...
Expand Down
31 changes: 18 additions & 13 deletions fsw/src/sample_app_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ CFE_Status_t SAMPLE_APP_SendHkCmd(const SAMPLE_APP_SendHkCmd_t *Msg)
/*
** Get command execution counters...
*/
SAMPLE_APP_Data.HkTlm.Payload.CommandErrorCounter = SAMPLE_APP_Data.ErrCounter;
SAMPLE_APP_Data.HkTlm.Payload.CommandCounter = SAMPLE_APP_Data.CmdCounter;
SAMPLE_APP_Data.HkTlm.Payload.CommandErrorCounter = SAMPLE_APP_Data.CommandErrorCounter;
SAMPLE_APP_Data.HkTlm.Payload.CommandCounter = SAMPLE_APP_Data.CommandCounter;

/*
** Send housekeeping telemetry packet...
Expand All @@ -78,9 +78,11 @@ CFE_Status_t SAMPLE_APP_SendHkCmd(const SAMPLE_APP_SendHkCmd_t *Msg)
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **/
CFE_Status_t SAMPLE_APP_NoopCmd(const SAMPLE_APP_NoopCmd_t *Msg)
{
SAMPLE_APP_Data.CmdCounter++;
SAMPLE_APP_Data.CommandCounter++;

CFE_EVS_SendEvent(SAMPLE_APP_NOOP_INF_EID, CFE_EVS_EventType_INFORMATION, "SAMPLE: NOOP command %s",
CFE_EVS_SendEvent(SAMPLE_APP_NOOP_INF_EID,
CFE_EVS_EventType_INFORMATION,
"SAMPLE: NOOP command %s",
SAMPLE_APP_VERSION);

return CFE_SUCCESS;
Expand All @@ -95,8 +97,8 @@ CFE_Status_t SAMPLE_APP_NoopCmd(const SAMPLE_APP_NoopCmd_t *Msg)
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
CFE_Status_t SAMPLE_APP_ResetCountersCmd(const SAMPLE_APP_ResetCountersCmd_t *Msg)
{
SAMPLE_APP_Data.CmdCounter = 0;
SAMPLE_APP_Data.ErrCounter = 0;
SAMPLE_APP_Data.CommandCounter = 0;
SAMPLE_APP_Data.CommandErrorCounter = 0;

CFE_EVS_SendEvent(SAMPLE_APP_RESET_INF_EID, CFE_EVS_EventType_INFORMATION, "SAMPLE: RESET command");

Expand All @@ -112,12 +114,12 @@ CFE_Status_t SAMPLE_APP_ResetCountersCmd(const SAMPLE_APP_ResetCountersCmd_t *Ms
CFE_Status_t SAMPLE_APP_ProcessCmd(const SAMPLE_APP_ProcessCmd_t *Msg)
{
CFE_Status_t Status;
void * TblAddr;
void *TblAddr;
SAMPLE_APP_ExampleTable_t *TblPtr;
const char * TableName = "SAMPLE_APP.ExampleTable";
const char *TableName = "SAMPLE_APP.ExampleTable";

/* Sample Use of Example Table */
SAMPLE_APP_Data.CmdCounter++;
SAMPLE_APP_Data.CommandCounter++;
Status = CFE_TBL_GetAddress(&TblAddr, SAMPLE_APP_Data.TblHandles[0]);
if (Status < CFE_SUCCESS)
{
Expand Down Expand Up @@ -152,10 +154,13 @@ CFE_Status_t SAMPLE_APP_ProcessCmd(const SAMPLE_APP_ProcessCmd_t *Msg)
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **/
CFE_Status_t SAMPLE_APP_DisplayParamCmd(const SAMPLE_APP_DisplayParamCmd_t *Msg)
{
SAMPLE_APP_Data.CmdCounter++;
CFE_EVS_SendEvent(SAMPLE_APP_VALUE_INF_EID, CFE_EVS_EventType_INFORMATION,
"SAMPLE_APP: ValU32=%lu, ValI16=%d, ValStr=%s", (unsigned long)Msg->Payload.ValU32,
(int)Msg->Payload.ValI16, Msg->Payload.ValStr);
SAMPLE_APP_Data.CommandCounter++;
CFE_EVS_SendEvent(SAMPLE_APP_VALUE_INF_EID,
CFE_EVS_EventType_INFORMATION,
"SAMPLE_APP: ValU32=%lu, ValI16=%d, ValStr=%s",
(unsigned long)Msg->Payload.ValU32,
(int)Msg->Payload.ValI16,
Msg->Payload.ValStr);

return CFE_SUCCESS;
}
2 changes: 1 addition & 1 deletion fsw/src/sample_app_cmds.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
#include "sample_app_msg.h"

CFE_Status_t SAMPLE_APP_SendHkCmd(const SAMPLE_APP_SendHkCmd_t *Msg);
CFE_Status_t SAMPLE_APP_NoopCmd(const SAMPLE_APP_NoopCmd_t *Msg);
CFE_Status_t SAMPLE_APP_ResetCountersCmd(const SAMPLE_APP_ResetCountersCmd_t *Msg);
CFE_Status_t SAMPLE_APP_ProcessCmd(const SAMPLE_APP_ProcessCmd_t *Msg);
CFE_Status_t SAMPLE_APP_NoopCmd(const SAMPLE_APP_NoopCmd_t *Msg);
CFE_Status_t SAMPLE_APP_DisplayParamCmd(const SAMPLE_APP_DisplayParamCmd_t *Msg);

#endif /* SAMPLE_APP_CMDS_H */
18 changes: 12 additions & 6 deletions fsw/src/sample_app_dispatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,17 @@ bool SAMPLE_APP_VerifyCmdLength(const CFE_MSG_Message_t *MsgPtr, size_t Expected
CFE_MSG_GetMsgId(MsgPtr, &MsgId);
CFE_MSG_GetFcnCode(MsgPtr, &FcnCode);

CFE_EVS_SendEvent(SAMPLE_APP_CMD_LEN_ERR_EID, CFE_EVS_EventType_ERROR,
CFE_EVS_SendEvent(SAMPLE_APP_CMD_LEN_ERR_EID,
CFE_EVS_EventType_ERROR,
"Invalid Msg length: ID = 0x%X, CC = %u, Len = %u, Expected = %u",
(unsigned int)CFE_SB_MsgIdToValue(MsgId), (unsigned int)FcnCode, (unsigned int)ActualLength,
(unsigned int)CFE_SB_MsgIdToValue(MsgId),
(unsigned int)FcnCode,
(unsigned int)ActualLength,
(unsigned int)ExpectedLength);

result = false;

SAMPLE_APP_Data.ErrCounter++;
SAMPLE_APP_Data.CommandErrorCounter++;
}

return result;
Expand Down Expand Up @@ -110,9 +113,10 @@ void SAMPLE_APP_ProcessGroundCommand(const CFE_SB_Buffer_t *SBBufPtr)
}
break;

/* default case already found during FC vs length test */
default:
CFE_EVS_SendEvent(SAMPLE_APP_CC_ERR_EID, CFE_EVS_EventType_ERROR, "Invalid ground command code: CC = %d",
CFE_EVS_SendEvent(SAMPLE_APP_CC_ERR_EID,
CFE_EVS_EventType_ERROR,
"Invalid ground command code: CC = %d",
CommandCode);
break;
}
Expand Down Expand Up @@ -155,7 +159,9 @@ void SAMPLE_APP_TaskPipe(const CFE_SB_Buffer_t *SBBufPtr)
else
{
/* Unknown command */
CFE_EVS_SendEvent(SAMPLE_APP_MID_ERR_EID, CFE_EVS_EventType_ERROR, "SAMPLE: invalid command packet,MID = 0x%x",
CFE_EVS_SendEvent(SAMPLE_APP_MID_ERR_EID,
CFE_EVS_EventType_ERROR,
"SAMPLE: invalid command packet,MID = 0x%x",
(unsigned int)CFE_SB_MsgIdToValue(MsgId));
}
}
4 changes: 2 additions & 2 deletions fsw/src/sample_app_dispatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
#include "cfe.h"
#include "sample_app_msg.h"

void SAMPLE_APP_TaskPipe(const CFE_SB_Buffer_t *SBBufPtr);
void SAMPLE_APP_ProcessGroundCommand(const CFE_SB_Buffer_t *SBBufPtr);
bool SAMPLE_APP_VerifyCmdLength(const CFE_MSG_Message_t *MsgPtr, size_t ExpectedLength);
void SAMPLE_APP_ProcessGroundCommand(const CFE_SB_Buffer_t *SBBufPtr);
void SAMPLE_APP_TaskPipe(const CFE_SB_Buffer_t *SBBufPtr);

#endif /* SAMPLE_APP_DISPATCH_H */
Loading
Loading