From 6d3d30e8c95f1ba47e6e848b4e613c7f61a59735 Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Wed, 25 Oct 2023 16:12:30 -0400 Subject: [PATCH] Fix #207, organize source files according to current patterns Re-organize the source files to adhere to the recommended patterns. --- CMakeLists.txt | 8 +-- arch_build.cmake | 27 +++++++++ config/default_sample_app_fcncodes.h | 42 ++++++++++++++ config/default_sample_app_internal_cfg.h | 44 ++++++++++++++ config/default_sample_app_mission_cfg.h | 36 ++++++++++++ config/default_sample_app_msg.h | 38 +++++++++++++ config/default_sample_app_msgdefs.h | 44 ++++++++++++++ .../default_sample_app_msgids.h | 8 +-- .../default_sample_app_msgstruct.h | 57 ++++++++++--------- .../default_sample_app_perfids.h | 6 +- config/default_sample_app_platform_cfg.h | 41 +++++++++++++ .../default_sample_app_tbl.h | 23 ++++---- config/default_sample_app_tbldefs.h | 45 +++++++++++++++ config/default_sample_app_tblstruct.h | 45 +++++++++++++++ .../sample_app_eventids.h} | 2 +- fsw/src/sample_app.c | 6 +- fsw/src/sample_app.h | 14 +---- fsw/tables/sample_app_tbl.c | 2 +- mission_build.cmake | 49 ++++++++++++++++ .../sample_app_coveragetest_common.h | 4 +- unit-test/inc/ut_sample_app.h | 2 +- 21 files changed, 470 insertions(+), 73 deletions(-) create mode 100644 arch_build.cmake create mode 100644 config/default_sample_app_fcncodes.h create mode 100644 config/default_sample_app_internal_cfg.h create mode 100644 config/default_sample_app_mission_cfg.h create mode 100644 config/default_sample_app_msg.h create mode 100644 config/default_sample_app_msgdefs.h rename fsw/platform_inc/sample_app_msgids.h => config/default_sample_app_msgids.h (87%) rename fsw/src/sample_app_msg.h => config/default_sample_app_msgstruct.h (60%) rename fsw/mission_inc/sample_app_perfids.h => config/default_sample_app_perfids.h (93%) create mode 100644 config/default_sample_app_platform_cfg.h rename fsw/platform_inc/sample_app_table.h => config/default_sample_app_tbl.h (70%) create mode 100644 config/default_sample_app_tbldefs.h create mode 100644 config/default_sample_app_tblstruct.h rename fsw/{src/sample_app_events.h => inc/sample_app_eventids.h} (97%) create mode 100644 mission_build.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index f83279b..70e099f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,6 +3,7 @@ project(CFE_SAMPLE_APP C) # Create the app module add_cfe_app(sample_app fsw/src/sample_app.c) +target_include_directories(sample_app PUBLIC fsw/inc) # Include the public API from sample_lib to demonstrate how # to call library-provided functions add_cfe_app_dependency(sample_app sample_lib) @@ -10,14 +11,9 @@ add_cfe_app_dependency(sample_app sample_lib) # Add table add_cfe_tables(sample_app fsw/tables/sample_app_tbl.c) -target_include_directories(sample_app PUBLIC - fsw/mission_inc - fsw/platform_inc -) - # If UT is enabled, then add the tests from the subdirectory # Note that this is an app, and therefore does not provide -# stub functions, as other entities would not typically make +# stub functions, as other entities would not typically make # direct function calls into this application. if (ENABLE_UNIT_TESTS) add_subdirectory(unit-test) diff --git a/arch_build.cmake b/arch_build.cmake new file mode 100644 index 0000000..d2d95e2 --- /dev/null +++ b/arch_build.cmake @@ -0,0 +1,27 @@ +########################################################### +# +# SAMPLE_APP platform build setup +# +# This file is evaluated as part of the "prepare" stage +# and can be used to set up prerequisites for the build, +# such as generating header files +# +########################################################### + +# The list of header files that control the SAMPLE_APP configuration +set(SAMPLE_APP_PLATFORM_CONFIG_FILE_LIST + sample_app_internal_cfg.h + sample_app_platform_cfg.h + sample_app_perfids.h + sample_app_msgids.h +) + +# Create wrappers around the all the config header files +# This makes them individually overridable by the missions, without modifying +# the distribution default copies +foreach(SAMPLE_APP_CFGFILE ${SAMPLE_APP_PLATFORM_CONFIG_FILE_LIST}) + generate_config_includefile( + FILE_NAME "${SAMPLE_APP_CFGFILE}" + FALLBACK_FILE "${CMAKE_CURRENT_LIST_DIR}/config/default_${SAMPLE_APP_CFGFILE}" + ) +endforeach() diff --git a/config/default_sample_app_fcncodes.h b/config/default_sample_app_fcncodes.h new file mode 100644 index 0000000..aec457f --- /dev/null +++ b/config/default_sample_app_fcncodes.h @@ -0,0 +1,42 @@ +/************************************************************************ + * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * + * Copyright (c) 2020 United States Government as represented by the + * Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. You may obtain + * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ************************************************************************/ + +/** + * @file + * Specification for the SAMPLE_APP command function codes + * + * @note + * This file should be strictly limited to the command/function code (CC) + * macro definitions. Other definitions such as enums, typedefs, or other + * macros should be placed in the msgdefs.h or msg.h files. + */ +#ifndef SAMPLE_APP_FCNCODES_H +#define SAMPLE_APP_FCNCODES_H + +/************************************************************************ + * Macro Definitions + ************************************************************************/ + +/* +** Sample App command codes +*/ +#define SAMPLE_APP_NOOP_CC 0 +#define SAMPLE_APP_RESET_COUNTERS_CC 1 +#define SAMPLE_APP_PROCESS_CC 2 + +#endif diff --git a/config/default_sample_app_internal_cfg.h b/config/default_sample_app_internal_cfg.h new file mode 100644 index 0000000..32862ae --- /dev/null +++ b/config/default_sample_app_internal_cfg.h @@ -0,0 +1,44 @@ +/************************************************************************ + * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * + * Copyright (c) 2020 United States Government as represented by the + * Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. You may obtain + * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ************************************************************************/ + +/** + * @file + * SAMPLE_APP Application Private Config Definitions + * + * This provides default values for configurable items that are internal + * to this module and do NOT affect the interface(s) of this module. Changes + * to items in this file only affect the local module and will be transparent + * to external entities that are using the public interface(s). + * + * @note This file may be overridden/superceded by mission-provided defintions + * either by overriding this header or by generating definitions from a command/data + * dictionary tool. + */ +#ifndef SAMPLE_APP_INTERNAL_CFG_H +#define SAMPLE_APP_INTERNAL_CFG_H + +/***********************************************************************/ +#define SAMPLE_APP_PIPE_DEPTH 32 /* Depth of the Command Pipe for Application */ + +#define SAMPLE_APP_NUMBER_OF_TABLES 1 /* Number of Table(s) */ + +#define SAMPLE_APP_TABLE_OUT_OF_RANGE_ERR_CODE -1 + +#define SAMPLE_APP_TBL_ELEMENT_1_MAX 10 + +#endif diff --git a/config/default_sample_app_mission_cfg.h b/config/default_sample_app_mission_cfg.h new file mode 100644 index 0000000..93d3307 --- /dev/null +++ b/config/default_sample_app_mission_cfg.h @@ -0,0 +1,36 @@ +/************************************************************************ + * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * + * Copyright (c) 2020 United States Government as represented by the + * Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. You may obtain + * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ************************************************************************/ + +/** + * @file + * + * SAMPLE_APP Application Mission Configuration Header File + * + * This is a compatibility header for the "mission_cfg.h" file that has + * traditionally provided public config definitions for each CFS app. + * + * @note This file may be overridden/superceded by mission-provided defintions + * either by overriding this header or by generating definitions from a command/data + * dictionary tool. + */ +#ifndef SAMPLE_APP_MISSION_CFG_H +#define SAMPLE_APP_MISSION_CFG_H + +/* Placeholder - SAMPLE_APP currently has no mission-scope config options */ + +#endif diff --git a/config/default_sample_app_msg.h b/config/default_sample_app_msg.h new file mode 100644 index 0000000..1d94e43 --- /dev/null +++ b/config/default_sample_app_msg.h @@ -0,0 +1,38 @@ +/************************************************************************ + * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * + * Copyright (c) 2020 United States Government as represented by the + * Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. You may obtain + * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ************************************************************************/ + +/** + * @file + * Specification for the SAMPLE_APP command and telemetry + * message data types. + * + * This is a compatibility header for the "sample_app_msg.h" file that has + * traditionally provided the message definitions for cFS apps. + * + * @note This file may be overridden/superceded by mission-provided defintions + * either by overriding this header or by generating definitions from a command/data + * dictionary tool. + */ +#ifndef SAMPLE_APP_MSG_H +#define SAMPLE_APP_MSG_H + +#include "sample_app_mission_cfg.h" +#include "sample_app_msgdefs.h" +#include "sample_app_msgstruct.h" + +#endif diff --git a/config/default_sample_app_msgdefs.h b/config/default_sample_app_msgdefs.h new file mode 100644 index 0000000..7ea7b82 --- /dev/null +++ b/config/default_sample_app_msgdefs.h @@ -0,0 +1,44 @@ +/************************************************************************ + * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * + * Copyright (c) 2020 United States Government as represented by the + * Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. You may obtain + * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ************************************************************************/ + +/** + * @file + * Specification for the SAMPLE_APP command and telemetry + * message constant definitions. + * + * For SAMPLE_APP this is only the function/command code definitions + */ +#ifndef SAMPLE_APP_MSGDEFS_H +#define SAMPLE_APP_MSGDEFS_H + +#include "common_types.h" +#include "sample_app_fcncodes.h" + +/*************************************************************************/ +/* +** Type definition (Sample App housekeeping) +*/ + +typedef struct +{ + uint8 CommandErrorCounter; + uint8 CommandCounter; + uint8 spare[2]; +} SAMPLE_APP_HkTlm_Payload_t; + +#endif diff --git a/fsw/platform_inc/sample_app_msgids.h b/config/default_sample_app_msgids.h similarity index 87% rename from fsw/platform_inc/sample_app_msgids.h rename to config/default_sample_app_msgids.h index 154569e..6b11e55 100644 --- a/fsw/platform_inc/sample_app_msgids.h +++ b/config/default_sample_app_msgids.h @@ -18,12 +18,8 @@ /** * @file - * - * Define Sample App Message IDs - * - * \note The Sample App assumes default configuration which uses V1 of message id implementation + * SAMPLE_APP Application Message IDs */ - #ifndef SAMPLE_APP_MSGIDS_H #define SAMPLE_APP_MSGIDS_H @@ -33,4 +29,4 @@ /* V1 Telemetry Message IDs must be 0x08xx */ #define SAMPLE_APP_HK_TLM_MID 0x0883 -#endif /* SAMPLE_APP_MSGIDS_H */ +#endif diff --git a/fsw/src/sample_app_msg.h b/config/default_sample_app_msgstruct.h similarity index 60% rename from fsw/src/sample_app_msg.h rename to config/default_sample_app_msgstruct.h index 537d1d7..90d1a47 100644 --- a/fsw/src/sample_app_msg.h +++ b/config/default_sample_app_msgstruct.h @@ -18,30 +18,26 @@ /** * @file + * Specification for the SAMPLE_APP command and telemetry + * message data types. * - * Define SAMPLE App Messages and info + * @note + * Constants and enumerated types related to these message structures + * are defined in sample_app_msgdefs.h. */ +#ifndef SAMPLE_APP_MSGSTRUCT_H +#define SAMPLE_APP_MSGSTRUCT_H -#ifndef SAMPLE_APP_MSG_H -#define SAMPLE_APP_MSG_H +/************************************************************************ + * Includes + ************************************************************************/ -/* -** SAMPLE App command codes -*/ -#define SAMPLE_APP_NOOP_CC 0 -#define SAMPLE_APP_RESET_COUNTERS_CC 1 -#define SAMPLE_APP_PROCESS_CC 2 +#include "sample_app_mission_cfg.h" +#include "sample_app_msgdefs.h" +#include "cfe_msg_hdr.h" /*************************************************************************/ -/* -** Type definition (generic "no arguments" command) -*/ -typedef struct -{ - CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */ -} SAMPLE_APP_NoArgsCmd_t; - /* ** The following commands all share the "NoArgs" format ** @@ -49,21 +45,30 @@ typedef struct ** allows them to change independently in the future without changing the prototype ** of the handler function */ -typedef SAMPLE_APP_NoArgsCmd_t SAMPLE_APP_NoopCmd_t; -typedef SAMPLE_APP_NoArgsCmd_t SAMPLE_APP_ResetCountersCmd_t; -typedef SAMPLE_APP_NoArgsCmd_t SAMPLE_APP_ProcessCmd_t; +typedef struct +{ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ +} SAMPLE_APP_NoopCmd_t; + +typedef struct +{ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ +} SAMPLE_APP_ResetCountersCmd_t; + +typedef struct +{ + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ +} SAMPLE_APP_ProcessCmd_t; /*************************************************************************/ /* -** Type definition (SAMPLE App housekeeping) +** Type definition (Sample App housekeeping) */ typedef struct { - uint8 CommandErrorCounter; - uint8 CommandCounter; - uint8 spare[2]; -} SAMPLE_APP_HkTlm_Payload_t; + CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command header */ +} SAMPLE_APP_SendHkCmd_t; typedef struct { @@ -71,4 +76,4 @@ typedef struct SAMPLE_APP_HkTlm_Payload_t Payload; /**< \brief Telemetry payload */ } SAMPLE_APP_HkTlm_t; -#endif /* SAMPLE_APP_MSG_H */ +#endif /* SAMPLE_APP_MSGSTRUCT_H */ diff --git a/fsw/mission_inc/sample_app_perfids.h b/config/default_sample_app_perfids.h similarity index 93% rename from fsw/mission_inc/sample_app_perfids.h rename to config/default_sample_app_perfids.h index d87ea64..5c83334 100644 --- a/fsw/mission_inc/sample_app_perfids.h +++ b/config/default_sample_app_perfids.h @@ -18,13 +18,11 @@ /** * @file - * - * Define Sample App Performance IDs + * Define TO Lab Performance IDs */ - #ifndef SAMPLE_APP_PERFIDS_H #define SAMPLE_APP_PERFIDS_H #define SAMPLE_APP_PERF_ID 91 -#endif /* SAMPLE_APP_PERFIDS_H */ +#endif diff --git a/config/default_sample_app_platform_cfg.h b/config/default_sample_app_platform_cfg.h new file mode 100644 index 0000000..d62a136 --- /dev/null +++ b/config/default_sample_app_platform_cfg.h @@ -0,0 +1,41 @@ +/************************************************************************ + * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * + * Copyright (c) 2020 United States Government as represented by the + * Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. You may obtain + * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ************************************************************************/ + +/** + * @file + * + * SAMPLE_APP Application Platform Configuration Header File + * + * This is a compatibility header for the "platform_cfg.h" file that has + * traditionally provided both public and private config definitions + * for each CFS app. + * + * These definitions are now provided in two separate files, one for + * the public/mission scope and one for internal scope. + * + * @note This file may be overridden/superceded by mission-provided defintions + * either by overriding this header or by generating definitions from a command/data + * dictionary tool. + */ +#ifndef SAMPLE_APP_PLATFORM_CFG_H +#define SAMPLE_APP_PLATFORM_CFG_H + +#include "sample_app_mission_cfg.h" +#include "sample_app_internal_cfg.h" + +#endif diff --git a/fsw/platform_inc/sample_app_table.h b/config/default_sample_app_tbl.h similarity index 70% rename from fsw/platform_inc/sample_app_table.h rename to config/default_sample_app_tbl.h index ca688f0..f62b974 100644 --- a/fsw/platform_inc/sample_app_table.h +++ b/config/default_sample_app_tbl.h @@ -18,20 +18,19 @@ /** * @file + * Specification for the SAMPLE_APP table structures * - * Define sample app table + * @note + * Constants and enumerated types related to these table structures + * are defined in sample_app_tbldefs.h. */ +#ifndef SAMPLE_APP_TBL_H +#define SAMPLE_APP_TBL_H -#ifndef SAMPLE_APP_TABLE_H -#define SAMPLE_APP_TABLE_H +#include "sample_app_tbldefs.h" +#include "sample_app_tblstruct.h" -/* -** Table structure -*/ -typedef struct -{ - uint16 Int1; - uint16 Int2; -} SAMPLE_APP_Table_t; +/* Define filenames of default data images for tables */ +#define SAMPLE_APP_TABLE_FILE "/cf/sample_app_tbl.tbl" -#endif /* SAMPLE_APP_TABLE_H */ +#endif diff --git a/config/default_sample_app_tbldefs.h b/config/default_sample_app_tbldefs.h new file mode 100644 index 0000000..7338708 --- /dev/null +++ b/config/default_sample_app_tbldefs.h @@ -0,0 +1,45 @@ +/************************************************************************ + * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * + * Copyright (c) 2020 United States Government as represented by the + * Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. You may obtain + * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ************************************************************************/ + +/** + * @file + * Specification for the SAMPLE_APP table related + * constant definitions. + * + * @note + * These Macro definitions have been put in this file (instead of + * sample_app_tbl.h). DO NOT PUT ANY TYPEDEFS OR + * STRUCTURE DEFINITIONS IN THIS FILE! + * ADD THEM TO sample_app_tbl.h IF NEEDED! + */ +#ifndef SAMPLE_APP_TBLDEFS_H +#define SAMPLE_APP_TBLDEFS_H + +#include "common_types.h" +#include "sample_app_mission_cfg.h" + +/* +** Example Table structure +*/ +typedef struct +{ + uint16 Int1; + uint16 Int2; +} SAMPLE_APP_Table_t; + +#endif diff --git a/config/default_sample_app_tblstruct.h b/config/default_sample_app_tblstruct.h new file mode 100644 index 0000000..3cd7882 --- /dev/null +++ b/config/default_sample_app_tblstruct.h @@ -0,0 +1,45 @@ +/************************************************************************ + * NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes” + * + * Copyright (c) 2020 United States Government as represented by the + * Administrator of the National Aeronautics and Space Administration. + * All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. You may obtain + * a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ************************************************************************/ + +/** + * @file + * Specification for the SAMPLE_APP table structures + * + * Provides default definitions for SAMPLE_APP table structures + * + * @note This file may be overridden/superceded by mission-provided defintions + * either by overriding this header or by generating definitions from a command/data + * dictionary tool. + */ +#ifndef SAMPLE_APP_TBLSTRUCT_H +#define SAMPLE_APP_TBLSTRUCT_H + +/************************************************************************* + * Includes + *************************************************************************/ +#include "sample_app_tbldefs.h" + +/************************************************************************ + * Macro Definitions + ************************************************************************/ + +/************************************************************************* + * Type Definitions + *************************************************************************/ + +#endif diff --git a/fsw/src/sample_app_events.h b/fsw/inc/sample_app_eventids.h similarity index 97% rename from fsw/src/sample_app_events.h rename to fsw/inc/sample_app_eventids.h index 46e7aaf..b92b9e8 100644 --- a/fsw/src/sample_app_events.h +++ b/fsw/inc/sample_app_eventids.h @@ -19,7 +19,7 @@ /** * @file * - * Define SAMPLE App Events IDs + * Define Sample App Events IDs */ #ifndef SAMPLE_APP_EVENTS_H diff --git a/fsw/src/sample_app.c b/fsw/src/sample_app.c index 2961237..75fa897 100644 --- a/fsw/src/sample_app.c +++ b/fsw/src/sample_app.c @@ -24,10 +24,10 @@ /* ** Include Files: */ -#include "sample_app_events.h" +#include "sample_app_eventids.h" #include "sample_app_version.h" #include "sample_app.h" -#include "sample_app_table.h" +#include "sample_app_tbl.h" /* The sample_lib module provides the SAMPLE_LIB_Function() prototype */ #include @@ -239,7 +239,7 @@ void SAMPLE_APP_ProcessGroundCommand(CFE_SB_Buffer_t *SBBufPtr) CFE_MSG_GetFcnCode(&SBBufPtr->Msg, &CommandCode); /* - ** Process "known" SAMPLE app ground commands + ** Process "known" Sample App ground commands */ switch (CommandCode) { diff --git a/fsw/src/sample_app.h b/fsw/src/sample_app.h index 5e9006d..922ddd4 100644 --- a/fsw/src/sample_app.h +++ b/fsw/src/sample_app.h @@ -34,21 +34,13 @@ #include "cfe_sb.h" #include "cfe_es.h" +#include "sample_app_mission_cfg.h" +#include "sample_app_platform_cfg.h" + #include "sample_app_perfids.h" #include "sample_app_msgids.h" #include "sample_app_msg.h" -/***********************************************************************/ -#define SAMPLE_APP_PIPE_DEPTH 32 /* Depth of the Command Pipe for Application */ - -#define SAMPLE_APP_NUMBER_OF_TABLES 1 /* Number of Table(s) */ - -/* Define filenames of default data images for tables */ -#define SAMPLE_APP_TABLE_FILE "/cf/sample_app_tbl.tbl" - -#define SAMPLE_APP_TABLE_OUT_OF_RANGE_ERR_CODE -1 - -#define SAMPLE_APP_TBL_ELEMENT_1_MAX 10 /************************************************************************ ** Type Definitions *************************************************************************/ diff --git a/fsw/tables/sample_app_tbl.c b/fsw/tables/sample_app_tbl.c index 435409d..c380534 100644 --- a/fsw/tables/sample_app_tbl.c +++ b/fsw/tables/sample_app_tbl.c @@ -17,7 +17,7 @@ ************************************************************************/ #include "cfe_tbl_filedef.h" /* Required to obtain the CFE_TBL_FILEDEF macro definition */ -#include "sample_app_table.h" +#include "sample_app_tbl.h" /* ** The following is an example of the declaration statement that defines the desired diff --git a/mission_build.cmake b/mission_build.cmake new file mode 100644 index 0000000..9b7d460 --- /dev/null +++ b/mission_build.cmake @@ -0,0 +1,49 @@ +########################################################### +# +# SAMPLE_APP mission build setup +# +# This file is evaluated as part of the "prepare" stage +# and can be used to set up prerequisites for the build, +# such as generating header files +# +########################################################### + +# The list of header files that control the SAMPLE_APP configuration +set(SAMPLE_APP_MISSION_CONFIG_FILE_LIST + sample_app_fcncodes.h + sample_app_mission_cfg.h + sample_app_perfids.h + sample_app_msg.h + sample_app_msgdefs.h + sample_app_msgstruct.h + sample_app_tbl.h + sample_app_tbldefs.h + sample_app_tblstruct.h +) + +if (CFE_EDS_ENABLED_BUILD) + + # In an EDS-based build, these files come generated from the EDS tool + set(SAMPLE_APP_CFGFILE_SRC_sample_app_tbldefs "sample_app_eds_typedefs.h") + set(SAMPLE_APP_CFGFILE_SRC_sample_app_tblstruct "sample_app_eds_typedefs.h") + set(SAMPLE_APP_CFGFILE_SRC_sample_app_msgdefs "sample_app_eds_typedefs.h") + set(SAMPLE_APP_CFGFILE_SRC_sample_app_msgstruct "sample_app_eds_typedefs.h") + set(SAMPLE_APP_CFGFILE_SRC_sample_app_fcncodes "sample_app_eds_cc.h") + +endif(CFE_EDS_ENABLED_BUILD) + +# Create wrappers around the all the config header files +# This makes them individually overridable by the missions, without modifying +# the distribution default copies +foreach(SAMPLE_APP_CFGFILE ${SAMPLE_APP_MISSION_CONFIG_FILE_LIST}) + get_filename_component(CFGKEY "${SAMPLE_APP_CFGFILE}" NAME_WE) + if (DEFINED SAMPLE_APP_CFGFILE_SRC_${CFGKEY}) + set(DEFAULT_SOURCE GENERATED_FILE "${SAMPLE_APP_CFGFILE_SRC_${CFGKEY}}") + else() + set(DEFAULT_SOURCE FALLBACK_FILE "${CMAKE_CURRENT_LIST_DIR}/config/default_${SAMPLE_APP_CFGFILE}") + endif() + generate_config_includefile( + FILE_NAME "${SAMPLE_APP_CFGFILE}" + ${DEFAULT_SOURCE} + ) +endforeach() diff --git a/unit-test/coveragetest/sample_app_coveragetest_common.h b/unit-test/coveragetest/sample_app_coveragetest_common.h index 134e2ca..3f48bf6 100644 --- a/unit-test/coveragetest/sample_app_coveragetest_common.h +++ b/unit-test/coveragetest/sample_app_coveragetest_common.h @@ -34,9 +34,9 @@ #include "utstubs.h" #include "cfe.h" -#include "sample_app_events.h" +#include "sample_app_eventids.h" #include "sample_app.h" -#include "sample_app_table.h" +#include "sample_app_tbl.h" /* * Macro to add a test case to the list of tests to execute diff --git a/unit-test/inc/ut_sample_app.h b/unit-test/inc/ut_sample_app.h index ca8567e..858ef29 100644 --- a/unit-test/inc/ut_sample_app.h +++ b/unit-test/inc/ut_sample_app.h @@ -39,7 +39,7 @@ * Necessary to include these here to get the definition of the * "SAMPLE_APP_Data_t" typedef. */ -#include "sample_app_events.h" +#include "sample_app_eventids.h" #include "sample_app.h" /*