Skip to content

Commit

Permalink
Merge pull request nasa#209 from nasa/integration-candidate
Browse files Browse the repository at this point in the history
sample_app Integration candidate: Caelum-rc4+dev63
  • Loading branch information
dzbaker authored Oct 30, 2023
2 parents 6794db4 + b309b83 commit d043686
Show file tree
Hide file tree
Showing 29 changed files with 892 additions and 329 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## Development Build: v1.3.0-rc4+dev56
- Apply consistent Event ID names to common events
- Remove component-specific cFE header #includes
- Refactor SAMPLE_APP_Init/Process to remove multiple returns
- Add test for missing branch in SAMPLE_APP_Process()
- Zero out global data structure during initialization
- Move cmds and utils into separate files
- organize source files according to current patterns
- See <https://github.com/nasa/sample_app/pull/189>, <https://github.com/nasa/sample_app/pull/195>, <https://github.com/nasa/sample_app/pull/198>, <https://github.com/nasa/sample_app/pull/200>, <https://github.com/nasa/sample_app/pull/201>, <https://github.com/nasa/sample_app/pull/205>, and <https://github.com/nasa/sample_app/pull/208>

## Development Build: v1.3.0-rc4+dev39
- update cmake recipe
- See <https://github.com/nasa/sample_app/pull/203>
Expand Down
12 changes: 5 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
project(CFE_SAMPLE_APP C)

# Create the app module
add_cfe_app(sample_app fsw/src/sample_app.c)
add_cfe_app(sample_app fsw/src/sample_app.c
fsw/src/sample_app_cmds.c
fsw/src/sample_app_utils.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
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

/* Placeholder - SAMPLE_APP currently has no mission-scope config options */

#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_mission_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
57 changes: 31 additions & 26 deletions fsw/src/sample_app_msg.h → config/default_sample_app_msgstruct.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,57 +18,62 @@

/**
* @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
**
** They are each given their own type name matching the command name, which
** 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
{
CFE_MSG_TelemetryHeader_t TelemetryHeader; /**< \brief Telemetry header */
SAMPLE_APP_HkTlm_Payload_t Payload; /**< \brief Telemetry payload */
} SAMPLE_APP_HkTlm_t;

#endif /* SAMPLE_APP_MSG_H */
#endif /* SAMPLE_APP_MSGSTRUCT_H */
Loading

0 comments on commit d043686

Please sign in to comment.