Skip to content
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
5 changes: 3 additions & 2 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
name: Static Analysis

# Run on all push and pull requests
on:
push:
branches:
Expand All @@ -16,4 +15,6 @@ on:
jobs:
static-analysis:
name: Static Analysis
uses: nasa/cFS/.github/workflows/app-static-analysis-reusable.yml@dev
uses: nasa/cFS/.github/workflows/static-analysis-reusable.yml@dev
with:
source-dir: 'source/fsw'
4 changes: 2 additions & 2 deletions docs/dox_src/cfs_sc.dox
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,11 @@

<H2>Power On Resets</H2>

The RTS ID defined by #RTS_ID_AUTO_POWER_ON is started (if non-zero).
The RTS ID defined by #SC_RTS_ID_AUTO_POWER_ON is started (if non-zero).

<H2>Processor Resets</H2>

The RTS ID defined by #RTS_ID_AUTO_PROCESSOR is started (if non-zero).
The RTS ID defined by #SC_RTS_ID_AUTO_PROCESSOR is started (if non-zero).

<H2>Absolute Time Processor (ATP)</H2>

Expand Down
8 changes: 5 additions & 3 deletions fsw/inc/sc_internal_cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,8 @@
* \par Limits:
* Must be a valid RTS ID or 0
*/
#define RTS_ID_AUTO_POWER_ON 1
#define SC_RTS_ID_AUTO_POWER_ON SC_INTERNAL_CFGVAL(RTS_ID_AUTO_POWER_ON)
#define DEFAULT_SC_INTERNAL_RTS_ID_AUTO_POWER_ON 0

/**
* \brief Autostart RTS ID after processor reset
Expand All @@ -345,7 +346,8 @@
* \par Limits:
* Must be a valid RTS ID or 0
*/
#define RTS_ID_AUTO_PROCESSOR 2
#define SC_RTS_ID_AUTO_PROCESSOR SC_INTERNAL_CFGVAL(RTS_ID_AUTO_PROCESSOR)
#define DEFAULT_SC_INTERNAL_RTS_ID_AUTO_PROCESSOR 0

/**
* \brief Mission specific version number for SC application
Expand All @@ -362,7 +364,7 @@
* or equal to zero.
*/
#define SC_MISSION_REV SC_INTERNAL_CFGVAL(MISSION_REV)
#define DEFAULT_SC_INTERNAL_MISSION_REV 0
#define DEFAULT_SC_INTERNAL_MISSION_REV 0xFF

/**\}*/

Expand Down
4 changes: 2 additions & 2 deletions fsw/src/sc_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,11 @@ CFE_Status_t SC_AppInit(void)
/* Select auto-exec RTS to start during first HK request */
if (CFE_ES_GetResetType(NULL) == CFE_PSP_RST_TYPE_POWERON)
{
SC_AppData.AutoStartRTS = SC_RTS_NUM_C(RTS_ID_AUTO_POWER_ON);
SC_AppData.AutoStartRTS = SC_RTS_NUM_C(SC_RTS_ID_AUTO_POWER_ON);
}
else
{
SC_AppData.AutoStartRTS = SC_RTS_NUM_C(RTS_ID_AUTO_PROCESSOR);
SC_AppData.AutoStartRTS = SC_RTS_NUM_C(SC_RTS_ID_AUTO_PROCESSOR);
}

/* Must be able to register for events */
Expand Down
23 changes: 20 additions & 3 deletions fsw/src/sc_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -745,9 +745,26 @@ void SC_ManageTable(SC_TableType type, int32 ArrayIndex)
/* Allow cFE to manage table */
CFE_TBL_Manage(TblHandle);

/* Re-acquire table data pointer */
Result = CFE_TBL_GetAddress(&TblPtrNew, TblHandle);
*TblAddr = TblPtrNew; /* Note that CFE_TBL_GetAddress() sets this to NULL if it fails */
/*
** Re-acquire table data pointer. Per cfe_tbl.h, CFE_TBL_GetAddress leaves
** TblPtrNew *undefined* on any non-success return -- it does NOT set it
** to NULL (the inline comment that used to live here was wrong). Only
** CFE_SUCCESS and CFE_TBL_INFO_UPDATED set the pointer. Default to NULL
** before the call and only publish the address on success so a failed
** acquire can't write uninitialised stack memory into the shared
** SC_OperData.*TblAddr slot (where downstream code in sc_loads.c /
** sc_atsrq.c would dereference it as a wild pointer).
*/
TblPtrNew = NULL;
Result = CFE_TBL_GetAddress(&TblPtrNew, TblHandle);
if (Result == CFE_SUCCESS || Result == CFE_TBL_INFO_UPDATED)
{
*TblAddr = TblPtrNew;
}
else
{
*TblAddr = NULL;
}
if (Result == CFE_TBL_INFO_UPDATED)
{
/* Process new table data */
Expand Down
4 changes: 2 additions & 2 deletions unit-test/sc_app_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ void SC_AppInit_Test_NominalPowerOnReset(void)

Expected_SC_AppData.NextCmdTime[SC_Process_ATP] = SC_MAX_TIME;
Expected_SC_AppData.NextCmdTime[SC_Process_RTP] = SC_MAX_WAKEUP_CNT;
Expected_SC_AppData.AutoStartRTS = SC_RTS_NUM_C(RTS_ID_AUTO_POWER_ON);
Expected_SC_AppData.AutoStartRTS = SC_RTS_NUM_C(SC_RTS_ID_AUTO_POWER_ON);

UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &TestMsgId, sizeof(TestMsgId), false);
UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &MsgSize, sizeof(MsgSize), false);
Expand Down Expand Up @@ -223,7 +223,7 @@ void SC_AppInit_Test_Nominal(void)

Expected_SC_AppData.NextCmdTime[SC_Process_ATP] = SC_MAX_TIME;
Expected_SC_AppData.NextCmdTime[SC_Process_RTP] = SC_MAX_WAKEUP_CNT;
Expected_SC_AppData.AutoStartRTS = SC_RTS_NUM_C(RTS_ID_AUTO_PROCESSOR);
Expected_SC_AppData.AutoStartRTS = SC_RTS_NUM_C(SC_RTS_ID_AUTO_PROCESSOR);

Expected_SC_OperData.HkPacket.Payload.ContinueAtsOnFailureFlag = SC_AtsCont_TRUE;

Expand Down
Loading