Skip to content

Commit

Permalink
Merge pull request #2313 from nasa/integration-candidate
Browse files Browse the repository at this point in the history
cFE Integration candidate: Caelum-rc4+dev48
  • Loading branch information
dzbaker authored Apr 28, 2023
2 parents c9b10f3 + 78333d3 commit 7479d22
Show file tree
Hide file tree
Showing 10 changed files with 370 additions and 359 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## Development Build: v7.0.0-rc4+dev287
- document CFS component file naming
- Add EVS port timestamp and simplify port selection
- remove else statement that was unreachable by unit tests
- correct fallback file case
- See <https://github.com/nasa/cFE/pull/2306>, <https://github.com/nasa/cFE/pull/2295>, <https://github.com/nasa/cFE/pull/2303>, and <https://github.com/nasa/cFE/pull/2312>

## Development Build: v7.0.0-rc4+dev276
- improve add_cfe_tables function
- add option to link to generated files
Expand Down
27 changes: 15 additions & 12 deletions cmake/global_functions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,32 +28,28 @@ function(cfe_locate_implementation_file OUTPUT_VAR FILE_NAME)

cmake_parse_arguments(LOCATEIMPL_ARG "OPTIONAL;ALLOW_LIST" "FALLBACK_FILE" "PREFIX;SUBDIR" ${ARGN})

# Always check for filename matches directly in the MISSION_DEFS dir
set(IMPL_SEARCH_BASEDIRS "${MISSION_DEFS}/")
set(IMPL_SEARCH_BASEDIRS)
# The prefix could also be a subdir, but do not repeat the mission name
foreach (PREFIX ${LOCATEIMPL_ARG_PREFIX})
if (NOT "${MISSIONCONFIG}" STREQUAL "${PREFIX}")
list(APPEND IMPL_SEARCH_BASEDIRS "${MISSION_DEFS}/${PREFIX}/")
endif()
endforeach()
# Always check for filename matches directly in the MISSION_DEFS dir
list(APPEND IMPL_SEARCH_BASEDIRS "${MISSION_DEFS}/")
list(REVERSE IMPL_SEARCH_BASEDIRS)

set(ADD_SUBDIRS)
foreach (SUBDIR ${LOCATEIMPL_ARG_SUBDIR})
foreach (BASEDIR ${IMPL_SEARCH_BASEDIRS})
list(APPEND ADD_SUBDIRS "${BASEDIR}${SUBDIR}/")
endforeach()
endforeach()
list(APPEND IMPL_SEARCH_BASEDIRS ${ADD_SUBDIRS})
list(REMOVE_DUPLICATES IMPL_SEARCH_BASEDIRS)

# Build the list of possible locations for this file in REVERSE priority order
set(IMPL_SEARCH_PATH)
if (LOCATEIMPL_ARG_FALLBACK_FILE)
if (IS_ABSOLUTE "${LOCATEIMPL_ARG_FALLBACK_FILE}")
list(APPEND IMPL_SEARCH_PATH "${LOCATEIMPL_ARG_FALLBACK_FILE}")
else()
list(APPEND IMPL_SEARCH_PATH "${CMAKE_CURRENT_LIST_DIR}/${LOCATEIMPL_ARG_FALLBACK_FILE}")
endif()
endif()

# Check for the existence of the file in each of the dirs
foreach(BASEDIR ${IMPL_SEARCH_BASEDIRS})
list(APPEND IMPL_SEARCH_PATH "${BASEDIR}${FILE_NAME}")
Expand All @@ -74,6 +70,14 @@ function(cfe_locate_implementation_file OUTPUT_VAR FILE_NAME)
endif()
endforeach()

if (NOT SELECTED_FILE AND LOCATEIMPL_ARG_FALLBACK_FILE)
if (IS_ABSOLUTE "${LOCATEIMPL_ARG_FALLBACK_FILE}")
set(SELECTED_FILE "${LOCATEIMPL_ARG_FALLBACK_FILE}")
else()
set(SELECTED_FILE "${CMAKE_CURRENT_LIST_DIR}/${LOCATEIMPL_ARG_FALLBACK_FILE}")
endif()
endif()

