Skip to content

Commit

Permalink
Merge pull request nasa#2480 from nasa/integration-candidate
Browse files Browse the repository at this point in the history
cFE Integration candidate: Caelum-rc4+dev66
  • Loading branch information
dzbaker authored Dec 12, 2023
2 parents ee18742 + ac79261 commit 70458a2
Show file tree
Hide file tree
Showing 47 changed files with 736 additions and 416 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Development Build: v7.0.0-rc4+dev434
- Update docs and UT to use CFE_MSG_PTR
- document ES Perf enums
- document and use topicid numbers for cfe
- See <https://github.com/nasa/cFE/pull/2472>, <https://github.com/nasa/cFE/pull/2411>, and <https://github.com/nasa/cFE/pull/2474>

## Development Build: v7.0.0-rc4+dev424
- Add perfid limit info to ES docstring
- TBL UT update for OSAL/CFE path length mismatch
Expand Down
79 changes: 78 additions & 1 deletion cmake/arch_build.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,81 @@ function(cfs_app_check_intf MODULE_NAME)
endfunction(cfs_app_check_intf)


##################################################################
#
# FUNCTION: setup_platform_msgids
#
# This is intended to support cases where MsgIDs for all apps
# and modules are assigned in a single/unified header file
#
function(setup_platform_msgids)

set(PLATFORM_MSGID_HEADERFILE)

# In an EDS build, the msg IDs always come from EDS, there should not be a local msgids.h file
if (NOT CFE_EDS_ENABLED_BUILD)

# Check for the presence of a platform-specific msgid file
# This uses cfe_locate_implementation_file() as this returns whether or not it found one
cfe_locate_implementation_file(PLATFORM_MSGID_HEADERFILE "msgids.h"
PREFIX ${BUILD_CONFIG} cfs
SUBDIR config
)

# If a top level file was found, then create a wrapper around it called "cfs_msgids.h"
# Note that at this point it could be a list
if (PLATFORM_MSGID_HEADERFILE)

set(TEMP_WRAPPER_FILE_CONTENT)
foreach(SELECTED_FILE ${PLATFORM_MSGID_HEADERFILE})
file(TO_NATIVE_PATH "${SELECTED_FILE}" SRC_NATIVE_PATH)
list(APPEND TEMP_WRAPPER_FILE_CONTENT "#include \"${SRC_NATIVE_PATH}\"\n")
endforeach()

# Generate a header file
generate_c_headerfile("${CMAKE_BINARY_DIR}/inc/cfs_msgids.h" ${TEMP_WRAPPER_FILE_CONTENT})
unset(TEMP_WRAPPER_FILE_CONTENT)

# From here on use the wrapper file
set(PLATFORM_MSGID_HEADERFILE "cfs_msgids.h")

endif(PLATFORM_MSGID_HEADERFILE)

endif(NOT CFE_EDS_ENABLED_BUILD)

# Finally, export a CFGFILE_SRC variable for each of the deps
# This should make each respective "mission_build" create a wrapper
# that points directly at this global file, ignoring the default
if (PLATFORM_MSGID_HEADERFILE)

# Historically there has been a cfe_msgids.h defined at the core api level
# be sure to include this in the export list
set (OUTPUT_VAR_LIST
CORE_API_CFGFILE_SRC_cfe_msgids
)

# Slight inconsistency: for CFE core components, the cfe_ prefix is omitted in DEP_NAME
# To make this work without major impact, add it back in here
foreach(DEP_NAME ${MISSION_CORE_MODULES})
string(TOUPPER "${DEP_NAME}_CFGFILE_SRC" CFGSRC)
list(APPEND OUTPUT_VAR_LIST ${CFGSRC}_cfe_${DEP_NAME}_msgids)
endforeach(DEP_NAME ${MISSION_CORE_MODULES})

foreach(DEP_NAME ${TGTSYS_${SYSVAR}_APPS} ${TGTSYS_${SYSVAR}_STATICAPPS})
string(TOUPPER "${DEP_NAME}_CFGFILE_SRC" CFGSRC)
list(APPEND OUTPUT_VAR_LIST ${CFGSRC}_${DEP_NAME}_msgids)
endforeach(DEP_NAME ${MISSION_APPS})

