Skip to content

Commit

Permalink
Fix nasa#207, organize source files according to current patterns
Browse files Browse the repository at this point in the history
Re-organize the source files to adhere to the recommended patterns.
  • Loading branch information
jphickey committed Oct 26, 2023
1 parent 6794db4 commit 1096a00
Show file tree
Hide file tree
Showing 22 changed files with 503 additions and 74 deletions.
8 changes: 2 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,17 @@ 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)

# 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)
Expand Down
27 changes: 27 additions & 0 deletions arch_build.cmake
Original file line number Diff line number Diff line change
@@ -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()
42 changes: 42 additions & 0 deletions config/default_sample_app_fcncodes.h
Original file line number Diff line number Diff line change
@@ -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
35 changes: 35 additions & 0 deletions config/default_sample_app_interface_cfg.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/************************************************************************
* 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 Public Definitions
*
* This provides default values for configurable items that affect
* the interface(s) of this module. This includes the CMD/TLM message
* interface, tables definitions, and any other data products that
* serve to exchange information with other entities.
*
* @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_INTERFACE_CFG_H
#define SAMPLE_APP_INTERFACE_CFG_H

#endif
44 changes: 44 additions & 0 deletions config/default_sample_app_internal_cfg.h
Original file line number Diff line number Diff line change
@@ -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
36 changes: 36 additions & 0 deletions config/default_sample_app_mission_cfg.h
Original file line number Diff line number Diff line change
@@ -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

#include "sample_app_interface_cfg.h"

#endif
38 changes: 38 additions & 0 deletions config/default_sample_app_msg.h
Original file line number Diff line number Diff line change
@@ -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_interface_cfg.h"
#include "sample_app_msgdefs.h"
#include "sample_app_msgstruct.h"

#endif
44 changes: 44 additions & 0 deletions config/default_sample_app_msgdefs.h
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -33,4 +29,4 @@
/* V1 Telemetry Message IDs must be 0x08xx */
#define SAMPLE_APP_HK_TLM_MID 0x0883

#endif /* SAMPLE_APP_MSGIDS_H */
#endif
Loading

0 comments on commit 1096a00

Please sign in to comment.