if (SELECTED_FILE)
message(STATUS "Using file: ${SELECTED_FILE} for ${FILE_NAME}")
elseif(NOT LOCATEIMPL_ARG_OPTIONAL)
Expand Down Expand Up @@ -156,7 +160,7 @@ function(generate_config_includefile)
set(GENCONFIG_ARG_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/inc")
endif (NOT GENCONFIG_ARG_OUTPUT_DIRECTORY)

if (IS_CFS_ARCH_BUILD)
if (IS_CFS_ARCH_BUILD AND NOT GENCONFIG_ARG_PREFIXES)
set(ARCH_PREFIXES ${BUILD_CONFIG})
else()
set(ARCH_PREFIXES)
Expand All @@ -176,7 +180,6 @@ function(generate_config_includefile)
else()
# Use the common search function to find the candidate(s)
cfe_locate_implementation_file(SRC_LOCAL_PATH_LIST "${TGTFILE}"
ALLOW_LIST
FALLBACK_FILE "${GENCONFIG_ARG_FALLBACK_FILE}"
PREFIX ${GENCONFIG_ARG_PREFIXES} ${ARCH_PREFIXES}
SUBDIR config
Expand Down
140 changes: 108 additions & 32 deletions docs/cFE Application Developers Guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -318,14 +318,14 @@ directory is described as a note under each folder.
| |-- The flight software is all configured and built under this directory
| |-- All mission and platform configuration files are placed here
|-- apps
| |-- Contains application source code.
| |-- Contains application source code.
| |-- Application source code may be shared amoung multiple build CPUs
|-- libs
| |-- Contains Core Flight System (cFS) Sample Library (sample_lib)
|-- tools
| |-- Contains Core Flight System (cFS) tools
```
Module descriptions are provided in the table below.
```
Module descriptions are provided in the table below.
```
-- missionxyz/cfe
|-- cmake
Expand Down Expand Up @@ -353,7 +353,7 @@ Module descriptions are provided in the table below.
```
-- missionxyz/build
|-- CMakeFiles
| |-- Cmake fore cfe core build and all apps
| |-- Cmake for cfe core build and all apps
|-- cpu1
| |-- Contains start up script "cfe_es_startup.scr"
| |-- Where build.o and executable files, etc. are placed
Expand All @@ -364,12 +364,12 @@ Module descriptions are provided in the table below.
| |-- Where the cpu1 platform configuration include files go
|-- src
|-- tools
```
```
```
-- missionxyz/build/cpu1
|-- default_cpu1
| |-- CMakeFiles
| | | Cmake fore cfe core build and all apps
| | | Cmake for cfe core build and all apps
| |-- apps
| | |-- Where application makefiles go
| | |-- One directory per application
Expand All @@ -392,19 +392,19 @@ Module descriptions are provided in the table below.
| |-- tbl
| |-- time
```
```
```
-- missionxyz/apps
|-- ci_lab
|-- sample_app
|-- sch_lab
|-- to_lab
```
```
```
```
-- missionxyz/tools
|-- cFS-GroundSystem
|-- elf2cfetbl
|-- tblCRCTool
```
```
```
-- missionxyz/cf/modules/es
|-- eds
Expand Down Expand Up @@ -599,33 +599,109 @@ Child Tasks can be useful in both "Software Only" and "Hardware Servicing"
applications.

## 4.2 Best Practices

### 4.2.1 cFS Application Template

Applications designed to interface with the cFE should follow standard templates.
Reference sample_app on Github for “live” example.

| **Directory** | **Descriptions** |
|:--------------------------------------|:-------------------------------------------------------------------------------------------------------------|
| fsw/ | All components which are used on/deployed to the actual target or define the interface to those components |
| fsw/inc/ | Public/Interface headers for the component |
| fsw/src/ | Source files and private headers for the component |
| tables/ | Example/Initial table definitions |



| **Files** | **Descriptions** |
|:--------------------------------------|:-------------------------------------------------------------------------------------------------------------|
| fsw/src/sample_app.c | Main source code for sample_app. Located in src directory. |
| fsw/src/sample_app.h | Main header file for sample_app. It contains your main global typedef, prototypes, and miscellaneous define. |
| fsw/src/sample_app_events.h | Defines sample_app event IDs |
| fsw/src/sample_app_msg.h | Defines sample_app commands and its structures |
| fsw/tables/sample_app_table.c | Define sample_app table(s) |
| fsw/platform_inc/sample_app_msgids.h | Define sample_app message IDs |
| fsw/mission_inc/sample_app_perfids.h | Define sample_app performance IDs |

In addition to showing the standard structure of a cFS application, the
sample_app also demonstrates how to interface with cFS libraries and table
services.
__File Organization and Directory Structure__

| **Directory** | **Content** |
|:--------------------------------------|:-------------------------------------------------------------------------------|
| config/ | Example configuration files for the component |
| eds/ | CCSDS Electronic Data Sheet package for the component (defined per book 876.0) |
| fsw/ | Source units that comprise the flight software that executes on the target |
| fsw/inc/ | Public/Interface headers for the component |
| fsw/src/ | Source files and private headers for the component |
| tables/ | Example table definitions for the component |

__Source File Naming Convention__

All source files associated with a component should begin with the component name as a prefix, to help ensure uniqueness
of file names across all flight software packages once imported into a combined software tree. All of the configuration header
files should also be overridable at the mission level; that is, a component only provides a default file (with a `default_` prefix,
for distinction) that can be "cloned and owned" by placing a copy, without the `default_` prefix, into the `_defs` directory
for the CFE/CFS mission build. Any customized file(s) in the `_defs` directory will be seen by the CMake build system and used
instead of the default version of the file that is provided from the orignal source tree.

| **File Name Pattern** | **Scope** | **Content** |
|:---------------------------|:---------:|:----------------------------------------------------------------------------------------------------|
| _module_`_fcncodes.h` | INTERFACE | Function Codes and associated documentation for the CMD interface of the component (see note) |
| _module_`_msgdefs.h` | INTERFACE | Constant definitions for the CMD/TLM interface(s) of the component (see note) |
| _module_`_tbldefs.h` | INTERFACE | Constant definitions that affect the table file interface(s) of the component |
| _module_`_msgstruct.h` | INTERFACE | Structures that define the CMD/TLM message interface(s) of the component |
| _module_`_tblstruct.h` | INTERFACE | Structures that define the table file interface(s) of the component |
| _module_`_interface_cfg.h` | INTERFACE | Other configuration that affects the interface(s) of the component (table files and/or messages) |
| _module_`_eventids.h` | INTERFACE | CFE EVS Event IDs for the component, with descriptions/documentation |
| _module_`_global_cfg.h` | MISSION | Constants that need to be consistent across all instances, but do not directly affect interface(s) |
| _module_`_version.h` | MISSION | Version number of the component |
| _module_`_msgids.h` | PLATFORM | CFE Software Bus Message ID definitions for CMD/TLM interface(s) of the component |
| _module_`_internal_cfg.h` | PLATFORM | Software configuration that does not affect interfaces, and may be different per instance/platform |
| _module_`_perfids.h` | PLATFORM | CFE ES Performance monitor IDs for the component, with descriptions/documentation |
| _module_`_verify.h` | FSW | Compile-time configuration validation (typically included from only one source file) |
| _module_`_app.[ch]` | FSW | Application entry point, initialization, and main task loop |
| _module_`_cmds.[ch]` | FSW | Application command processor functions |
| _module_`_dispatch.[ch]` | FSW | Dispatch table for validating incoming commands and invoking appropriate command processor |

**NOTE**: For backward compatibility, the `_msgdefs.h` header should also provide the function code definitions from `_fcncodes.h`, such that
inclusion of the `_msgdefs.h` file alone provides the command codes as well as any other required definitions for message interpretation.
However, the `_fcncodes.h` header should be strictly limited to defining command/function codes for the command interface and should not contain
any other information.

**IMPORANT**: All of the header files above with "INTERFACE" scope control the table/message interface of the component. Changing any of the
values or definitions in these files will affect the inter-processor communication - either table files, exported data products, commands, or
telementry messages. Due caution should be exercised when customizing any of these files, as any changes will need to be propagated to all
other CFE instances, ground systems, test software or scripts, or any other tools that interact with the flight softare.

Also note that Electronic Data Sheets (EDS) definitions will supercede the "INTERFACE" header files listed above. These headers are not
used by the software when building FSW based on EDS. Instead, the EDS tool will generate these headers based on the content of the EDS file(s)
and the software will be configured to use the generated headers during the build.

__Combination Headers__

The header files in this section combine two or more files from the above set for simplicity of usage in source code, as well as backward
compatiblity with traditional file names from older versions of CFS apps. Although these files may also be overridden directly, it is
recommended to only override/modify the more granular headers defined above.

| **File Name Pattern** | **Content** |
|:---------------------------|:-------------------------------------------------------------------------------------------|
| _module_`_mission_cfg.h` | Combination of `global_cfg.h` and `interface_cfg.h` (mission scope configuration) |
| _module_`_platform_cfg.h` | Combination of `mission_cfg.h` (above), `internal_cfg.h` and any other dependencies |
| _module_`_msg.h` | Complete message interface: Combination of `msgdefs.h`, `msgstruct.h` and all dependencies |
| _module_`_tbl.h` | Complete table interface: Combination of `tbldefs.h`, `tblstruct.h` and all dependencies |

**IMPORANT**: Files from a limited scope may depend on files from a broader scope, but not the other way around. For example,
the `platform_cfg.h` may depend on items defined in `mission_cfg.h`, but items in `mission_cfg.h` must **not** depend on items
defined in `platform_cfg.h`.

__Example for SAMPLE_APP__

The sample application (SAMPLE_APP) provides a concrete example of the currently-recommended patterns for CFE/CFS applications.
This section provides a summary the naming conventions put into practice for the sample application.

| **Files** | **Description** |
|:--------------------------------------------|:--------------------------------------------------------------------------------------------------|
| `config/default_sample_app_msgids.h` | CFE Software Bus Message ID definitions for SAMPLE_APP (CMD, SEND_HK, and HK_TLM) |
| `config/default_sample_app_msgdefs.h` | Not needed |
| `config/default_sample_app_tbldefs.h` | Not needed |
| `config/default_sample_app_msgstruct.h` | Defines NoopCmd, ResetCountersCmd, ProcessCmd, and HkTlm message structures |
| `config/default_sample_app_tblstruct.h` | Defines the example table content structure |
| `config/default_sample_app_interface_cfg.h` | Not needed |
| `config/default_sample_app_global_cfg.h` | Not needed |
| `config/default_sample_app_internal_cfg.h` | Not needed |
| `eds/sample_app.xml` | EDS `<PackageFile>` for the SAMPLE_APP component (supercedes headers above, if enabled) |
| `fsw/inc/sample_app_events.h` | Defines sample_app event IDs |
| `fsw/inc/sample_app_perfids.h` | Define sample_app performance IDs |
| `fsw/src/sample_app.c` | Application entry point, initialization, and main task loop |
| `fsw/inc/sample_app.h` | Declarations/Prototypes for `sample_app.c` that are needed by other source units |
| `fsw/src/sample_app_cmds.c` | Application command processor functions |
| `fsw/inc/sample_app_cmds.h` | Declarations/Prototypes for `sample_app_cmds.c` that are needed by other source units |
| `fsw/src/sample_app_dispatch.c` | Application command dispatcher ("TaskPipe"; identification and validation of all message inputs) |
| `fsw/inc/sample_app_dispatch.h` | Declarations/Prototypes for `sample_app_dispatch.c` that are needed by other source units |

In addition to showing the standard structure of a cFS application, the sample_app also demonstrates how to interface with cFS libraries
and table services.

### 4.2.2 Avoid "Endian-ness" Dependencies

Expand Down
2 changes: 1 addition & 1 deletion modules/core_api/fsw/inc/cfe_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#define CFE_VERSION_H

/* Development Build Macro Definitions */
#define CFE_BUILD_NUMBER 276 /**< @brief Development: Number of development git commits since CFE_BUILD_BASELINE */
#define CFE_BUILD_NUMBER 287 /**< @brief Development: Number of development git commits since CFE_BUILD_BASELINE */
#define CFE_BUILD_BASELINE "v7.0.0-rc4" /**< @brief Development: Reference git tag for build number */

/* See \ref cfsversions for definitions */
Expand Down
4 changes: 2 additions & 2 deletions modules/core_api/mission_build.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
generate_config_includefile(
FILE_NAME "cfe_mission_cfg.h"
MATCH_SUFFIX "mission_cfg.h"
PREFIXES ${MISSIONCONFIG}
PREFIXES ${MISSIONCONFIG} cfe
)

generate_config_includefile(
FILE_NAME "cfe_perfids.h"
MATCH_SUFFIX "perfids.h"
PREFIXES ${MISSIONCONFIG}
PREFIXES ${MISSIONCONFIG} cfe
)

Loading

0 comments on commit 7479d22

Please sign in to comment.