# This is the actual export to parent scope
foreach(VAR_NAME ${OUTPUT_VAR_LIST})
message("${VAR_NAME}=${PLATFORM_MSGID_HEADERFILE}")
set(${VAR_NAME} ${PLATFORM_MSGID_HEADERFILE} PARENT_SCOPE)
endforeach(VAR_NAME ${OUTPUT_VAR_LIST})

endif (PLATFORM_MSGID_HEADERFILE)

endfunction(setup_platform_msgids)



##################################################################
Expand Down Expand Up @@ -658,6 +733,9 @@ function(prepare)
list(REMOVE_AT BUILD_CONFIG 0)
set(BUILD_CONFIG ${BUILD_CONFIG} PARENT_SCOPE)

# Check if the user has provided a platform-specific "msgids.h" file and set up a wrapper to it
setup_platform_msgids()

# Pull in any application-specific platform-scope configuration
# This may include user configuration files such as cfe_platform_cfg.h,
# or any other configuration/preparation that needs to happen at
Expand Down Expand Up @@ -746,7 +824,6 @@ function(process_arch SYSVAR)
endif()
endforeach()


# Add all core modules
# The osal is handled explicitly (above) since this has special extra config
foreach(DEP ${MISSION_CORE_INTERFACES} ${MISSION_CORE_MODULES})
Expand Down
75 changes: 75 additions & 0 deletions cmake/mission_build.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,78 @@ function(generate_build_version_templates)

endfunction(generate_build_version_templates)

##################################################################
#
# FUNCTION: setup_global_topicids
#
# This is intended to support cases where topic IDs for all apps
# and modules are assigned in a single/unified header file
#
function(setup_global_topicids)

if (CFE_EDS_ENABLED_BUILD)

# In an EDS build, the topic IDs always come from EDS
set(MISSION_GLOBAL_TOPICID_HEADERFILE "cfe_mission_eds_designparameters.h")

else(CFE_EDS_ENABLED_BUILD)

# Check for the presence of a mission-wide/global topic ID file
# This uses cfe_locate_implementation_file() as this returns whether or not it found one
cfe_locate_implementation_file(MISSION_GLOBAL_TOPICID_HEADERFILE "global_topicids.h"
PREFIX ${MISSIONCONFIG} cfs
SUBDIR config
)

# If a top level file was found, then create a wrapper around it called "cfs_global_topicids.h"
# Note that at this point it could be a list
if (MISSION_GLOBAL_TOPICID_HEADERFILE)

set(TEMP_WRAPPER_FILE_CONTENT)
foreach(SELECTED_FILE ${MISSION_GLOBAL_TOPICID_HEADERFILE})
file(TO_NATIVE_PATH "${SELECTED_FILE}" SRC_NATIVE_PATH)
list(APPEND TEMP_WRAPPER_FILE_CONTENT "#include \"${SRC_NATIVE_PATH}\"\n")
endforeach()

# Generate a header file
generate_c_headerfile("${CMAKE_BINARY_DIR}/inc/cfs_global_topicids.h" ${TEMP_WRAPPER_FILE_CONTENT})
unset(TEMP_WRAPPER_FILE_CONTENT)

# From here on use the wrapper file
set(MISSION_GLOBAL_TOPICID_HEADERFILE "cfs_global_topicids.h")

endif(MISSION_GLOBAL_TOPICID_HEADERFILE)

endif(CFE_EDS_ENABLED_BUILD)

# Finally, export a CFGFILE_SRC variable for each of the deps
# This should make each respective "mission_build" create a wrapper
# that points directly at this global file, ignoring the default
if (MISSION_GLOBAL_TOPICID_HEADERFILE)

set (OUTPUT_VAR_LIST)

