From 30fe0958d4629d7bc7f8ce2c043940f9403a3e9c Mon Sep 17 00:00:00 2001 From: Avi Weiss Date: Sun, 1 Jun 2025 16:43:05 +0200 Subject: [PATCH] Fix #240, make implicit padding in SAMPLE_APP_Data_t explicit and other small fixes --- .github/pull_request_template.md | 2 +- .github/workflows/codeql-build.yml | 3 +-- .github/workflows/format-check.yml | 1 - CMakeLists.txt | 3 ++- config/default_sample_app_topicids.h | 6 +++--- fsw/src/sample_app.h | 1 + fsw/src/sample_app_cmds.c | 4 ++-- fsw/src/sample_app_eds_dispatch.c | 6 +++--- fsw/src/sample_app_utils.c | 4 +--- fsw/src/sample_app_version.h | 20 ++++++++++--------- unit-test/common/eventcheck.c | 4 ++-- .../coveragetest_sample_app_cmds.c | 4 ++-- .../coveragetest_sample_app_utils.c | 2 +- 13 files changed, 30 insertions(+), 30 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 611a7d1..b9cc6fb 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -5,7 +5,7 @@ A clear and concise description of what the contribution is. **Testing performed** Steps taken to test the contribution: 1. Build steps '...' -1. Execution steps '...' +2. Execution steps '...' **Expected behavior changes** A clear and concise description of how this contribution will change behavior and level of impact. diff --git a/.github/workflows/codeql-build.yml b/.github/workflows/codeql-build.yml index 2753b54..66e552b 100644 --- a/.github/workflows/codeql-build.yml +++ b/.github/workflows/codeql-build.yml @@ -3,13 +3,12 @@ name: CodeQl Analysis on: push: pull_request: - jobs: codeql: name: Codeql Analysis uses: nasa/cFS/.github/workflows/codeql-reusable.yml@main - with: + with: component-path: apps/sample_app prep: 'make prep; make -C build/tools/elf2cfetbl' make: 'make -C build/native/default_cpu1/apps/sample_app' diff --git a/.github/workflows/format-check.yml b/.github/workflows/format-check.yml index 2d73eeb..b9d1f11 100644 --- a/.github/workflows/format-check.yml +++ b/.github/workflows/format-check.yml @@ -9,4 +9,3 @@ jobs: format-check: name: Run format check uses: nasa/cFS/.github/workflows/format-check.yml@main - \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index de20ccd..191179f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,5 @@ -project(CFE_SAMPLE_APP C) +cmake_minimum_required(VERSION 3.5) +project(CFS_SAMPLE_APP C) set(APP_SRC_FILES fsw/src/sample_app.c diff --git a/config/default_sample_app_topicids.h b/config/default_sample_app_topicids.h index c78676e..0471e5f 100644 --- a/config/default_sample_app_topicids.h +++ b/config/default_sample_app_topicids.h @@ -23,8 +23,8 @@ #ifndef SAMPLE_APP_TOPICIDS_H #define SAMPLE_APP_TOPICIDS_H -#define CFE_MISSION_SAMPLE_APP_CMD_TOPICID 0x82 -#define CFE_MISSION_SAMPLE_APP_SEND_HK_TOPICID 0x83 -#define CFE_MISSION_SAMPLE_APP_HK_TLM_TOPICID 0x83 +#define CFE_MISSION_SAMPLE_APP_CMD_TOPICID 0x82 +#define CFE_MISSION_SAMPLE_APP_SEND_HK_TOPICID 0x83 +#define CFE_MISSION_SAMPLE_APP_HK_TLM_TOPICID 0x83 #endif diff --git a/fsw/src/sample_app.h b/fsw/src/sample_app.h index 27d174c..8b51be0 100644 --- a/fsw/src/sample_app.h +++ b/fsw/src/sample_app.h @@ -52,6 +52,7 @@ typedef struct */ uint8 CmdCounter; uint8 ErrCounter; + uint8 spare[2]; /* ** Housekeeping telemetry packet... diff --git a/fsw/src/sample_app_cmds.c b/fsw/src/sample_app_cmds.c index 3d22caf..1043543 100644 --- a/fsw/src/sample_app_cmds.c +++ b/fsw/src/sample_app_cmds.c @@ -112,9 +112,9 @@ 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++; diff --git a/fsw/src/sample_app_eds_dispatch.c b/fsw/src/sample_app_eds_dispatch.c index 6751e43..18e8243 100644 --- a/fsw/src/sample_app_eds_dispatch.c +++ b/fsw/src/sample_app_eds_dispatch.c @@ -39,9 +39,9 @@ */ static const EdsDispatchTable_SAMPLE_APP_Application_CFE_SB_Telecommand_t SAMPLE_TC_DISPATCH_TABLE = { .CMD = {.NoopCmd_indication = SAMPLE_APP_NoopCmd, - .ResetCountersCmd_indication = SAMPLE_APP_ResetCountersCmd, - .ProcessCmd_indication = SAMPLE_APP_ProcessCmd, - .DisplayParamCmd_indication = SAMPLE_APP_DisplayParamCmd}, + .ResetCountersCmd_indication = SAMPLE_APP_ResetCountersCmd, + .ProcessCmd_indication = SAMPLE_APP_ProcessCmd, + .DisplayParamCmd_indication = SAMPLE_APP_DisplayParamCmd}, .SEND_HK = {.indication = SAMPLE_APP_SendHkCmd}}; /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **/ diff --git a/fsw/src/sample_app_utils.c b/fsw/src/sample_app_utils.c index 4bae292..257babb 100644 --- a/fsw/src/sample_app_utils.c +++ b/fsw/src/sample_app_utils.c @@ -59,7 +59,6 @@ CFE_Status_t SAMPLE_APP_TblValidationFunc(void *TblData) void SAMPLE_APP_GetCrc(const char *TableName) { CFE_Status_t status; - uint32 Crc; CFE_TBL_Info_t TblInfoPtr; status = CFE_TBL_GetInfo(&TblInfoPtr, TableName); @@ -69,7 +68,6 @@ void SAMPLE_APP_GetCrc(const char *TableName) } else { - Crc = TblInfoPtr.Crc; - CFE_ES_WriteToSysLog("Sample App: CRC: 0x%08lX\n\n", (unsigned long)Crc); + CFE_ES_WriteToSysLog("Sample App: CRC: 0x%08lX\n\n", (unsigned long)TblInfoPtr.Crc); } } diff --git a/fsw/src/sample_app_version.h b/fsw/src/sample_app_version.h index c2e97f8..d3a1b0d 100644 --- a/fsw/src/sample_app_version.h +++ b/fsw/src/sample_app_version.h @@ -27,17 +27,19 @@ /* Development Build Macro Definitions */ -#define SAMPLE_APP_BUILD_NUMBER 54 -#define SAMPLE_APP_BUILD_BASELINE "equuleus-rc1" /*!< Development Build: git tag that is the base for the current development */ -#define SAMPLE_APP_BUILD_DEV_CYCLE "equuleus-rc2" /**< @brief Development: Release name for current development cycle */ -#define SAMPLE_APP_BUILD_CODENAME "Equuleus" /**< @brief: Development: Code name for the current build */ +#define SAMPLE_APP_BUILD_NUMBER 54 +#define SAMPLE_APP_BUILD_BASELINE \ + "equuleus-rc1" /*!< Development Build: git tag that is the base for the current development */ +#define SAMPLE_APP_BUILD_DEV_CYCLE "equuleus-rc2" /**< @brief Development: Release name for current development cycle \ + */ +#define SAMPLE_APP_BUILD_CODENAME "Equuleus" /**< @brief: Development: Code name for the current build */ /* * Version Macros, see \ref cfsversions for definitions. */ -#define SAMPLE_APP_MAJOR_VERSION 1 /*!< @brief Major version number. */ -#define SAMPLE_APP_MINOR_VERSION 1 /*!< @brief Minor version number. */ -#define SAMPLE_APP_REVISION 0 /*!< @brief Revision version number. Value of 0 indicates a development version.*/ +#define SAMPLE_APP_MAJOR_VERSION 1 /*!< @brief Major version number. */ +#define SAMPLE_APP_MINOR_VERSION 1 /*!< @brief Minor version number. */ +#define SAMPLE_APP_REVISION 0 /*!< @brief Revision version number. Value of 0 indicates a development version.*/ /** * @brief Last official release. @@ -65,9 +67,9 @@ /** * @brief Max Version String length. - * + * * Maximum length that an OSAL version string can be. - * + * */ #define SAMPLE_APP_CFG_MAX_VERSION_STR_LEN 256 diff --git a/unit-test/common/eventcheck.c b/unit-test/common/eventcheck.c index 5bb23ee..631a92b 100644 --- a/unit-test/common/eventcheck.c +++ b/unit-test/common/eventcheck.c @@ -17,7 +17,7 @@ ************************************************************************/ /* -** File: coveragetest_sample_app.c +** File: eventcheck.c ** ** Purpose: ** Coverage Unit Test cases for the SAMPLE Application @@ -52,7 +52,7 @@ static int32 UT_CheckEvent_Hook(void *UserObj, int32 StubRetcode, uint32 CallCou { UT_CheckEvent_t *State = UserObj; uint16 EventId; - const char * Spec; + const char *Spec; /* * The CFE_EVS_SendEvent stub passes the EventID as the diff --git a/unit-test/coveragetest/coveragetest_sample_app_cmds.c b/unit-test/coveragetest/coveragetest_sample_app_cmds.c index 9bee959..9d4d4ef 100644 --- a/unit-test/coveragetest/coveragetest_sample_app_cmds.c +++ b/unit-test/coveragetest/coveragetest_sample_app_cmds.c @@ -17,7 +17,7 @@ ************************************************************************/ /* -** File: coveragetest_sample_app.c +** File: coveragetest_sample_app_cmds.c ** ** Purpose: ** Coverage Unit Test cases for the SAMPLE Application @@ -131,7 +131,7 @@ void Test_SAMPLE_APP_ProcessCmd(void) */ SAMPLE_APP_ProcessCmd_t TestMsg; SAMPLE_APP_ExampleTable_t TestTblData; - void * TblPtr = &TestTblData; + void *TblPtr = &TestTblData; memset(&TestTblData, 0, sizeof(TestTblData)); memset(&TestMsg, 0, sizeof(TestMsg)); diff --git a/unit-test/coveragetest/coveragetest_sample_app_utils.c b/unit-test/coveragetest/coveragetest_sample_app_utils.c index 6c81011..cff90ce 100644 --- a/unit-test/coveragetest/coveragetest_sample_app_utils.c +++ b/unit-test/coveragetest/coveragetest_sample_app_utils.c @@ -17,7 +17,7 @@ ************************************************************************/ /* -** File: coveragetest_sample_app.c +** File: coveragetest_sample_app_utils.c ** ** Purpose: ** Coverage Unit Test cases for the Sample Application