From e94c450324665a5e3a628fba8855deb70a950d06 Mon Sep 17 00:00:00 2001 From: Chris Knight Date: Wed, 3 Jun 2020 12:32:11 -0700 Subject: [PATCH 1/3] fix #70 - reorg the table file --- CMakeLists.txt | 3 +-- .../sample_app_table.h} | 12 +++++----- fsw/src/sample_app.c | 23 +++++++++---------- fsw/src/sample_app.h | 6 ++--- .../sample_app_tbl.c} | 7 +++--- 5 files changed, 25 insertions(+), 26 deletions(-) rename fsw/{src/sample_table.h => platform_inc/sample_app_table.h} (87%) rename fsw/{src/sample_table.c => tables/sample_app_tbl.c} (88%) diff --git a/CMakeLists.txt b/CMakeLists.txt index e5514ac..c37119c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,7 +12,7 @@ include_directories(${sample_lib_MISSION_DIR}/fsw/public_inc) add_cfe_app(sample_app fsw/src/sample_app.c) # Add table -add_cfe_tables(sampleTable fsw/src/sample_table.c) +add_cfe_tables(sampleAppTable fsw/tables/sample_app_tbl.c) # If UT is enabled, then add the tests from the subdirectory # Note that this is an app, and therefore does not provide @@ -21,4 +21,3 @@ add_cfe_tables(sampleTable fsw/src/sample_table.c) if (ENABLE_UNIT_TESTS) add_subdirectory(unit-test) endif (ENABLE_UNIT_TESTS) - diff --git a/fsw/src/sample_table.h b/fsw/platform_inc/sample_app_table.h similarity index 87% rename from fsw/src/sample_table.h rename to fsw/platform_inc/sample_app_table.h index 9458cc3..62637b9 100644 --- a/fsw/src/sample_table.h +++ b/fsw/platform_inc/sample_app_table.h @@ -18,17 +18,17 @@ ** See the License for the specific language governing permissions and ** limitations under the License. ** -** File: sample_table.h +** File: sample_app_table.h ** ** Purpose: -** Define sample table +** Define sample app table ** ** Notes: ** ** *******************************************************************************/ -#ifndef _sample_table_h_ -#define _sample_table_h_ +#ifndef _sample_app_table_h_ +#define _sample_app_table_h_ /* ** Table structure @@ -38,9 +38,9 @@ typedef struct uint16 Int1; uint16 Int2; -} SAMPLE_Table_t; +} SAMPLE_APP_Table_t; -#endif /* _sample_table_h_ */ +#endif /* _sample_app_table_h_ */ /************************/ /* End of File Comment */ diff --git a/fsw/src/sample_app.c b/fsw/src/sample_app.c index 75bffae..beafedb 100644 --- a/fsw/src/sample_app.c +++ b/fsw/src/sample_app.c @@ -31,7 +31,7 @@ #include "sample_app_events.h" #include "sample_app_version.h" #include "sample_app.h" -#include "sample_table.h" +#include "sample_app_table.h" /* The sample_lib module provides the SAMPLE_Function() prototype */ #include @@ -220,14 +220,13 @@ int32 SAMPLE_AppInit( void ) ** Register Table(s) */ status = CFE_TBL_Register(&SAMPLE_AppData.TblHandles[0], - "SampleTable", - sizeof(SAMPLE_Table_t), + "SampleAppTable", + sizeof(SAMPLE_APP_Table_t), CFE_TBL_OPT_DEFAULT, SAMPLE_TblValidationFunc); if ( status != CFE_SUCCESS ) { - CFE_ES_WriteToSysLog("Sample App: Error Registering \ - Table, RC = 0x%08lX\n", (unsigned long)status); + CFE_ES_WriteToSysLog("Sample App: Error Registering Table, RC = 0x%08lX\n", (unsigned long)status); return ( status ); } @@ -235,7 +234,7 @@ int32 SAMPLE_AppInit( void ) { status = CFE_TBL_Load(SAMPLE_AppData.TblHandles[0], CFE_TBL_SRC_FILE, - SAMPLE_TABLE_FILE); + SAMPLE_APP_TABLE_FILE); } CFE_EVS_SendEvent (SAMPLE_STARTUP_INF_EID, @@ -430,8 +429,8 @@ int32 SAMPLE_ResetCounters( const SAMPLE_ResetCounters_t *Msg ) int32 SAMPLE_Process( const SAMPLE_Process_t *Msg ) { int32 status; - SAMPLE_Table_t *TblPtr; - const char *TableName = "SAMPLE_APP.SampleTable"; + SAMPLE_APP_Table_t *TblPtr; + const char *TableName = "SAMPLE_APP.SampleAppTable"; /* Sample Use of Table */ @@ -511,20 +510,20 @@ bool SAMPLE_VerifyCmdLength( CFE_SB_MsgPtr_t Msg, uint16 ExpectedLength ) int32 SAMPLE_TblValidationFunc( void *TblData ) { int32 ReturnCode = CFE_SUCCESS; - SAMPLE_Table_t *TblDataPtr = (SAMPLE_Table_t *)TblData; + SAMPLE_APP_Table_t *TblDataPtr = (SAMPLE_APP_Table_t *)TblData; /* ** Sample Table Validation */ - if (TblDataPtr->Int1 > SAMPLE_TBL_ELEMENT_1_MAX) + if (TblDataPtr->Int1 > SAMPLE_APP_TBL_ELEMENT_1_MAX) { /* First element is out of range, return an appropriate error code */ - ReturnCode = SAMPLE_TABLE_OUT_OF_RANGE_ERR_CODE; + ReturnCode = SAMPLE_APP_TABLE_OUT_OF_RANGE_ERR_CODE; } return ReturnCode; -} /* End of Sample_TblValidationFunc*/ +} /* End of SAMPLE_TBLValidationFunc() */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ diff --git a/fsw/src/sample_app.h b/fsw/src/sample_app.h index 14ab525..089e91a 100644 --- a/fsw/src/sample_app.h +++ b/fsw/src/sample_app.h @@ -48,11 +48,11 @@ #define SAMPLE_NUMBER_OF_TABLES 1 /* Number of Table(s) */ /* Define filenames of default data images for tables */ -#define SAMPLE_TABLE_FILE "/cf/sample_table.tbl" +#define SAMPLE_APP_TABLE_FILE "/cf/sample_app_tbl.tbl" -#define SAMPLE_TABLE_OUT_OF_RANGE_ERR_CODE -1 +#define SAMPLE_APP_TABLE_OUT_OF_RANGE_ERR_CODE -1 -#define SAMPLE_TBL_ELEMENT_1_MAX 10 +#define SAMPLE_APP_TBL_ELEMENT_1_MAX 10 /************************************************************************ ** Type Definitions *************************************************************************/ diff --git a/fsw/src/sample_table.c b/fsw/tables/sample_app_tbl.c similarity index 88% rename from fsw/src/sample_table.c rename to fsw/tables/sample_app_tbl.c index 331d796..8319693 100644 --- a/fsw/src/sample_table.c +++ b/fsw/tables/sample_app_tbl.c @@ -21,13 +21,13 @@ */ #include "cfe_tbl_filedef.h" /* Required to obtain the CFE_TBL_FILEDEF macro definition */ -#include "sample_table.h" +#include "sample_app_table.h" /* ** The following is an example of the declaration statement that defines the desired ** contents of the table image. */ -SAMPLE_Table_t sampleTable = { 1, 2}; +SAMPLE_APP_Table_t SampleAppTable = {1, 2}; /* ** The macro below identifies: @@ -36,4 +36,5 @@ SAMPLE_Table_t sampleTable = { 1, 2}; ** 3) a brief description of the contents of the file image ** 4) the desired name of the table image binary file that is cFE compatible */ -CFE_TBL_FILEDEF(sampleTable, SAMPLE_APP.SampleTable, Table Utility Test Table, sample_table.tbl ) +CFE_TBL_FILEDEF( SampleAppTable, SAMPLE_APP.SampleAppTable, Table Utility Test Table, sample_app_tbl.tbl ) + From f2b905db86bc47b6a806c3b9282fd4b4c5197ff2 Mon Sep 17 00:00:00 2001 From: "Gerardo E. Cruz-Ortiz" Date: Tue, 16 Jun 2020 23:06:18 -0400 Subject: [PATCH 2/3] HOTFIX: Rename items to reflect changes from PR#73 --- unit-test/coveragetest/coveragetest_sample_app.c | 10 +++++----- .../coveragetest/sample_app_coveragetest_common.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/unit-test/coveragetest/coveragetest_sample_app.c b/unit-test/coveragetest/coveragetest_sample_app.c index e3da007..9c6d691 100644 --- a/unit-test/coveragetest/coveragetest_sample_app.c +++ b/unit-test/coveragetest/coveragetest_sample_app.c @@ -497,7 +497,7 @@ void Test_SAMPLE_ProcessCC(void) * void SAMPLE_ProcessCC( const SAMPLE_Process_t *Msg ) */ SAMPLE_Process_t TestMsg; - SAMPLE_Table_t TestTblData; + SAMPLE_APP_Table_t TestTblData; void *TblPtr = &TestTblData; memset(&TestTblData, 0, sizeof(TestTblData)); @@ -578,17 +578,17 @@ void Test_SAMPLE_TblValidationFunc(void) * Test Case For: * int32 SAMPLE_TblValidationFunc( void *TblData ) */ - SAMPLE_Table_t TestTblData; + SAMPLE_APP_Table_t TestTblData; memset(&TestTblData, 0, sizeof(TestTblData)); /* nominal case (0) should succeed */ UT_TEST_FUNCTION_RC(SAMPLE_TblValidationFunc(&TestTblData), CFE_SUCCESS); - /* error case should return SAMPLE_TABLE_OUT_OF_RANGE_ERR_CODE */ - TestTblData.Int1 = 1 + SAMPLE_TBL_ELEMENT_1_MAX; + /* error case should return SAMPLE_APP_TABLE_OUT_OF_RANGE_ERR_CODE */ + TestTblData.Int1 = 1 + SAMPLE_APP_TBL_ELEMENT_1_MAX; UT_TEST_FUNCTION_RC(SAMPLE_TblValidationFunc(&TestTblData), - SAMPLE_TABLE_OUT_OF_RANGE_ERR_CODE); + SAMPLE_APP_TABLE_OUT_OF_RANGE_ERR_CODE); } diff --git a/unit-test/coveragetest/sample_app_coveragetest_common.h b/unit-test/coveragetest/sample_app_coveragetest_common.h index f514747..2f258b4 100644 --- a/unit-test/coveragetest/sample_app_coveragetest_common.h +++ b/unit-test/coveragetest/sample_app_coveragetest_common.h @@ -40,7 +40,7 @@ #include #include #include -#include +#include /* * Macro to call a function and check its int32 return code From 2a6b755c67ccd0c143ca4db54a22796ae0474370 Mon Sep 17 00:00:00 2001 From: "Gerardo E. Cruz-Ortiz" Date: Tue, 16 Jun 2020 23:06:18 -0400 Subject: [PATCH 3/3] Increase version to 1.1.11 and update ReadMe --- README.md | 6 ++++++ fsw/src/sample_app_version.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5072efd..6ca09ac 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,13 @@ sample_app is an example for how to build and link an application in cFS. See al ## Version History +### Development Build: 1.1.11 + +- Move the table to fsw/tables and renames "sample_table" to "sample_app_table +- See + ### Development Build: 1.1.10 + - Test cases now compare an expected event string with a string derived from the spec string and arguments that were output by the unit under test. - Replace references to `ccsds.h` types with the `cfe_sb.h`-provided type. - See diff --git a/fsw/src/sample_app_version.h b/fsw/src/sample_app_version.h index c577a98..4844a96 100644 --- a/fsw/src/sample_app_version.h +++ b/fsw/src/sample_app_version.h @@ -33,7 +33,7 @@ #define SAMPLE_APP_MAJOR_VERSION 1 #define SAMPLE_APP_MINOR_VERSION 1 -#define SAMPLE_APP_REVISION 10 +#define SAMPLE_APP_REVISION 11 #define SAMPLE_APP_MISSION_REV 0