# Slight inconsistency: for CFE core components, the cfe_ prefix is omitted in DEP_NAME
# To make this work without major impact, add it back in here
foreach(DEP_NAME ${MISSION_CORE_MODULES})
string(TOUPPER "${DEP_NAME}_CFGFILE_SRC" CFGSRC)
list(APPEND OUTPUT_VAR_LIST ${CFGSRC}_cfe_${DEP_NAME}_topicids)
endforeach(DEP_NAME ${MISSION_CORE_MODULES})

foreach(DEP_NAME ${MISSION_APPS})
string(TOUPPER "${DEP_NAME}_CFGFILE_SRC" CFGSRC)
list(APPEND OUTPUT_VAR_LIST ${CFGSRC}_${DEP_NAME}_topicids)
endforeach(DEP_NAME ${MISSION_APPS})

# This is the actual export to parent scope
foreach(VAR_NAME ${OUTPUT_VAR_LIST})
set(${VAR_NAME} ${MISSION_GLOBAL_TOPICID_HEADERFILE} PARENT_SCOPE)
endforeach(VAR_NAME ${OUTPUT_VAR_LIST})

endif (MISSION_GLOBAL_TOPICID_HEADERFILE)

endfunction(setup_global_topicids)

##################################################################
#
# FUNCTION: prepare
Expand Down Expand Up @@ -348,6 +420,9 @@ function(prepare)
add_dependencies(cfe-usersguide doc-prebuild)
add_dependencies(mission-doc doc-prebuild)

# Set up the global topicid header file, if present
setup_global_topicids()

# Pull in any application-specific mission-scope configuration
# This may include user configuration files such as cfe_mission_cfg.h,
# msgid definitions, or any other configuration/preparation that needs to
Expand Down
20 changes: 9 additions & 11 deletions cmake/sample_defs/example_platform_cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,26 @@
* limitations under the License.
************************************************************************/

/**
/**
* @file
*
* This header file contains the internal configuration parameters and
* typedefs with platform scope.
*
*
* This provides default values for configurable items that do NOT affect
* the interface(s) of this module. This includes internal parameters,
* path names, and limit value(s) that are relevant for a specific platform.
*
*
* @note It is no longer necessary to provide this file directly in the defs
* directory, but if present, this file is still supported/usable for backward
* directory, but if present, this file is still supported/usable for backward
* compatibility. To use this file, is should be called "cfe_platform_cfg.h".
*
*
* Going forward, more fine-grained (module/purposes-specific) header files are
* included with each submodule. These may be overridden as necessary, but only
* if a definition within that file needs to be changed from the default. This
* approach will reduce the amount of duplicate/cloned definitions and better
* approach will reduce the amount of duplicate/cloned definitions and better
* support alternative build configurations in the future.
*
*
* Note that if this file is present, the fine-grained header files noted above
* will _not_ be used.
*/
Expand Down Expand Up @@ -83,7 +83,6 @@
*/
#define CFE_PLATFORM_CORE_MAX_STARTUP_MSEC 30000


/*******************************************************************************/
/*
* CFE Executive Services (CFE_ES) Application Private Config Definitions
Expand Down Expand Up @@ -1726,7 +1725,7 @@
*/
#define CFE_PLATFORM_TIME_START_TASK_PRIORITY 60
#define CFE_PLATFORM_TIME_TONE_TASK_PRIORITY 25
#define CFE_PLATFORM_TIME_1HZ_TASK_PRIORITY 25
#define CFE_PLATFORM_TIME_ONEHZ_TASK_PRIORITY 25

/**
** \cfetimecfg Define TIME Task Stack Sizes
Expand All @@ -1745,7 +1744,6 @@
*/
#define CFE_PLATFORM_TIME_START_TASK_STACK_SIZE CFE_PLATFORM_ES_DEFAULT_STACK_SIZE
#define CFE_PLATFORM_TIME_TONE_TASK_STACK_SIZE 4096
#define CFE_PLATFORM_TIME_1HZ_TASK_STACK_SIZE 8192
#define CFE_PLATFORM_TIME_ONEHZ_TASK_STACK_SIZE 8192

#endif /* EXAMPLE_PLATFORM_CFG_H */

18 changes: 9 additions & 9 deletions docs/cFE Application Developers Guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -1916,7 +1916,7 @@ FILE: sample_app.h
*/
typedef struct
{
CFE_MSG_TelemetryHeader_t TlmHeader;
CFE_MSG_TelemetryHeader_t TelemetryHeader;

/*
** Task command interface counters...
Expand Down Expand Up @@ -1949,7 +1949,7 @@ SAMPLE_AppData_t SAMPLE_AppData; /* Instantiate Task Data */
int32 Status;

...
Status = CFE_MSG_Init(&SAMPLE_AppData.HkPacket.TlmHeader.Msg, /* Address of SB Message Data Buffer */
Status = CFE_MSG_Init(CFE_MSG_PTR(SAMPLE_AppData.HkPacket.TelemetryHeader), /* Location of SB Message Data Buffer */
SAMPLE_HK_TLM_MID, /* SB Message ID associated with Data */
sizeof(SAMPLE_AppData.HkPacket)); /* Size of Buffer */
...
Expand Down Expand Up @@ -2107,8 +2107,8 @@ SAMPLE_AppData_t SAMPLE_AppData; /* Instantiate Task Data */
/*
** Send housekeeping telemetry packet...
*/
CFE_SB_TimeStampMsg(&SAMPLE_APP_Data.HkTlm.TlmHeader.Msg);
CFE_SB_TransmitMsg(&SAMPLE_APP_Data.HkTlm.TlmHeader.Msg, true);
CFE_SB_TimeStampMsg(CFE_MSG_PTR(SAMPLE_APP_Data.HkTlm.TelemetryHeader));
CFE_SB_TransmitMsg(CFE_MSG_PTR(SAMPLE_APP_Data.HkTlm.TelemetryHeader), true);
...
}
```
Expand Down Expand Up @@ -2222,7 +2222,7 @@ FILE: sample_app.h
*/
typedef struct
{
CFE_MSG_CommandHeader_t TlmHeader;
CFE_MSG_CommandHeader_t TelemetryHeader;

/*
** Task command interface counters...
Expand Down Expand Up @@ -2255,17 +2255,17 @@ SAMPLE_AppData_t SAMPLE_AppData; /* Instantiate Task Data */
*/
SAMPLE_AppData.BigPktBuf = (SAMPLE_BigPkt_Buffer_t *)CFE_SB_AllocateMessageBuffer(sizeof(SAMPLE_BigPkt_t));

CFE_MSG_Init(SAMPLE_AppData.BigPktBuf->Pkt.TlmHeader.Msg, SAMPLE_BIG_TLM_MID,
sizeof(SAMPLE_AppData.BigPktBuf->Pkt);
CFE_MSG_Init(SAMPLE_AppData.BigPktBuf->Pkt.TelemetryHeader.Msg, SAMPLE_BIG_TLM_MID,
sizeof(SAMPLE_AppData.BigPktBuf->Pkt));

/*
** ...Fill Packet with Data...
*/

/*
/*
** Send Message after time tagging it with current time
*/
CFE_SB_TimeStampMsg(&SAMPLE_AppData.BigPktBuf->Pkt.TlmHeader.Msg);
CFE_SB_TimeStampMsg(&SAMPLE_AppData.BigPktBuf->Pkt.TelemetryHeader.Msg);
CFE_SB_TransmitBuffer(SAMPLE_AppData.BigPktBuf, BufferHandle, true);
/* SAMPLE_AppData.BigPktBuf is no longer a valid pointer */
...
Expand Down
4 changes: 2 additions & 2 deletions docs/src/cfe_time.dox
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@
TIME provides the ability to command a one time adjustment
(#CFE_TIME_ADD_ADJUST_CC and #CFE_TIME_SUB_ADJUST_CC)
to the current STCF. In addition there is a 1Hz adjustment
(#CFE_TIME_ADD_1HZ_ADJUSTMENT_CC and #CFE_TIME_SUB_1HZ_ADJUSTMENT_CC)
(#CFE_TIME_ADD_ONEHZ_ADJUSTMENT_CC and #CFE_TIME_SUB_ONEHZ_ADJUSTMENT_CC)
that can be made to the STCF to compensate for oscillator drift.
Mission specific ground correlation should be used to assist in
determining the proper values to use. The Leap Seconds should be
Expand All @@ -671,7 +671,7 @@
to by the other systems.

\sa #CFE_TIME_ADD_ADJUST_CC, #CFE_TIME_SUB_ADJUST_CC, #CFE_TIME_SET_STCF_CC,
#CFE_TIME_ADD_1HZ_ADJUSTMENT_CC, #CFE_TIME_SUB_1HZ_ADJUSTMENT_CC, #CFE_TIME_SET_LEAP_SECONDS_CC
#CFE_TIME_ADD_ONEHZ_ADJUSTMENT_CC, #CFE_TIME_SUB_ONEHZ_ADJUSTMENT_CC, #CFE_TIME_SET_LEAP_SECONDS_CC
**/


Expand Down
4 changes: 2 additions & 2 deletions modules/cfe_testcase/config/default_cfe_test_msgids.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
/*
** cFE Command Message Id's
*/
#define CFE_TEST_CMD_MID CFE_PLATFORM_CMD_MID_BASE + CFE_MISSION_TEST_CMD_MSG /* 0x1802 */
#define CFE_TEST_CMD_MID CFE_PLATFORM_CMD_TOPICID_TO_MIDV(CFE_MISSION_TEST_CMD_TOPICID) /* 0x1802 */

/*
** CFE Telemetry Message Id's
*/
#define CFE_TEST_HK_TLM_MID CFE_PLATFORM_TLM_MID_BASE + CFE_MISSION_TEST_HK_TLM_MSG /* 0x0802 */
#define CFE_TEST_HK_TLM_MID CFE_PLATFORM_TLM_TOPICID_TO_MIDV(CFE_MISSION_TEST_HK_TLM_TOPICID) /* 0x0802 */

#endif
4 changes: 2 additions & 2 deletions modules/cfe_testcase/config/default_cfe_test_topicids.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
** \par Limits
** Not Applicable
*/
#define CFE_MISSION_TEST_CMD_MSG 2
#define CFE_MISSION_TEST_CMD_TOPICID 2

/**
** \cfemissioncfg cFE Portable Message Numbers for Telemetry
Expand All @@ -43,6 +43,6 @@
** \par Limits
** Not Applicable
*/
#define CFE_MISSION_TEST_HK_TLM_MSG 2
#define CFE_MISSION_TEST_HK_TLM_TOPICID 2

#endif
4 changes: 2 additions & 2 deletions modules/cfe_testcase/src/sb_sendrecv_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ typedef struct
typedef union
{
CFE_MSG_Message_t Hdr;
CFE_MSG_CommandHeader_t CmdHeader;
CFE_MSG_TelemetryHeader_t TlmHeader;
CFE_MSG_CommandHeader_t CommandHeader;
CFE_MSG_TelemetryHeader_t TelemetryHeader;
uint8 MaxSize[CFE_MISSION_SB_MAX_SB_MSG_SIZE + 16];
char StringBuffer[CFE_FT_STRINGBUF_SIZE];
} CFE_FT_TestBigMessage_t;
Expand Down
2 changes: 1 addition & 1 deletion modules/cfe_testcase/src/sb_subscription_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ void TestSBMaxSubscriptions(void)
while (NumSubs <= CFE_PLATFORM_SB_MAX_MSG_IDS)
{
/* fabricate a msgid to subscribe to (this may overlap real msgids) */
TestMsgId = CFE_SB_ValueToMsgId(CFE_PLATFORM_CMD_MID_BASE + NumSubs);
TestMsgId = CFE_SB_ValueToMsgId(1 + NumSubs);

Status = CFE_SB_Subscribe(TestMsgId, PipeId);
if (Status != CFE_SUCCESS)
Expand Down
Loading

0 comments on commit 70458a2

Please sign in to comment.