diff --git a/CHANGELOG.md b/CHANGELOG.md index b10271be5..7d447fb7c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## Development Build: equuleus-rc1+dev71 +- updating cFE to use new versioning system +- clean up and move table build scripts +- implement header files for testcase +- separate bad argument test +- See , , , and + ## Development Build: v7.0.0-rc4+dev434 - Update docs and UT to use CFE_MSG_PTR - document ES Perf enums diff --git a/cmake/arch_build.cmake b/cmake/arch_build.cmake index 640ef2f1b..e0bae5dde 100644 --- a/cmake/arch_build.cmake +++ b/cmake/arch_build.cmake @@ -190,8 +190,14 @@ endfunction(add_cfe_app_dependency) # of the target from targets.cmake and TABLE_FQNAME reflects the first # parameter to this function. # +# The table tool must provide an implementation to use with add_cfe_tables(). +# function(add_cfe_tables TABLE_FQNAME TBL_DEFAULT_SRC_FILES) + if (NOT TBL_DEFAULT_SRC_FILES) + message(FATAL_ERROR "Table source file list is empty") + endif() + get_filename_component(APP_NAME ${TABLE_FQNAME} NAME_WE) # The passed-in name allows for a qualifier (in the form of APP_NAME.QUALIFIER) to get @@ -213,23 +219,11 @@ function(add_cfe_tables TABLE_FQNAME TBL_DEFAULT_SRC_FILES) # If "TGTNAME" is set, then use it directly set(TABLE_TGTLIST ${TGTNAME}) - set(TABLE_TEMPLATE "${CFE_SOURCE_DIR}/cmake/tables/table_rule_template.d.in") - set(TABLE_CMD_BASIC_OPTS - -DTEMPLATE_FILE="${TABLE_TEMPLATE}" - -DAPP_NAME="${APP_NAME}" - ) - - if (INSTALL_SUBDIR) - list(APPEND TABLE_CMD_BASIC_OPTS - -DINSTALL_SUBDIR="${INSTALL_SUBDIR}" - ) - endif() if (TARGET ${APP_NAME}.table) if (NOT TABLE_TGTLIST) set (TABLE_TGTLIST ${TGTLIST_${APP_NAME}}) endif() - set(TABLE_PARENT_TGT ${APP_NAME}.table) else() # The first parameter should match the name of an app that was # previously defined using "add_cfe_app". If target-scope properties @@ -242,108 +236,21 @@ function(add_cfe_tables TABLE_FQNAME TBL_DEFAULT_SRC_FILES) if (NOT TABLE_TGTLIST) set (TABLE_TGTLIST ${APP_STATIC_TARGET_LIST} ${APP_DYNAMIC_TARGET_LIST}) endif() - # No (known) parent app, just use core_api in this case. It will only get global-scope includes and defines. - set(TABLE_PARENT_TGT core_api) endif() - set(TABLE_GENSCRIPT "${CFE_SOURCE_DIR}/cmake/tables/generate_elf_table_rules.cmake") - # The table source must be compiled using the same "include_directories" # as any other target, but it uses the "add_custom_command" so there is # no automatic way to do this (at least in the older cmakes) foreach(TGT ${TABLE_TGTLIST}) - set(TABLE_CMD_TGT_OPTS - -DTARGET_NAME="${TGT}" + do_add_cfe_tables_impl("${TABLE_FQNAME}" + APP_NAME "${APP_NAME}" + TARGET_NAME "${TGT}" + INSTALL_SUBDIR "${INSTALL_SUBDIR}" + ${TBL_DEFAULT_SRC_FILES} ${ARGN} ) - set(TABLE_LIBNAME "tblobj_${TGT}_${TABLE_FQNAME}") - list(APPEND TABLE_CMD_TGT_OPTS "-DARCHIVE_FILE=\"$\"") - - # Note that the TBL_DEFAULT_SRC_FILES is just a default - we now need - # to find the active source, which typically comes from the MISSION_DEFS dir. - # The TABLE_SELECTED_SRCS will become this list of active/selected source files - set(TABLE_SELECTED_SRCS) - foreach(TBL ${TBL_DEFAULT_SRC_FILES} ${ARGN}) - - # The file source basename (without directory or ext) should be the same as the table - # binary filename with a ".tbl" extension (this is the convention assumed by elf2cfetbl) - get_filename_component(TABLE_SRC_NEEDED ${TBL} NAME) - get_filename_component(TABLE_BASENAME ${TBL} NAME_WE) - - - # Check if an override exists at the mission level (recommended practice) - # This allows a mission to implement a customized table without modifying - # the original - this also makes for easier merging/updating if needed. - # Note this path list is in reverse-priority order, and only a single file - # will be end up being selected. - cfe_locate_implementation_file(TBL_SRC "${TABLE_SRC_NEEDED}" - OPTIONAL - FALLBACK_FILE "${CMAKE_CURRENT_SOURCE_DIR}/${TBL}" - PREFIX ${TGT} - SUBDIR tables - ) - - list(APPEND TABLE_SELECTED_SRCS ${TBL_SRC}) - - if (TBL_SRC) - message(STATUS "Using ${TBL_SRC} as table definition for ${TABLE_BASENAME} on ${TGT}") - else() - message(FATAL_ERROR "No table definition for ${APP_NAME}.${TABLE_BASENAME} on ${TGT} found") - endif() - - # Set a preprocessor macro so when the .c file is compiled it knows what its - # input and (by convention) output name is supposed to be. - if (TABLE_LIBNAME) - set_property(SOURCE "${TBL_SRC}" APPEND PROPERTY COMPILE_DEFINITIONS - CFE_TABLE_NAME=${TABLE_BASENAME} - ) - endif() - - # Note the table is not generated directly here, as it may require the native system compiler, so - # the call to the table tool (eds2cfetbl in this build) is deferred to the parent scope. Instead, this - # generates a file that captures the state (include dirs, source files, targets) for use in a future step. - set(TABLE_RULEFILE "${MISSION_BINARY_DIR}/tables/${TGT}_${TABLE_FQNAME}.${TABLE_BASENAME}.d") - add_custom_command( - OUTPUT "${TABLE_RULEFILE}" - COMMAND ${CMAKE_COMMAND} - ${TABLE_CMD_BASIC_OPTS} - ${TABLE_CMD_TGT_OPTS} - -DOUTPUT_FILE="${TABLE_RULEFILE}" - -DTABLE_NAME="${TABLE_BASENAME}" - -DSOURCES="${TBL_SRC}" - -DOBJEXT="${CMAKE_C_OUTPUT_EXTENSION}" - -P "${TABLE_GENSCRIPT}" - WORKING_DIRECTORY - ${WORKING_DIRECTORY} - DEPENDS - ${TABLE_TEMPLATE} - ${TABLE_GENSCRIPT} - ${TABLE_PARENT_TGT} - ) - - # Add a custom target to generate the config file - add_custom_target(generate_table_${TGT}_${APP_NAME}_${TABLE_BASENAME} - DEPENDS "${TABLE_RULEFILE}" ${TABLE_LIBNAME} - ) - add_dependencies(cfetables generate_table_${TGT}_${APP_NAME}_${TABLE_BASENAME}) - - endforeach() - - if (TABLE_LIBNAME) - # NOTE: On newer CMake versions this should become an OBJECT library which makes this simpler. - # On older versions one may not reference the TARGET_OBJECTS property from the custom command. - # As a workaround this is built into a static library, and then the desired object is extracted - # before passing to elf2cfetbl. It is roundabout but it works. - add_library(${TABLE_LIBNAME} STATIC EXCLUDE_FROM_ALL ${TABLE_SELECTED_SRCS}) - target_compile_definitions(${TABLE_LIBNAME} PRIVATE - CFE_CPU_NAME=${TGT} - ) - target_link_libraries(${TABLE_LIBNAME} ${TABLE_PARENT_TGT}) - endif() - - endforeach() - + endforeach(TGT ${TABLE_TGTLIST}) endfunction(add_cfe_tables) @@ -673,7 +580,6 @@ function(setup_platform_msgids) # 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}) @@ -695,6 +601,12 @@ function(prepare) # all generated table files will be added as dependencies to this target add_custom_target(cfetables) + # The table tool must provide an implementation to use with add_cfe_tables(). + # this is determined by the CFS_TABLETOOL_SCRIPT_DIR that must be exported + # from the parent build. + # + include(${CFS_TABLETOOL_SCRIPT_DIR}/add_cfe_tables_impl.cmake) + # Choose the configuration file to use for OSAL on this system set(OSAL_CONFIGURATION_FILE) foreach(CONFIG ${BUILD_CONFIG_${TARGETSYSTEM}} ${OSAL_SYSTEM_OSCONFIG}) diff --git a/cmake/generate_git_module_version.cmake b/cmake/generate_git_module_version.cmake index 7a2559324..c39335dcd 100644 --- a/cmake/generate_git_module_version.cmake +++ b/cmake/generate_git_module_version.cmake @@ -27,7 +27,11 @@ function(get_version DEP) endif() set(DIR ${${DEP}_MISSION_DIR}) endif() - message("inside get_version for ${DEP}") + + if ($ENV{VERBOSE}) + message("inside get_version for ${DEP}") + endif() + execute_process( COMMAND ${GIT_EXECUTABLE} describe --tags --always --dirty WORKING_DIRECTORY ${DIR} diff --git a/cmake/mission_build.cmake b/cmake/mission_build.cmake index 4664ee6a3..76adfe97c 100644 --- a/cmake/mission_build.cmake +++ b/cmake/mission_build.cmake @@ -233,6 +233,53 @@ function(setup_global_topicids) endfunction(setup_global_topicids) +################################################################## +# +# FUNCTION: export_variable_cache +# +# Export variables to a "mission_vars.cache" file so they can be +# referenced by the target-specific builds. This list is ingested +# during the startup phase of all the subordinate cmake invocations. +# +# The passed-in USER_VARLIST should be the names of additional variables +# to export. These can be cache vars or normal vars. +# +function(export_variable_cache USER_VARLIST) + + # The set of variables that should always be exported + set(FIXED_VARLIST + "MISSION_NAME" + "SIMULATION" + "MISSION_DEFS" + "MISSION_SOURCE_DIR" + "MISSION_BINARY_DIR" + "MISSIONCONFIG" + "MISSION_APPS" + "MISSION_PSPMODULES" + "MISSION_DEPS" + "MISSION_EDS_FILELIST" + "MISSION_EDS_SCRIPTLIST" + "ENABLE_UNIT_TESTS" + ) + + set(MISSION_VARCACHE) + foreach(VARL ${FIXED_VARLIST} ${USER_VARLIST} ${ARGN}) + # It is important to avoid putting any blank lines in the output, + # This will cause the reader to misinterpret the data + if (NOT "${${VARL}}" STREQUAL "") + string(APPEND MISSION_VARCACHE "${VARL}\n${${VARL}}\n") + endif (NOT "${${VARL}}" STREQUAL "") + endforeach() + + # Write the file -- the subprocess will read this file and re-create + # variables out of them. The alternative to this is to specify many "-D" + # parameters to the subordinate build but that would not scale well to many vars, + # and it would go through the shell meaning quoting/escaping for safety becomes + # very difficult. Using the file method avoids shell interpretation. + file(WRITE "${CMAKE_BINARY_DIR}/mission_vars.cache" "${MISSION_VARCACHE}") + +endfunction(export_variable_cache) + ################################################################## # # FUNCTION: prepare @@ -246,15 +293,16 @@ function(prepare) add_definitions(-DSIMULATION=${SIMULATION}) endif (SIMULATION) - # Prepare the table makefile - Ensure the list of tables is initially empty - file(MAKE_DIRECTORY "${MISSION_BINARY_DIR}/tables") - file(WRITE "${MISSION_BINARY_DIR}/tables/Makefile" - "MISSION_BINARY_DIR := ${MISSION_BINARY_DIR}\n" - "TABLE_BINARY_DIR := ${MISSION_BINARY_DIR}/tables\n" - "MISSION_SOURCE_DIR := ${MISSION_SOURCE_DIR}\n" - "MISSION_DEFS := ${MISSION_DEFS}\n\n" - "include \$(wildcard ${CFE_SOURCE_DIR}/cmake/tables/*.mk) \$(wildcard *.d)\n" - ) + # Create directories to hold generated files/wrappers + file(MAKE_DIRECTORY "${MISSION_BINARY_DIR}/eds") + file(MAKE_DIRECTORY "${MISSION_BINARY_DIR}/obj") + file(MAKE_DIRECTORY "${MISSION_BINARY_DIR}/inc") + file(MAKE_DIRECTORY "${MISSION_BINARY_DIR}/src") + + # Certain runtime variables need to be "exported" to the subordinate build, such as + # the specific arch settings and the location of all the apps. This list is collected + # during this function execution and exported at the end. + set(EXPORT_VARLIST) # Create custom targets for building and cleaning all architectures # This is required particularly for doing extra stuff in the clean step @@ -428,49 +476,20 @@ function(prepare) # msgid definitions, or any other configuration/preparation that needs to # happen at mission/global scope. foreach(DEP_NAME ${MISSION_DEPS}) + list(APPEND EXPORT_VARLIST "${DEP_NAME}_MISSION_DIR") include("${${DEP_NAME}_MISSION_DIR}/mission_build.cmake" OPTIONAL) endforeach(DEP_NAME ${MISSION_DEPS}) - # Certain runtime variables need to be "exported" to the subordinate build, such as - # the specific arch settings and the location of all the apps. This is done by creating - # a temporary file within the dir and then the subprocess will read that file and re-create - # variables out of them. The alternative to this is to specify many "-D" parameters to the - # subordinate build but that would not scale well to many vars. - set(VARLIST - "MISSION_NAME" - "SIMULATION" - "MISSION_DEFS" - "MISSION_SOURCE_DIR" - "MISSION_BINARY_DIR" - "MISSIONCONFIG" - "MISSION_APPS" - "MISSION_PSPMODULES" - "MISSION_DEPS" - "ENABLE_UNIT_TESTS" - ) - foreach(APP ${MISSION_DEPS}) - list(APPEND VARLIST "${APP}_MISSION_DIR") - endforeach() - foreach(SYSVAR ${TGTSYS_LIST}) - list(APPEND VARLIST "BUILD_CONFIG_${SYSVAR}") + list(APPEND EXPORT_VARLIST "BUILD_CONFIG_${SYSVAR}") endforeach(SYSVAR ${TGTSYS_LIST}) - set(MISSION_VARCACHE) - foreach(VARL ${VARLIST}) - # It is important to avoid putting any blank lines in the output, - # This will cause the reader to misinterpret the data - if (NOT "${${VARL}}" STREQUAL "") - set(MISSION_VARCACHE "${MISSION_VARCACHE}${VARL}\n${${VARL}}\n") - endif (NOT "${${VARL}}" STREQUAL "") - endforeach(VARL ${VARLIST}) - file(WRITE "${CMAKE_BINARY_DIR}/mission_vars.cache" "${MISSION_VARCACHE}") - generate_build_version_templates() # Generate the tools for the native (host) arch # Add all public include dirs for core components to include path for tools include_directories( + ${MISSION_BINARY_DIR}/inc ${core_api_MISSION_DIR}/fsw/inc ${osal_MISSION_DIR}/src/os/inc ${psp_MISSION_DIR}/fsw/inc @@ -478,26 +497,25 @@ function(prepare) add_subdirectory(${MISSION_SOURCE_DIR}/tools tools) # Add a dependency on the table generator tool as this is required for table builds - # The "elf2cfetbl" target should have been added by the "tools" above - add_dependencies(mission-prebuild elf2cfetbl) - set(TABLETOOL_EXEC $) - - add_custom_target(tabletool-execute - COMMAND $(MAKE) - CC="${CMAKE_C_COMPILER}" - CFLAGS="${CMAKE_C_FLAGS}" - AR="${CMAKE_AR}" - TBLTOOL="${TABLETOOL_EXEC}" - cfetables - WORKING_DIRECTORY - "${CMAKE_BINARY_DIR}/tables" - DEPENDS - mission-cfetables + # The table tool target should have been added by the "tools" above + if (NOT DEFINED CFS_TABLETOOL_SCRIPT_DIR) + message(FATAL_ERROR "Table Tool missing: CFS_TABLETOOL_SCRIPT_DIR must be defined by the tools") + endif() + list(APPEND EXPORT_VARLIST CFS_TABLETOOL_SCRIPT_DIR) + + # Prepare the table makefile - Ensure the list of tables is initially empty + file(REMOVE_RECURSE "${MISSION_BINARY_DIR}/tables") + file(MAKE_DIRECTORY "${MISSION_BINARY_DIR}/tables") + file(WRITE "${MISSION_BINARY_DIR}/tables/Makefile" + "MISSION_BINARY_DIR := ${MISSION_BINARY_DIR}\n" + "TABLE_BINARY_DIR := ${MISSION_BINARY_DIR}/tables\n" + "TABLETOOL_SCRIPT_DIR := ${CFS_TABLETOOL_SCRIPT_DIR}\n" + "MISSION_SOURCE_DIR := ${MISSION_SOURCE_DIR}\n" + "MISSION_DEFS := ${MISSION_DEFS}\n\n" + "include \$(wildcard $(TABLETOOL_SCRIPT_DIR)/*.mk) \$(wildcard *.d)\n" ) - add_dependencies(mission-all tabletool-execute) - add_dependencies(mission-install tabletool-execute) + add_dependencies(mission-cfetables mission-prebuild) - install(DIRECTORY ${CMAKE_BINARY_DIR}/tables/staging/ DESTINATION .) # Build version information should be generated as part of the pre-build process add_dependencies(mission-prebuild mission-version) @@ -507,6 +525,10 @@ function(prepare) install(DIRECTORY ${MISSION_DEFS}/functional-test/ DESTINATION ${FT_INSTALL_SUBDIR}) endif() + # Export the important state variables collected during this function. + # This is done last such that everything should have its correct value + export_variable_cache(${EXPORT_VARLIST}) + endfunction(prepare) ################################################################## diff --git a/cmake/sample_defs/eds/cfe-topicids.xml b/cmake/sample_defs/eds/cfe-topicids.xml new file mode 100644 index 000000000..b5da0e5ab --- /dev/null +++ b/cmake/sample_defs/eds/cfe-topicids.xml @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cmake/sample_defs/eds/config.xml b/cmake/sample_defs/eds/config.xml new file mode 100644 index 000000000..38d1efe21 --- /dev/null +++ b/cmake/sample_defs/eds/config.xml @@ -0,0 +1,561 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \cfeescfg Maximum Length of CDS Name + + \par Description: + Indicates the maximum length (in characters) of the CDS name ('CDSName') + portion of a Full CDS Name of the following form: + "ApplicationName.CDSName" + + This length does not need to include an extra character for NULL termination. + + \par Limits + This value should be kept as a multiple of 4, to maintain alignment of + any possible neighboring fields without implicit padding. + + + + + + \cfeevscfg Maximum Event Message Length + + \par Description: + Indicates the maximum length (in characters) of the formatted text + string portion of an event message + + This length does not need to include an extra character for NULL termination. + + \par Limits + Not Applicable + + + + + + \cfetblcfg Maximum Table Name Length + + \par Description: + Indicates the maximum length (in characers) of the table name + ('TblName') portion of a Full Table Name of the following + form: "ApplicationName.TblName" + + This length does not need to include an extra character for NULL termination. + + \par Limits + This value should be kept as a multiple of 4, to maintain alignment of + any possible neighboring fields without implicit padding. + + + + + + \cfeescfg Mission Max Apps in a message + + \par Description: + Indicates the maximum number of apps in a telemetry housekeeping message + + This affects the layout of command/telemetry messages but does not affect run + time behavior or internal allocation. + + \par Limits + All CPUs within the same SB domain (mission) must share the same definition + Note this affects the size of messages, so it must not cause any message + to exceed the max length. + + + + + + \cfeescfg Define Max Number of Performance IDs for messages + + \par Description: + Defines the maximum number of perf ids allowed in command/telemetry messages + + This affects the layout of command/telemetry messages but does not affect run + time behavior or internal allocation. + + \par Limits + All CPUs within the same SB domain (mission) must share the same definition + Note this affects the size of messages, so it must not cause any message + to exceed the max length. + + + + + + \cfeescfg Maximum number of block sizes in pool structures + + \par Description: + The upper limit for the number of block sizes supported in the generic + pool implementation, which in turn implements the memory pools and CDS. + This definition is used as the array size with the pool stats structure, + and therefore should be consistent across all CPUs in a mission, as well + as with the ground station. + + There is also a platform-specific limit which may be fewer than this + value. + + \par Limits: + Must be at least one. No specific upper limit, but the number is + anticipated to be reasonably small (i.e. tens, not hundreds). Large + values have not been tested. + + + + + + \cfetblcfg Maximum Length of Full Table Name in messages + + \par Description: + Indicates the maximum length (in characters) of the entire table name + within software bus messages, in "AppName.TableName" notation. + + This affects the layout of command/telemetry messages but does not affect run + time behavior or internal allocation. + + \par Limits + All CPUs within the same SB domain (mission) must share the same definition + Note this affects the size of messages, so it must not cause any message + to exceed the max length. + + This value should be kept as a multiple of 4, to maintain alignment of + any possible neighboring fields without implicit padding. + + + + + + \cfesbcfg Maximum Number of pipes that SB command/telemetry messages may hold + + \par Description: + Dictates the maximum number of unique Pipes the SB message defintions will hold. + + This affects the layout of command/telemetry messages but does not affect run + time behavior or internal allocation. + + \par Limits + All CPUs within the same SB domain (mission) must share the same definition + Note this affects the size of messages, so it must not cause any message + to exceed the max length. + + + + + + \cfemissioncfg cFE Maximum length for pathnames within data exchange structures + + \par Description: + The value of this constant dictates the size of pathnames within all structures + used for external data exchange, such as Software bus messages and table definitions. + This is typically the same as OS_MAX_PATH_LEN but that is OSAL dependent -- + and as such it definable on a per-processor/OS basis and hence may be different + across multiple processors. It is recommended to set this to the value of the + largest OS_MAX_PATH_LEN in use on any CPU on the mission. + + This affects only the layout of command/telemetry messages and table definitions; + internal allocation may use the platform-specific OS_MAX_PATH_LEN value. + + This length must include an extra character for NULL termination. + + \par Limits + All CPUs within the same SB domain (mission) and ground tools must share the + same definition. + Note this affects the size of messages, so it must not cause any message + to exceed the max length. + + This value should be kept as a multiple of 4, to maintain alignment of + any possible neighboring fields without implicit padding. + + + + + + \cfesbcfg Maximum SB Message Size + + \par Description: + The following definition dictates the maximum message size allowed on + the software bus. SB checks the pkt length field in the header of all + messages sent. If the pkt length field indicates the message is larger + than this define, SB sends an event and rejects the send. + + \par Limits + This parameter has a lower limit of 6 (CCSDS primary header size). There + are no restrictions on the upper limit however, the maximum message size is + system dependent and should be verified. Total message size values that are + checked against this configuration are defined by a 16 bit data word. + + + + + + + \cfetimecfg Default Time Format + + \par Description: + The following definitions select either UTC or TAI as the default + (mission specific) time format. Although it is possible for an + application to request time in a specific format, most callers + should use CFE_TIME_GetTime(), which returns time in the default + format. This avoids having to modify each individual caller + when the default choice is changed. + + \par Limits + if CFE_MISSION_TIME_CFG_DEFAULT_TAI is defined as true then CFE_MISSION_TIME_CFG_DEFAULT_UTC must be + defined as false. + if CFE_MISSION_TIME_CFG_DEFAULT_TAI is defined as false then CFE_MISSION_TIME_CFG_DEFAULT_UTC must be + defined as true. + + + + + + + + \cfetimecfg Default Time Format + + \par Description: + The following definition enables the use of a simulated time at + the tone signal using a software bus message. + + \par Limits + Not Applicable + + + + + + + \cfetimecfg Default Time and Tone Order + + \par Description: + Time Services may be configured to expect the time at the tone + data packet to either precede or follow the tone signal. If the + time at the tone data packet follows the tone signal, then the + data within the packet describes what the time "was" at the tone. + If the time at the tone data packet precedes the tone signal, then + the data within the packet describes what the time "will be" at + the tone. One, and only one, of the following symbols must be set to true: + + - CFE_MISSION_TIME_AT_TONE_WAS + - CFE_MISSION_TIME_AT_TONE_WILL_BE + + Note: If Time Services is defined as using a simulated tone signal + (see #CFE_MISSION_TIME_CFG_FAKE_TONE above), then the tone data packet + must follow the tone signal. + + \par Limits + Either CFE_MISSION_TIME_AT_TONE_WAS or CFE_MISSION_TIME_AT_TONE_WILL_BE must be set to true. + They may not both be true and they may not both be false. + + + + + + + + \cfetimecfg Min and Max Time Elapsed + + \par Description: + Based on the definition of Time and Tone Order + (CFE_MISSION_TIME_AT_TONE_WAS/WILL_BE) either the "time at the tone" signal or + data packet will follow the other. This definition sets the valid window + of time for the second of the pair to lag behind the first. Time + Services will invalidate both the tone and packet if the second does not + arrive within this window following the first. + + For example, if the data packet follows the tone, it might be valid for + the data packet to arrive between zero and 100,000 micro-seconds after + the tone. But, if the tone follows the packet, it might be valid + only if the packet arrived between 200,000 and 700,000 micro-seconds + before the tone. + + Note: units are in micro-seconds + + \par Limits + 0 to 999,999 decimal + + + + + + + + \cfetimecfg Default Time Values + + \par Description: + Default time values are provided to avoid problems due to time + calculations performed after startup but before commands can be + processed. For example, if the default time format is UTC then + it is important that the sum of MET and STCF always exceed the + value of Leap Seconds to prevent the UTC time calculation + + (time = MET + STCF - Leap Seconds) from resulting in a negative + (very large) number. + + Some past missions have also created known (albeit wrong) default + timestamps. For example, assume the epoch is defined as Jan 1, 1970 + and further assume the default time values are set to create a timestamp + of Jan 1, 2000. Even though the year 2000 timestamps are wrong, it + may be of value to keep the time within some sort of bounds acceptable + to the software. + + Note: Sub-second units are in micro-seconds (0 to 999,999) and + all values must be defined + + \par Limits + Not Applicable + + + + + + + + + + + + + + + + \cfetimecfg Default EPOCH Values + + \par Description: + Default ground time epoch values + Note: these values are used only by the CFE_TIME_Print() API function + + \par Limits + Year - must be within 136 years + Day - Jan 1 = 1, Feb 1 = 32, etc. + Hour - 0 to 23 + Minute - 0 to 59 + Second - 0 to 59 + Micros - 0 to 999999 + + + + + + + + + + + \cfetimecfg Time File System Factor + + \par Description: + Define the s/c vs file system time conversion constant... + + Note: this value is intended for use only by CFE TIME API functions to + convert time values based on the ground system epoch (s/c time) to + and from time values based on the file system epoch (fs time). + + FS time = S/C time + factor + S/C time = FS time - factor + + Worksheet: + + S/C epoch = Jan 1, 2005 (LRO ground system epoch) + FS epoch = Jan 1, 1980 (vxWorks DOS file system epoch) + + Delta = 25 years, 0 days, 0 hours, 0 minutes, 0 seconds + + Leap years = 1980, 1984, 1988, 1992, 1996, 2000, 2004 + (divisible by 4 -- except if by 100 -- unless also by 400) + + 1 year = 31,536,000 seconds + 1 day = 86,400 seconds + 1 hour = 3,600 seconds + 1 minute = 60 seconds + + 25 years = 788,400,000 seconds + 7 extra leap days = 604,800 seconds + + total delta = 789,004,800 seconds + + \par Limits + Not Applicable + + + + + + \cfeescfg Mission Default CRC algorithm + + \par Description: + Indicates the which CRC algorithm should be used as the default + for verifying the contents of Critical Data Stores and when calculating + Table Image data integrity values. + + \par Limits + Currently only CFE_MISSION_ES_CRC_16 is supported (see #CFE_MISSION_ES_CRC_16) + + + + + + + \cfemissioncfg cFE Maximum length for filenames within data exchange structures + + \par Description: + The value of this constant dictates the size of filenames within all structures + used for external data exchange, such as Software bus messages and table definitions. + This is typically the same as OS_MAX_FILE_LEN but that is OSAL dependent -- + and as such it definable on a per-processor/OS basis and hence may be different + across multiple processors. It is recommended to set this to the value of the + largest OS_MAX_FILE_LEN in use on any CPU on the mission. + + This affects only the layout of command/telemetry messages and table definitions; + internal allocation may use the platform-specific OS_MAX_FILE_LEN value. + + This length must include an extra character for NULL termination. + + \par Limits + All CPUs within the same SB domain (mission) and ground tools must share the + same definition. + Note this affects the size of messages, so it must not cause any message + to exceed the max length. + + This value should be kept as a multiple of 4, to maintain alignment of + any possible neighboring fields without implicit padding. + + + + + + \cfemissioncfg cFE Maximum length for API names within data exchange structures + + \par Description: + The value of this constant dictates the size of filenames within all structures + used for external data exchange, such as Software bus messages and table definitions. + This is typically the same as OS_MAX_API_LEN but that is OSAL dependent -- + and as such it definable on a per-processor/OS basis and hence may be different + across multiple processors. It is recommended to set this to the value of the + largest OS_MAX_API_LEN in use on any CPU on the mission. + + This affects only the layout of command/telemetry messages and table definitions; + internal allocation may use the platform-specific OS_MAX_API_LEN value. + + This length must include an extra character for NULL termination. + + \par Limits + All CPUs within the same SB domain (mission) must share the same definition + Note this affects the size of messages, so it must not cause any message + to exceed the max length. + + This value should be kept as a multiple of 4, to maintain alignment of + any possible neighboring fields without implicit padding. + + + + + + \cfeescfg Maximum Length of Full CDS Name in messages + + \par Description: + Indicates the maximum length (in characters) of the entire CDS name + of the following form: "ApplicationName.CDSName" + + This affects the layout of command/telemetry messages but does not affect run + time behavior or internal allocation. + + \par Limits + All CPUs within the same SB domain (mission) must share the same definition + Note this affects the size of messages, so it must not cause any message + to exceed the max length. + + This value should be kept as a multiple of 4, to maintain alignment of + any possible neighboring fields without implicit padding. + + + + + + diff --git a/cmake/tables/elf2cfetbl_rules.mk b/cmake/tables/elf2cfetbl_rules.mk deleted file mode 100644 index c17443579..000000000 --- a/cmake/tables/elf2cfetbl_rules.mk +++ /dev/null @@ -1,10 +0,0 @@ -# Rule for traditional CFE table generation via elf2cfetbl - -# The dependency of this target should always be an absolute pathname to -# the intermediate library file as it is generated by a CMake script via -# the TARGET_FILE property. Therefore, the same path should still work -# after the "cd" command. The "cd" is so the ar tool writes the object file -# into a separate dir, in case of similarly-named files on different cpus. -elf/%: - @mkdir -pv "$(dir $(@))" - cd "$(dir $(@))" && $(AR) x "$(<)" "$(notdir $(@))" diff --git a/cmake/tables/generate_elf_table_rules.cmake b/cmake/tables/generate_elf_table_rules.cmake deleted file mode 100644 index 12da18bc7..000000000 --- a/cmake/tables/generate_elf_table_rules.cmake +++ /dev/null @@ -1,34 +0,0 @@ -################################################################## -# -# Sub-script to capture the table compile/generation environment -# -# This small script runs at build time (as opposed to prep time) -# which captures a set of environment metadata -# -# It must be done this way such that generator expressions will -# be evaluated now, during the arch build process, rather than -# deferring the evaluation to the parent build where they may -# have different values. -# -################################################################## - -set(STAGING_DIR staging ${TARGET_NAME} ${INSTALL_SUBDIR}) -string(REPLACE ";" "/" STAGING_DIR "${STAGING_DIR}") - -set(TABLE_BINARY "${STAGING_DIR}/${TABLE_NAME}.tbl") -set(TMP_DIR "elf/${TARGET_NAME}") -set(TABLE_RULES) - -foreach(TBL_SRC ${SOURCES}) - - get_filename_component(DEP_FILE ${TBL_SRC} NAME) - set(DEP_FILE "${TMP_DIR}/${DEP_FILE}${OBJEXT}") - string(APPEND TABLE_RULES - "${DEP_FILE}: ${ARCHIVE_FILE}\n" - "${TABLE_BINARY}: ${DEP_FILE}\n" - "\n" - ) - -endforeach() - -configure_file(${TEMPLATE_FILE} ${OUTPUT_FILE}) diff --git a/cmake/tables/table_rule_template.d.in b/cmake/tables/table_rule_template.d.in deleted file mode 100644 index 4fa664818..000000000 --- a/cmake/tables/table_rule_template.d.in +++ /dev/null @@ -1,10 +0,0 @@ -# Template for table configuration - -cfetables: ${TABLE_BINARY} - -${TABLE_BINARY}: CFE_TABLE_CPUNAME := ${TARGET_NAME} -${TABLE_BINARY}: CFE_TABLE_APPNAME := ${APP_NAME} -${TABLE_BINARY}: CFE_TABLE_BASENAME := ${TABLE_NAME} - -# Rules to build ${TABLE_BINARY} -${TABLE_RULES} diff --git a/cmake/tables/tabletool_rule.mk b/cmake/tables/tabletool_rule.mk deleted file mode 100644 index 6b34c7561..000000000 --- a/cmake/tables/tabletool_rule.mk +++ /dev/null @@ -1,15 +0,0 @@ -# Makefile for EDS-based CFE table generation -.PHONY: cfetables - -cfetables: - @echo "Table build completed" - -# The dependency of this rule should always be a relative path starting with elf/, -# at least with the current rule generator script, so it matches the elf/% pattern rule. -# But because elf2cfetbl only writes its output to the current working dir, it has to be run -# after changing dirs into the staging area. Thus the path to the elf file needs to be adjusted. -# Ideally this chould be done with the $(abspath f...) function but this doesn't exist in older versions. -# As a workaround, $CURDIR is used. -staging/%.tbl: - @mkdir -pv "$(dir $(@))" - cd "$(dir $(@))" && $(TBLTOOL) $(TBLTOOL_FLAGS) "$(CURDIR)/$(<)" diff --git a/modules/cfe_testcase/arch_build.cmake b/modules/cfe_testcase/arch_build.cmake index b04904ed0..f223914b5 100644 --- a/modules/cfe_testcase/arch_build.cmake +++ b/modules/cfe_testcase/arch_build.cmake @@ -18,13 +18,13 @@ set(TEST_PLATFORM_CONFIG_FILE_LIST # the distribution default copies foreach(TEST_CFGFILE ${TEST_PLATFORM_CONFIG_FILE_LIST}) get_filename_component(CFGKEY "${TEST_CFGFILE}" NAME_WE) - if (DEFINED TEST_CFGFILE_SRC_${CFGKEY}) - set(DEFAULT_SOURCE "${TEST_CFGFILE_SRC_${CFGKEY}}") + if (DEFINED TESTCASE_CFGFILE_SRC_${CFGKEY}) + set(DEFAULT_SOURCE GENERATED_FILE "${TESTCASE_CFGFILE_SRC_${CFGKEY}}") else() - set(DEFAULT_SOURCE "${CMAKE_CURRENT_LIST_DIR}/config/default_${TEST_CFGFILE}") + set(DEFAULT_SOURCE FALLBACK_FILE "${CMAKE_CURRENT_LIST_DIR}/config/default_${TEST_CFGFILE}") endif() generate_config_includefile( FILE_NAME "${TEST_CFGFILE}" - FALLBACK_FILE ${DEFAULT_SOURCE} + ${DEFAULT_SOURCE} ) endforeach() diff --git a/modules/cfe_testcase/config/default_cfe_test_msg.h b/modules/cfe_testcase/config/default_cfe_test_msg.h new file mode 100644 index 000000000..1059d0cad --- /dev/null +++ b/modules/cfe_testcase/config/default_cfe_test_msg.h @@ -0,0 +1,29 @@ +/************************************************************************ + * 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 + * CFE Test app (CFE_TEST) Application Message Definitions + */ +#ifndef CFE_TEST_MSG_H +#define CFE_TEST_MSG_H + +#include "cfe_test_msgdefs.h" +#include "cfe_test_msgstruct.h" + +#endif diff --git a/modules/cfe_testcase/config/default_cfe_testcase_msgids.h b/modules/cfe_testcase/config/default_cfe_test_msgdefs.h similarity index 69% rename from modules/cfe_testcase/config/default_cfe_testcase_msgids.h rename to modules/cfe_testcase/config/default_cfe_test_msgdefs.h index a4b41aa30..9c3ffc770 100644 --- a/modules/cfe_testcase/config/default_cfe_testcase_msgids.h +++ b/modules/cfe_testcase/config/default_cfe_test_msgdefs.h @@ -18,22 +18,23 @@ /** * @file - * CFE Test app (CFE_TEST) Application Message IDs + * CFE Test app (CFE_TEST) Application Message Definitions */ -#ifndef CFE_TEST_MSGIDS_H -#define CFE_TEST_MSGIDS_H +#ifndef CFE_TEST_MSGDEFS_H +#define CFE_TEST_MSGDEFS_H -#include "cfe_core_api_base_msgids.h" -#include "cfe_test_topicids.h" +#include "common_types.h" -/* -** cFE Command Message Id's -*/ -#define CFE_TEST_CMD_MID CFE_PLATFORM_CMD_MID_BASE + CFE_MISSION_TEST_CMD_MSG /* 0x1802 */ +/* A 64-bit payload (worst case for alignment) */ +typedef struct CFE_TEST_TestPayload64 +{ + uint64 Value; +} CFE_TEST_TestPayload64_t; -/* -** CFE Telemetry Message Id's -*/ -#define CFE_TEST_HK_TLM_MID CFE_PLATFORM_TLM_MID_BASE + CFE_MISSION_TEST_HK_TLM_MSG /* 0x0802 */ +/* A 32-bit payload (most common case for alignment) */ +typedef struct CFE_TEST_TestPayload32 +{ + uint32 Value; +} CFE_TEST_TestPayload32_t; #endif diff --git a/modules/cfe_testcase/config/default_cfe_test_msgstruct.h b/modules/cfe_testcase/config/default_cfe_test_msgstruct.h new file mode 100644 index 000000000..5ee7954a1 --- /dev/null +++ b/modules/cfe_testcase/config/default_cfe_test_msgstruct.h @@ -0,0 +1,57 @@ +/************************************************************************ + * 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 + * CFE Test app (CFE_TEST) Application Message Definitions + */ +#ifndef CFE_TEST_MSGSTRUCT_H +#define CFE_TEST_MSGSTRUCT_H + +#include "cfe_msg_hdr.h" +#include "cfe_test_msgdefs.h" + +/* A simple command message with a 64 bit payload */ +typedef struct CFE_TEST_TestCmdMessage +{ + CFE_MSG_CommandHeader_t CommandHeader; + CFE_TEST_TestPayload64_t Payload; +} CFE_TEST_TestCmdMessage64_t; + +/* A simple telemetry message with a 64 bit payload */ +typedef struct CFE_TEST_TestTlmMessage +{ + CFE_MSG_TelemetryHeader_t TelemetryHeader; + CFE_TEST_TestPayload64_t Payload; +} CFE_TEST_TestTlmMessage64_t; + +/* A simple command message with a 32 bit payload */ +typedef struct +{ + CFE_MSG_CommandHeader_t CommandHeader; + CFE_TEST_TestPayload32_t Payload; +} CFE_TEST_TestCmdMessage32_t; + +/* A simple telemetry message with a 32 bit payload */ +typedef struct +{ + CFE_MSG_TelemetryHeader_t TelemetryHeader; + CFE_TEST_TestPayload32_t Payload; +} CFE_TEST_TestTlmMessage32_t; + +#endif diff --git a/modules/cfe_testcase/config/default_cfe_test_tbl.h b/modules/cfe_testcase/config/default_cfe_test_tbl.h index 5deeeeeec..c5fb7a60e 100644 --- a/modules/cfe_testcase/config/default_cfe_test_tbl.h +++ b/modules/cfe_testcase/config/default_cfe_test_tbl.h @@ -25,13 +25,6 @@ #ifndef CFE_TEST_TBL_H #define CFE_TEST_TBL_H -/* - * Test table structure - */ -typedef struct -{ - uint16 Int1; - uint16 Int2; -} TBL_TEST_Table_t; +#include "cfe_test_tblstruct.h" #endif /* CFE_TEST_TBL_H */ diff --git a/modules/cfe_testcase/config/default_cfe_test_tblstruct.h b/modules/cfe_testcase/config/default_cfe_test_tblstruct.h new file mode 100644 index 000000000..22fd62773 --- /dev/null +++ b/modules/cfe_testcase/config/default_cfe_test_tblstruct.h @@ -0,0 +1,39 @@ +/************************************************************************ + * 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 + * + * CFE Test Table struct definition + */ + +#ifndef CFE_TEST_TBLSTRUCT_H +#define CFE_TEST_TBLSTRUCT_H + +#include "common_types.h" + +/* + * Test table structure + */ +typedef struct +{ + uint16 Int1; + uint16 Int2; +} CFE_TEST_TestTable_t; + +#endif /* CFE_TEST_TBLSTRUCT_H */ diff --git a/modules/cfe_testcase/mission_build.cmake b/modules/cfe_testcase/mission_build.cmake index fd1df0bc0..779c1919c 100644 --- a/modules/cfe_testcase/mission_build.cmake +++ b/modules/cfe_testcase/mission_build.cmake @@ -9,18 +9,30 @@ ########################################################### # The list of header files that control the TEST configuration -set(TEST_MISSION_CONFIG_FILE_LIST +set(TESTCASE_MISSION_CONFIG_FILE_LIST + cfe_test_msg.h + cfe_test_msgdefs.h + cfe_test_msgstruct.h cfe_test_tbl.h + cfe_test_tblstruct.h cfe_test_topicids.h ) +if (CFE_EDS_ENABLED_BUILD) + + # In an EDS-based build, these files come generated from the EDS tool + set(TESTCASE_CFGFILE_SRC_cfe_test_topicids "cfe_mission_eds_designparameters.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(TEST_CFGFILE ${TEST_MISSION_CONFIG_FILE_LIST}) +foreach(TEST_CFGFILE ${TESTCASE_MISSION_CONFIG_FILE_LIST}) get_filename_component(CFGKEY "${TEST_CFGFILE}" NAME_WE) - if (DEFINED TEST_CFGFILE_SRC_${CFGKEY}) - set(DEFAULT_SOURCE GENERATED_FILE "${TEST_CFGFILE_SRC_${CFGKEY}}") + if (DEFINED TESTCASE_CFGFILE_SRC_${CFGKEY}) + set(DEFAULT_SOURCE GENERATED_FILE "${TESTCASE_CFGFILE_SRC_${CFGKEY}}") else() set(DEFAULT_SOURCE FALLBACK_FILE "${CMAKE_CURRENT_LIST_DIR}/config/default_${TEST_CFGFILE}") endif() diff --git a/modules/cfe_testcase/src/cfe_test_table.c b/modules/cfe_testcase/src/cfe_test_table.c index b4841152d..312ef9cfd 100644 --- a/modules/cfe_testcase/src/cfe_test_table.c +++ b/modules/cfe_testcase/src/cfe_test_table.c @@ -32,7 +32,7 @@ /* Setup function to register a table */ void RegisterTestTable(void) { - UtAssert_INT32_EQ(CFE_TBL_Register(&CFE_FT_Global.TblHandle, CFE_FT_Global.TblName, sizeof(TBL_TEST_Table_t), + UtAssert_INT32_EQ(CFE_TBL_Register(&CFE_FT_Global.TblHandle, CFE_FT_Global.TblName, sizeof(CFE_TEST_TestTable_t), CFE_TBL_OPT_DEFAULT, NULL), CFE_SUCCESS); } diff --git a/modules/cfe_testcase/src/msg_api_test.c b/modules/cfe_testcase/src/msg_api_test.c index 623e60973..5eaa91599 100644 --- a/modules/cfe_testcase/src/msg_api_test.c +++ b/modules/cfe_testcase/src/msg_api_test.c @@ -26,6 +26,7 @@ */ #include "cfe_test.h" +#include "cfe_test_msgids.h" #include void TestMsgApiBasic(void) @@ -46,10 +47,11 @@ void TestMsgApiBasic(void) bool _returned = false; memset(&cmd, 0xFF, sizeof(cmd)); - msgId = CFE_SB_ValueToMsgId(1); + msgId = CFE_SB_ValueToMsgId(CFE_TEST_CMD_MID); /* test msg-init */ - UtAssert_INT32_EQ(CFE_MSG_Init(NULL, CFE_SB_INVALID_MSG_ID, sizeof(cmd)), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_MSG_Init(NULL, msgId, sizeof(cmd)), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_MSG_Init(CFE_MSG_PTR(cmd), CFE_SB_INVALID_MSG_ID, sizeof(cmd)), CFE_MSG_BAD_ARGUMENT); UtAssert_INT32_EQ(CFE_MSG_Init(CFE_MSG_PTR(cmd), msgId, 0), CFE_MSG_BAD_ARGUMENT); UtAssert_INT32_EQ( CFE_MSG_Init(CFE_MSG_PTR(cmd), CFE_SB_ValueToMsgId(CFE_PLATFORM_SB_HIGHEST_VALID_MSGID + 1), sizeof(cmd)), @@ -135,7 +137,7 @@ void TestMsgApiAdvanced(void) CFE_MSG_SequenceCount_t seqCnt; memset(&cmd, 0xFF, sizeof(cmd)); - msgId = CFE_SB_INVALID_MSG_ID; + msgId = CFE_SB_ValueToMsgId(CFE_TEST_CMD_MID); UtAssert_INT32_EQ(CFE_MSG_Init(CFE_MSG_PTR(cmd), msgId, sizeof(cmd)), CFE_SUCCESS); diff --git a/modules/cfe_testcase/src/sb_performance_test.c b/modules/cfe_testcase/src/sb_performance_test.c index c24e9f61d..fc3135543 100644 --- a/modules/cfe_testcase/src/sb_performance_test.c +++ b/modules/cfe_testcase/src/sb_performance_test.c @@ -32,24 +32,11 @@ #include "cfe_test.h" #include "cfe_msgids.h" #include "cfe_test_msgids.h" +#include "cfe_test_msg.h" /* Number of messages to send during test */ uint32_t UT_BulkTestDuration = 1000; -/* A simple command message */ -typedef struct -{ - CFE_MSG_CommandHeader_t CommandHeader; - uint32 CmdPayload; -} CFE_FT_TestCmdMessage_t; - -/* A simple telemetry message */ -typedef struct -{ - CFE_MSG_TelemetryHeader_t TelemetryHeader; - uint32 TlmPayload; -} CFE_FT_TestTlmMessage_t; - /* State structure for multicore test - shared between threads */ typedef struct UT_BulkMultiCoreSharedState { @@ -74,23 +61,23 @@ UT_BulkMultiCoreSharedState_t BulkTlm; * This test procedure should be agnostic to specific MID values, but it should * not overlap/interfere with real MIDs used by other apps. */ -static const CFE_SB_MsgId_t CFE_FT_CMD_MSGID = CFE_SB_MSGID_WRAP_VALUE(CFE_TEST_CMD_MID); -static const CFE_SB_MsgId_t CFE_FT_TLM_MSGID = CFE_SB_MSGID_WRAP_VALUE(CFE_TEST_HK_TLM_MID); +static CFE_SB_MsgId_t CFE_FT_CMD_MSGID; +static CFE_SB_MsgId_t CFE_FT_TLM_MSGID; void TestBulkTransferSingle(void) { - CFE_SB_PipeId_t PipeId1 = CFE_SB_INVALID_PIPE; - CFE_SB_PipeId_t PipeId2 = CFE_SB_INVALID_PIPE; - CFE_FT_TestCmdMessage_t CmdMsg; - CFE_FT_TestTlmMessage_t TlmMsg; - CFE_SB_Buffer_t * MsgBuf; - const CFE_FT_TestCmdMessage_t *CmdPtr; - const CFE_FT_TestTlmMessage_t *TlmPtr; - uint32 SendCount; - OS_time_t StartTime; - OS_time_t ElapsedTime; - int64 AvgRate; - uint32_t PrintMask; + CFE_SB_PipeId_t PipeId1 = CFE_SB_INVALID_PIPE; + CFE_SB_PipeId_t PipeId2 = CFE_SB_INVALID_PIPE; + CFE_TEST_TestCmdMessage32_t CmdMsg; + CFE_TEST_TestTlmMessage32_t TlmMsg; + CFE_SB_Buffer_t * MsgBuf; + const CFE_TEST_TestCmdMessage32_t *CmdPtr; + const CFE_TEST_TestTlmMessage32_t *TlmPtr; + uint32 SendCount; + OS_time_t StartTime; + OS_time_t ElapsedTime; + int64 AvgRate; + uint32_t PrintMask; memset(&CmdMsg, 0, sizeof(CmdMsg)); memset(&TlmMsg, 0, sizeof(TlmMsg)); @@ -118,8 +105,8 @@ void TestBulkTransferSingle(void) for (SendCount = 0; SendCount < UT_BulkTestDuration; ++SendCount) { - CmdMsg.CmdPayload = SendCount; - TlmMsg.TlmPayload = ~SendCount; + CmdMsg.Payload.Value = SendCount; + TlmMsg.Payload.Value = ~SendCount; /* In order to not "flood" with test results, this should be silent unless a failure occurs */ CFE_Assert_STATUS_STORE(CFE_SB_TransmitMsg(CFE_MSG_PTR(CmdMsg.CommandHeader), true)); @@ -142,9 +129,9 @@ void TestBulkTransferSingle(void) /* As above, to avoid flooding of test cases, only report mismatch here */ CmdPtr = (const void *)MsgBuf; - if (CmdPtr->CmdPayload != CmdMsg.CmdPayload) + if (CmdPtr->Payload.Value != CmdMsg.Payload.Value) { - UtAssert_UINT32_EQ(CmdPtr->CmdPayload, CmdMsg.CmdPayload); + UtAssert_UINT32_EQ(CmdPtr->Payload.Value, CmdMsg.Payload.Value); break; } @@ -155,9 +142,9 @@ void TestBulkTransferSingle(void) } TlmPtr = (const void *)MsgBuf; - if (TlmPtr->TlmPayload != TlmMsg.TlmPayload) + if (TlmPtr->Payload.Value != TlmMsg.Payload.Value) { - UtAssert_UINT32_EQ(TlmPtr->TlmPayload, TlmMsg.TlmPayload); + UtAssert_UINT32_EQ(TlmPtr->Payload.Value, TlmMsg.Payload.Value); break; } @@ -186,9 +173,9 @@ void TestBulkTransferSingle(void) void RunSingleCmdSendRecv(void) { - CFE_FT_TestCmdMessage_t CmdMsg; - CFE_SB_Buffer_t * MsgBuf; - const CFE_FT_TestCmdMessage_t *CmdPtr; + CFE_TEST_TestCmdMessage32_t CmdMsg; + CFE_SB_Buffer_t * MsgBuf; + const CFE_TEST_TestCmdMessage32_t *CmdPtr; UtAssert_INT32_EQ(CFE_MSG_Init(CFE_MSG_PTR(CmdMsg.CommandHeader), CFE_FT_CMD_MSGID, sizeof(CmdMsg)), CFE_SUCCESS); @@ -196,7 +183,7 @@ void RunSingleCmdSendRecv(void) while (BulkCmd.SendCount < UT_BulkTestDuration) { - CmdMsg.CmdPayload = BulkCmd.SendCount; + CmdMsg.Payload.Value = BulkCmd.SendCount; /* In order to not "flood" with test results, this should be silent unless a failure occurs */ CFE_Assert_STATUS_STORE(CFE_SB_TransmitMsg(CFE_MSG_PTR(CmdMsg.CommandHeader), true)); @@ -217,9 +204,9 @@ void RunSingleCmdSendRecv(void) /* As above, to avoid flooding of test cases, only report mismatch here */ CmdPtr = (const void *)MsgBuf; - if (CmdPtr->CmdPayload != CmdMsg.CmdPayload) + if (CmdPtr->Payload.Value != CmdMsg.Payload.Value) { - UtAssert_UINT32_EQ(CmdPtr->CmdPayload, CmdMsg.CmdPayload); + UtAssert_UINT32_EQ(CmdPtr->Payload.Value, CmdMsg.Payload.Value); break; } } @@ -232,9 +219,9 @@ void RunSingleCmdSendRecv(void) void RunSingleTlmSendRecv(void) { - CFE_FT_TestTlmMessage_t TlmMsg; - CFE_SB_Buffer_t * MsgBuf; - const CFE_FT_TestTlmMessage_t *TlmPtr; + CFE_TEST_TestTlmMessage32_t TlmMsg; + CFE_SB_Buffer_t * MsgBuf; + const CFE_TEST_TestTlmMessage32_t *TlmPtr; UtAssert_INT32_EQ(CFE_MSG_Init(CFE_MSG_PTR(TlmMsg.TelemetryHeader), CFE_FT_TLM_MSGID, sizeof(TlmMsg)), CFE_SUCCESS); @@ -242,7 +229,7 @@ void RunSingleTlmSendRecv(void) while (BulkTlm.SendCount < UT_BulkTestDuration) { - TlmMsg.TlmPayload = BulkTlm.SendCount; + TlmMsg.Payload.Value = BulkTlm.SendCount; /* In order to not "flood" with test results, this should be silent unless a failure occurs */ CFE_Assert_STATUS_STORE(CFE_SB_TransmitMsg(CFE_MSG_PTR(TlmMsg.TelemetryHeader), true)); @@ -263,9 +250,9 @@ void RunSingleTlmSendRecv(void) /* As above, to avoid flooding of test cases, only report mismatch here */ TlmPtr = (const void *)MsgBuf; - if (TlmPtr->TlmPayload != TlmMsg.TlmPayload) + if (TlmPtr->Payload.Value != TlmMsg.Payload.Value) { - UtAssert_UINT32_EQ(TlmPtr->TlmPayload, TlmMsg.TlmPayload); + UtAssert_UINT32_EQ(TlmPtr->Payload.Value, TlmMsg.Payload.Value); break; } } @@ -372,8 +359,8 @@ void TestBulkTransferMulti2(void) void UT_CommandTransmitterTask(void) { - CFE_SB_Buffer_t * BufPtr; - CFE_FT_TestCmdMessage_t *CmdMsgPtr; + CFE_SB_Buffer_t * BufPtr; + CFE_TEST_TestCmdMessage32_t *CmdMsgPtr; CFE_PSP_GetTime(&BulkCmd.StartTime); @@ -386,14 +373,14 @@ void UT_CommandTransmitterTask(void) break; } - BufPtr = CFE_SB_AllocateMessageBuffer(sizeof(CFE_FT_TestCmdMessage_t)); + BufPtr = CFE_SB_AllocateMessageBuffer(sizeof(CFE_TEST_TestCmdMessage32_t)); CmdMsgPtr = (void *)&BufPtr->Msg; /* Initialize the message content */ CFE_MSG_Init(CFE_MSG_PTR(CmdMsgPtr->CommandHeader), CFE_FT_CMD_MSGID, sizeof(*CmdMsgPtr)); - CmdMsgPtr->CmdPayload = BulkCmd.SendCount; + CmdMsgPtr->Payload.Value = BulkCmd.SendCount; CFE_Assert_STATUS_STORE(CFE_SB_TransmitBuffer(BufPtr, true)); if (!CFE_Assert_STATUS_SILENTCHECK(CFE_SUCCESS)) @@ -408,8 +395,8 @@ void UT_CommandTransmitterTask(void) void UT_TelemtryTransmitterTask(void) { - CFE_SB_Buffer_t * BufPtr; - CFE_FT_TestTlmMessage_t *TlmMsgPtr; + CFE_SB_Buffer_t * BufPtr; + CFE_TEST_TestTlmMessage32_t *TlmMsgPtr; CFE_PSP_GetTime(&BulkTlm.StartTime); @@ -422,14 +409,14 @@ void UT_TelemtryTransmitterTask(void) break; } - BufPtr = CFE_SB_AllocateMessageBuffer(sizeof(CFE_FT_TestTlmMessage_t)); + BufPtr = CFE_SB_AllocateMessageBuffer(sizeof(CFE_TEST_TestTlmMessage32_t)); TlmMsgPtr = (void *)&BufPtr->Msg; /* Initialize the message content */ CFE_MSG_Init(CFE_MSG_PTR(TlmMsgPtr->TelemetryHeader), CFE_FT_TLM_MSGID, sizeof(*TlmMsgPtr)); - TlmMsgPtr->TlmPayload = BulkTlm.SendCount; + TlmMsgPtr->Payload.Value = BulkTlm.SendCount; CFE_Assert_STATUS_STORE(CFE_SB_TransmitBuffer(BufPtr, true)); if (!CFE_Assert_STATUS_SILENTCHECK(CFE_SUCCESS)) @@ -444,8 +431,8 @@ void UT_TelemtryTransmitterTask(void) void UT_CommandReceiverTask(void) { - CFE_SB_Buffer_t * MsgBuf; - const CFE_FT_TestCmdMessage_t *CmdPtr; + CFE_SB_Buffer_t * MsgBuf; + const CFE_TEST_TestCmdMessage32_t *CmdPtr; for (BulkCmd.RecvCount = 0; BulkCmd.RecvCount < UT_BulkTestDuration; ++BulkCmd.RecvCount) { @@ -458,9 +445,9 @@ void UT_CommandReceiverTask(void) /* As above, to avoid flooding of test cases, only report mismatch here */ CmdPtr = (const void *)MsgBuf; - if (CmdPtr->CmdPayload != BulkCmd.RecvCount) + if (CmdPtr->Payload.Value != BulkCmd.RecvCount) { - UtAssert_UINT32_EQ(CmdPtr->CmdPayload, BulkCmd.RecvCount); + UtAssert_UINT32_EQ(CmdPtr->Payload.Value, BulkCmd.RecvCount); break; } @@ -478,8 +465,8 @@ void UT_CommandReceiverTask(void) void UT_TelemetryReceiverTask(void) { - CFE_SB_Buffer_t * MsgBuf; - const CFE_FT_TestTlmMessage_t *TlmPtr; + CFE_SB_Buffer_t * MsgBuf; + const CFE_TEST_TestTlmMessage32_t *TlmPtr; for (BulkTlm.RecvCount = 0; BulkTlm.RecvCount < UT_BulkTestDuration; ++BulkTlm.RecvCount) { @@ -492,9 +479,9 @@ void UT_TelemetryReceiverTask(void) /* As above, to avoid flooding of test cases, only report mismatch here */ TlmPtr = (const void *)MsgBuf; - if (TlmPtr->TlmPayload != BulkTlm.RecvCount) + if (TlmPtr->Payload.Value != BulkTlm.RecvCount) { - UtAssert_UINT32_EQ(TlmPtr->TlmPayload, BulkTlm.RecvCount); + UtAssert_UINT32_EQ(TlmPtr->Payload.Value, BulkTlm.RecvCount); break; } @@ -615,6 +602,13 @@ void SBPerformanceTestSetup(void) UtAssert_MIR("Configured to execute %lu message transfers", (unsigned long)UT_BulkTestDuration); + /* + * This test procedure should be agnostic to specific MID values, but it should + * not overlap/interfere with real MIDs used by other apps. + */ + CFE_FT_CMD_MSGID = CFE_SB_ValueToMsgId(CFE_TEST_CMD_MID); + CFE_FT_TLM_MSGID = CFE_SB_ValueToMsgId(CFE_TEST_HK_TLM_MID); + UtTest_Add(TestBulkTransferSingle, NULL, NULL, "Single Thread Bulk Transfer"); UtTest_Add(TestBulkTransferMulti2, NULL, NULL, "2 Thread Bulk Transfer"); UtTest_Add(TestBulkTransferMulti4, NULL, NULL, "4 Thread Bulk Transfer"); diff --git a/modules/cfe_testcase/src/sb_sendrecv_test.c b/modules/cfe_testcase/src/sb_sendrecv_test.c index c404a0abb..846f9bb86 100644 --- a/modules/cfe_testcase/src/sb_sendrecv_test.c +++ b/modules/cfe_testcase/src/sb_sendrecv_test.c @@ -30,23 +30,10 @@ #include "cfe_test.h" #include "cfe_msgids.h" #include "cfe_test_msgids.h" +#include "cfe_test_msg.h" #define CFE_FT_STRINGBUF_SIZE 12 -/* A simple command message */ -typedef struct -{ - CFE_MSG_CommandHeader_t CommandHeader; - uint64 CmdPayload; -} CFE_FT_TestCmdMessage_t; - -/* A simple telemetry message */ -typedef struct -{ - CFE_MSG_TelemetryHeader_t TelemetryHeader; - uint64 TlmPayload; -} CFE_FT_TestTlmMessage_t; - /* A message intended to be (overall) larger than the CFE_MISSION_SB_MAX_SB_MSG_SIZE */ typedef union { @@ -61,22 +48,22 @@ typedef union * This test procedure should be agnostic to specific MID values, but it should * not overlap/interfere with real MIDs used by other apps. */ -static const CFE_SB_MsgId_t CFE_FT_CMD_MSGID = CFE_SB_MSGID_WRAP_VALUE(CFE_TEST_CMD_MID); -static const CFE_SB_MsgId_t CFE_FT_TLM_MSGID = CFE_SB_MSGID_WRAP_VALUE(CFE_TEST_HK_TLM_MID); +static CFE_SB_MsgId_t CFE_FT_CMD_MSGID; +static CFE_SB_MsgId_t CFE_FT_TLM_MSGID; static CFE_FT_TestBigMessage_t CFE_FT_BigMsg; void TestBasicTransmitRecv(void) { - CFE_SB_PipeId_t PipeId1 = CFE_SB_INVALID_PIPE; - CFE_SB_PipeId_t PipeId2 = CFE_SB_INVALID_PIPE; - CFE_FT_TestCmdMessage_t CmdMsg; - CFE_FT_TestTlmMessage_t TlmMsg; - CFE_SB_MsgId_t MsgId; - CFE_MSG_SequenceCount_t Seq1, Seq2; - CFE_SB_Buffer_t * MsgBuf; - const CFE_FT_TestCmdMessage_t *CmdPtr; - const CFE_FT_TestTlmMessage_t *TlmPtr; + CFE_SB_PipeId_t PipeId1 = CFE_SB_INVALID_PIPE; + CFE_SB_PipeId_t PipeId2 = CFE_SB_INVALID_PIPE; + CFE_TEST_TestCmdMessage64_t CmdMsg; + CFE_TEST_TestTlmMessage64_t TlmMsg; + CFE_SB_MsgId_t MsgId; + CFE_MSG_SequenceCount_t Seq1, Seq2; + CFE_SB_Buffer_t * MsgBuf; + const CFE_TEST_TestCmdMessage64_t *CmdPtr; + const CFE_TEST_TestTlmMessage64_t *TlmPtr; memset(&CmdMsg, 0, sizeof(CmdMsg)); memset(&TlmMsg, 0, sizeof(TlmMsg)); @@ -97,25 +84,25 @@ void TestBasicTransmitRecv(void) CFE_MSG_SetSequenceCount(CFE_MSG_PTR(TlmMsg.TelemetryHeader), 21); /* Sending with sequence update should ignore the sequence in the msg struct */ - CmdMsg.CmdPayload = 0x0c0ffee; - TlmMsg.TlmPayload = 0x0d00d1e; + CmdMsg.Payload.Value = 0x0c0ffee; + TlmMsg.Payload.Value = 0x0d00d1e; UtAssert_INT32_EQ(CFE_SB_TransmitMsg(CFE_MSG_PTR(CmdMsg.CommandHeader), true), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_SB_TransmitMsg(CFE_MSG_PTR(TlmMsg.TelemetryHeader), true), CFE_SUCCESS); - CmdMsg.CmdPayload = 0x1c0ffee; - TlmMsg.TlmPayload = 0x1d00d1e; + CmdMsg.Payload.Value = 0x1c0ffee; + TlmMsg.Payload.Value = 0x1d00d1e; UtAssert_INT32_EQ(CFE_SB_TransmitMsg(CFE_MSG_PTR(CmdMsg.CommandHeader), true), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_SB_TransmitMsg(CFE_MSG_PTR(TlmMsg.TelemetryHeader), true), CFE_SUCCESS); /* Sending without sequence update should use the sequence in the msg struct */ - CmdMsg.CmdPayload = 0x2c0ffee; - TlmMsg.TlmPayload = 0x2d00d1e; + CmdMsg.Payload.Value = 0x2c0ffee; + TlmMsg.Payload.Value = 0x2d00d1e; UtAssert_INT32_EQ(CFE_SB_TransmitMsg(CFE_MSG_PTR(CmdMsg.CommandHeader), false), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_SB_TransmitMsg(CFE_MSG_PTR(TlmMsg.TelemetryHeader), false), CFE_SUCCESS); /* Sending again should trigger MsgLimit errors on the pipe, however the call still returns CFE_SUCCESS */ - CmdMsg.CmdPayload = 0x3c0ffee; - TlmMsg.TlmPayload = 0x3d00d1e; + CmdMsg.Payload.Value = 0x3c0ffee; + TlmMsg.Payload.Value = 0x3d00d1e; UtAssert_INT32_EQ(CFE_SB_TransmitMsg(CFE_MSG_PTR(CmdMsg.CommandHeader), true), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_SB_TransmitMsg(CFE_MSG_PTR(TlmMsg.TelemetryHeader), true), CFE_SUCCESS); @@ -156,24 +143,24 @@ void TestBasicTransmitRecv(void) UtAssert_INT32_EQ(CFE_MSG_GetMsgId(&MsgBuf->Msg, &MsgId), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_MSG_GetSequenceCount(&MsgBuf->Msg, &Seq1), CFE_SUCCESS); CFE_Assert_MSGID_EQ(MsgId, CFE_FT_CMD_MSGID); - CmdPtr = (const CFE_FT_TestCmdMessage_t *)MsgBuf; - UtAssert_UINT32_EQ(CmdPtr->CmdPayload, 0x0c0ffee); + CmdPtr = (const CFE_TEST_TestCmdMessage64_t *)MsgBuf; + UtAssert_UINT32_EQ(CmdPtr->Payload.Value, 0x0c0ffee); UtAssert_UINT32_EQ(Seq1, 1); UtAssert_INT32_EQ(CFE_SB_ReceiveBuffer(&MsgBuf, PipeId1, CFE_SB_PEND_FOREVER), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_MSG_GetMsgId(&MsgBuf->Msg, &MsgId), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_MSG_GetSequenceCount(&MsgBuf->Msg, &Seq1), CFE_SUCCESS); CFE_Assert_MSGID_EQ(MsgId, CFE_FT_CMD_MSGID); - CmdPtr = (const CFE_FT_TestCmdMessage_t *)MsgBuf; - UtAssert_UINT32_EQ(CmdPtr->CmdPayload, 0x1c0ffee); + CmdPtr = (const CFE_TEST_TestCmdMessage64_t *)MsgBuf; + UtAssert_UINT32_EQ(CmdPtr->Payload.Value, 0x1c0ffee); UtAssert_UINT32_EQ(Seq1, 2); UtAssert_INT32_EQ(CFE_SB_ReceiveBuffer(&MsgBuf, PipeId1, CFE_SB_PEND_FOREVER), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_MSG_GetMsgId(&MsgBuf->Msg, &MsgId), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_MSG_GetSequenceCount(&MsgBuf->Msg, &Seq1), CFE_SUCCESS); CFE_Assert_MSGID_EQ(MsgId, CFE_FT_CMD_MSGID); - CmdPtr = (const CFE_FT_TestCmdMessage_t *)MsgBuf; - UtAssert_UINT32_EQ(CmdPtr->CmdPayload, 0x2c0ffee); + CmdPtr = (const CFE_TEST_TestCmdMessage64_t *)MsgBuf; + UtAssert_UINT32_EQ(CmdPtr->Payload.Value, 0x2c0ffee); UtAssert_UINT32_EQ(Seq1, 11); /* Final should not be in the pipe, should have been rejected due to MsgLim */ @@ -188,23 +175,23 @@ void TestBasicTransmitRecv(void) UtAssert_INT32_EQ(CFE_MSG_GetMsgId(&MsgBuf->Msg, &MsgId), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_MSG_GetSequenceCount(&MsgBuf->Msg, &Seq1), CFE_SUCCESS); CFE_Assert_MSGID_EQ(MsgId, CFE_FT_TLM_MSGID); - TlmPtr = (const CFE_FT_TestTlmMessage_t *)MsgBuf; - UtAssert_UINT32_EQ(TlmPtr->TlmPayload, 0x0d00d1e); + TlmPtr = (const CFE_TEST_TestTlmMessage64_t *)MsgBuf; + UtAssert_UINT32_EQ(TlmPtr->Payload.Value, 0x0d00d1e); UtAssert_INT32_EQ(CFE_SB_ReceiveBuffer(&MsgBuf, PipeId2, 100), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_MSG_GetMsgId(&MsgBuf->Msg, &MsgId), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_MSG_GetSequenceCount(&MsgBuf->Msg, &Seq2), CFE_SUCCESS); CFE_Assert_MSGID_EQ(MsgId, CFE_FT_TLM_MSGID); - TlmPtr = (const CFE_FT_TestTlmMessage_t *)MsgBuf; - UtAssert_UINT32_EQ(TlmPtr->TlmPayload, 0x1d00d1e); + TlmPtr = (const CFE_TEST_TestTlmMessage64_t *)MsgBuf; + UtAssert_UINT32_EQ(TlmPtr->Payload.Value, 0x1d00d1e); UtAssert_UINT32_EQ(Seq2, CFE_MSG_GetNextSequenceCount(Seq1)); UtAssert_INT32_EQ(CFE_SB_ReceiveBuffer(&MsgBuf, PipeId2, 100), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_MSG_GetMsgId(&MsgBuf->Msg, &MsgId), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_MSG_GetSequenceCount(&MsgBuf->Msg, &Seq2), CFE_SUCCESS); CFE_Assert_MSGID_EQ(MsgId, CFE_FT_TLM_MSGID); - TlmPtr = (const CFE_FT_TestTlmMessage_t *)MsgBuf; - UtAssert_UINT32_EQ(TlmPtr->TlmPayload, 0x2d00d1e); + TlmPtr = (const CFE_TEST_TestTlmMessage64_t *)MsgBuf; + UtAssert_UINT32_EQ(TlmPtr->Payload.Value, 0x2d00d1e); UtAssert_UINT32_EQ(Seq2, 21); /* Final should not be in the pipe, should have been rejected due to MsgLim */ @@ -223,17 +210,17 @@ void TestBasicTransmitRecv(void) */ void TestMsgBroadcast(void) { - CFE_SB_PipeId_t PipeId1 = CFE_SB_INVALID_PIPE; - CFE_SB_PipeId_t PipeId2 = CFE_SB_INVALID_PIPE; - CFE_SB_PipeId_t PipeId3 = CFE_SB_INVALID_PIPE; - CFE_SB_PipeId_t PipeId4 = CFE_SB_INVALID_PIPE; - CFE_FT_TestCmdMessage_t CmdMsg; - CFE_SB_MsgId_t MsgId = CFE_SB_INVALID_MSG_ID; - CFE_SB_Buffer_t * MsgBuf1; - CFE_SB_Buffer_t * MsgBuf2; - CFE_SB_Buffer_t * MsgBuf3; - CFE_SB_Buffer_t * MsgBuf4; - const CFE_FT_TestCmdMessage_t *CmdPtr; + CFE_SB_PipeId_t PipeId1 = CFE_SB_INVALID_PIPE; + CFE_SB_PipeId_t PipeId2 = CFE_SB_INVALID_PIPE; + CFE_SB_PipeId_t PipeId3 = CFE_SB_INVALID_PIPE; + CFE_SB_PipeId_t PipeId4 = CFE_SB_INVALID_PIPE; + CFE_TEST_TestCmdMessage64_t CmdMsg; + CFE_SB_MsgId_t MsgId = CFE_SB_INVALID_MSG_ID; + CFE_SB_Buffer_t * MsgBuf1; + CFE_SB_Buffer_t * MsgBuf2; + CFE_SB_Buffer_t * MsgBuf3; + CFE_SB_Buffer_t * MsgBuf4; + const CFE_TEST_TestCmdMessage64_t *CmdPtr; memset(&CmdMsg, 0, sizeof(CmdMsg)); @@ -253,13 +240,13 @@ void TestMsgBroadcast(void) UtAssert_INT32_EQ(CFE_MSG_Init(CFE_MSG_PTR(CmdMsg.CommandHeader), CFE_FT_CMD_MSGID, sizeof(CmdMsg)), CFE_SUCCESS); /* Make unique content in each message. Sending should always be successful. */ - CmdMsg.CmdPayload = 0xbabb1e00; + CmdMsg.Payload.Value = 0xbabb1e00; UtAssert_INT32_EQ(CFE_SB_TransmitMsg(CFE_MSG_PTR(CmdMsg.CommandHeader), true), CFE_SUCCESS); - CmdMsg.CmdPayload = 0xbabb1e01; + CmdMsg.Payload.Value = 0xbabb1e01; UtAssert_INT32_EQ(CFE_SB_TransmitMsg(CFE_MSG_PTR(CmdMsg.CommandHeader), true), CFE_SUCCESS); - CmdMsg.CmdPayload = 0xbabb1e02; + CmdMsg.Payload.Value = 0xbabb1e02; UtAssert_INT32_EQ(CFE_SB_TransmitMsg(CFE_MSG_PTR(CmdMsg.CommandHeader), true), CFE_SUCCESS); - CmdMsg.CmdPayload = 0xbabb1e03; + CmdMsg.Payload.Value = 0xbabb1e03; UtAssert_INT32_EQ(CFE_SB_TransmitMsg(CFE_MSG_PTR(CmdMsg.CommandHeader), true), CFE_SUCCESS); /* Now receive 1st message from Pipes, actual msg should appear on all (no limit violations here) */ @@ -276,8 +263,8 @@ void TestMsgBroadcast(void) /* Confirm content */ UtAssert_INT32_EQ(CFE_MSG_GetMsgId(&MsgBuf1->Msg, &MsgId), CFE_SUCCESS); CFE_Assert_MSGID_EQ(MsgId, CFE_FT_CMD_MSGID); - CmdPtr = (const CFE_FT_TestCmdMessage_t *)MsgBuf1; - UtAssert_UINT32_EQ(CmdPtr->CmdPayload, 0xbabb1e00); + CmdPtr = (const CFE_TEST_TestCmdMessage64_t *)MsgBuf1; + UtAssert_UINT32_EQ(CmdPtr->Payload.Value, 0xbabb1e00); /* Now receive 2nd message from Pipes, should not appear on PipeId 1 due to MsgLimit */ UtAssert_INT32_EQ(CFE_SB_ReceiveBuffer(&MsgBuf1, PipeId1, CFE_SB_POLL), CFE_SB_NO_MESSAGE); @@ -292,8 +279,8 @@ void TestMsgBroadcast(void) /* Confirm content */ UtAssert_INT32_EQ(CFE_MSG_GetMsgId(&MsgBuf2->Msg, &MsgId), CFE_SUCCESS); CFE_Assert_MSGID_EQ(MsgId, CFE_FT_CMD_MSGID); - CmdPtr = (const CFE_FT_TestCmdMessage_t *)MsgBuf2; - UtAssert_UINT32_EQ(CmdPtr->CmdPayload, 0xbabb1e01); + CmdPtr = (const CFE_TEST_TestCmdMessage64_t *)MsgBuf2; + UtAssert_UINT32_EQ(CmdPtr->Payload.Value, 0xbabb1e01); /* Now receive 3rd message from Pipes, should not appear on PipeId 1 or 2 due to MsgLimit */ UtAssert_INT32_EQ(CFE_SB_ReceiveBuffer(&MsgBuf1, PipeId1, CFE_SB_POLL), CFE_SB_NO_MESSAGE); @@ -307,8 +294,8 @@ void TestMsgBroadcast(void) /* Confirm content */ UtAssert_INT32_EQ(CFE_MSG_GetMsgId(&MsgBuf3->Msg, &MsgId), CFE_SUCCESS); CFE_Assert_MSGID_EQ(MsgId, CFE_FT_CMD_MSGID); - CmdPtr = (const CFE_FT_TestCmdMessage_t *)MsgBuf3; - UtAssert_UINT32_EQ(CmdPtr->CmdPayload, 0xbabb1e02); + CmdPtr = (const CFE_TEST_TestCmdMessage64_t *)MsgBuf3; + UtAssert_UINT32_EQ(CmdPtr->Payload.Value, 0xbabb1e02); /* Now receive 4th message from Pipes, should only appear on PipeId4 due PipeDepth limit on 3 */ UtAssert_INT32_EQ(CFE_SB_ReceiveBuffer(&MsgBuf1, PipeId1, CFE_SB_POLL), CFE_SB_NO_MESSAGE); @@ -319,8 +306,8 @@ void TestMsgBroadcast(void) /* Confirm content */ UtAssert_INT32_EQ(CFE_MSG_GetMsgId(&MsgBuf4->Msg, &MsgId), CFE_SUCCESS); CFE_Assert_MSGID_EQ(MsgId, CFE_FT_CMD_MSGID); - CmdPtr = (const CFE_FT_TestCmdMessage_t *)MsgBuf4; - UtAssert_UINT32_EQ(CmdPtr->CmdPayload, 0xbabb1e03); + CmdPtr = (const CFE_TEST_TestCmdMessage64_t *)MsgBuf4; + UtAssert_UINT32_EQ(CmdPtr->Payload.Value, 0xbabb1e03); UtPrintf("Testing: Unsubscribe single pipe"); @@ -328,9 +315,9 @@ void TestMsgBroadcast(void) UtAssert_INT32_EQ(CFE_SB_Unsubscribe(CFE_FT_CMD_MSGID, PipeId2), CFE_SUCCESS); /* Send two more messages */ - CmdMsg.CmdPayload = 0xbabb1e04; + CmdMsg.Payload.Value = 0xbabb1e04; UtAssert_INT32_EQ(CFE_SB_TransmitMsg(CFE_MSG_PTR(CmdMsg.CommandHeader), true), CFE_SUCCESS); - CmdMsg.CmdPayload = 0xbabb1e05; + CmdMsg.Payload.Value = 0xbabb1e05; UtAssert_INT32_EQ(CFE_SB_TransmitMsg(CFE_MSG_PTR(CmdMsg.CommandHeader), true), CFE_SUCCESS); /* poll all pipes again, message should appear on all except PipeId2 (Unsubscribed) */ @@ -346,8 +333,8 @@ void TestMsgBroadcast(void) /* Confirm content */ UtAssert_INT32_EQ(CFE_MSG_GetMsgId(&MsgBuf1->Msg, &MsgId), CFE_SUCCESS); CFE_Assert_MSGID_EQ(MsgId, CFE_FT_CMD_MSGID); - CmdPtr = (const CFE_FT_TestCmdMessage_t *)MsgBuf1; - UtAssert_UINT32_EQ(CmdPtr->CmdPayload, 0xbabb1e04); + CmdPtr = (const CFE_TEST_TestCmdMessage64_t *)MsgBuf1; + UtAssert_UINT32_EQ(CmdPtr->Payload.Value, 0xbabb1e04); /* poll all pipes again, message should appear on all except PipeId1 (MsgLim) or PipeId2 (Unsubscribed) */ UtAssert_INT32_EQ(CFE_SB_ReceiveBuffer(&MsgBuf1, PipeId1, CFE_SB_POLL), CFE_SB_NO_MESSAGE); @@ -361,8 +348,8 @@ void TestMsgBroadcast(void) /* Confirm content */ UtAssert_INT32_EQ(CFE_MSG_GetMsgId(&MsgBuf3->Msg, &MsgId), CFE_SUCCESS); CFE_Assert_MSGID_EQ(MsgId, CFE_FT_CMD_MSGID); - CmdPtr = (const CFE_FT_TestCmdMessage_t *)MsgBuf3; - UtAssert_UINT32_EQ(CmdPtr->CmdPayload, 0xbabb1e05); + CmdPtr = (const CFE_TEST_TestCmdMessage64_t *)MsgBuf3; + UtAssert_UINT32_EQ(CmdPtr->Payload.Value, 0xbabb1e05); /* poll all pipes again, all should be empty now */ UtAssert_INT32_EQ(CFE_SB_ReceiveBuffer(&MsgBuf1, PipeId1, CFE_SB_POLL), CFE_SB_NO_MESSAGE); @@ -403,8 +390,8 @@ void TestZeroCopyTransmitRecv(void) UtAssert_NULL(CFE_SB_AllocateMessageBuffer(CFE_MISSION_SB_MAX_SB_MSG_SIZE + 1)); /* Nominal */ - UtAssert_NOT_NULL(CmdBuf = CFE_SB_AllocateMessageBuffer(sizeof(CFE_FT_TestCmdMessage_t))); - UtAssert_NOT_NULL(TlmBuf = CFE_SB_AllocateMessageBuffer(sizeof(CFE_FT_TestTlmMessage_t))); + UtAssert_NOT_NULL(CmdBuf = CFE_SB_AllocateMessageBuffer(sizeof(CFE_TEST_TestCmdMessage64_t))); + UtAssert_NOT_NULL(TlmBuf = CFE_SB_AllocateMessageBuffer(sizeof(CFE_TEST_TestTlmMessage64_t))); UtPrintf("Testing: CFE_SB_ReleaseMessageBuffer"); @@ -421,8 +408,8 @@ void TestZeroCopyTransmitRecv(void) UtPrintf("Testing: CFE_SB_TransmitBuffer"); /* Initialize the message content */ - UtAssert_INT32_EQ(CFE_MSG_Init(&CmdBuf->Msg, CFE_FT_CMD_MSGID, sizeof(CFE_FT_TestCmdMessage_t)), CFE_SUCCESS); - UtAssert_INT32_EQ(CFE_MSG_Init(&TlmBuf->Msg, CFE_FT_TLM_MSGID, sizeof(CFE_FT_TestTlmMessage_t)), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_MSG_Init(&CmdBuf->Msg, CFE_FT_CMD_MSGID, sizeof(CFE_TEST_TestCmdMessage64_t)), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_MSG_Init(&TlmBuf->Msg, CFE_FT_TLM_MSGID, sizeof(CFE_TEST_TestTlmMessage64_t)), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_SB_TransmitBuffer(CmdBuf, true), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_SB_TransmitBuffer(TlmBuf, true), CFE_SUCCESS); @@ -469,10 +456,10 @@ void TestZeroCopyTransmitRecv(void) UtPrintf("Testing: CFE_SB_TransmitBuffer sequence number updates"); /* Send a set of messages with and without sequence number update flag */ - UtAssert_NOT_NULL(CmdBuf = CFE_SB_AllocateMessageBuffer(sizeof(CFE_FT_TestCmdMessage_t))); - UtAssert_NOT_NULL(TlmBuf = CFE_SB_AllocateMessageBuffer(sizeof(CFE_FT_TestTlmMessage_t))); - UtAssert_INT32_EQ(CFE_MSG_Init(&CmdBuf->Msg, CFE_FT_CMD_MSGID, sizeof(CFE_FT_TestCmdMessage_t)), CFE_SUCCESS); - UtAssert_INT32_EQ(CFE_MSG_Init(&TlmBuf->Msg, CFE_FT_TLM_MSGID, sizeof(CFE_FT_TestTlmMessage_t)), CFE_SUCCESS); + UtAssert_NOT_NULL(CmdBuf = CFE_SB_AllocateMessageBuffer(sizeof(CFE_TEST_TestCmdMessage64_t))); + UtAssert_NOT_NULL(TlmBuf = CFE_SB_AllocateMessageBuffer(sizeof(CFE_TEST_TestTlmMessage64_t))); + UtAssert_INT32_EQ(CFE_MSG_Init(&CmdBuf->Msg, CFE_FT_CMD_MSGID, sizeof(CFE_TEST_TestCmdMessage64_t)), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_MSG_Init(&TlmBuf->Msg, CFE_FT_TLM_MSGID, sizeof(CFE_TEST_TestTlmMessage64_t)), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_MSG_SetSequenceCount(&CmdBuf->Msg, 1234), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_MSG_SetSequenceCount(&TlmBuf->Msg, 5678), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_SB_TransmitBuffer(CmdBuf, true), CFE_SUCCESS); @@ -486,10 +473,10 @@ void TestZeroCopyTransmitRecv(void) UtAssert_INT32_EQ(CFE_MSG_GetSequenceCount(&MsgBuf->Msg, &SeqTlm1), CFE_SUCCESS); /* Send a second message also with increment = true and confirm value */ - UtAssert_NOT_NULL(CmdBuf = CFE_SB_AllocateMessageBuffer(sizeof(CFE_FT_TestCmdMessage_t))); - UtAssert_NOT_NULL(TlmBuf = CFE_SB_AllocateMessageBuffer(sizeof(CFE_FT_TestTlmMessage_t))); - UtAssert_INT32_EQ(CFE_MSG_Init(&CmdBuf->Msg, CFE_FT_CMD_MSGID, sizeof(CFE_FT_TestCmdMessage_t)), CFE_SUCCESS); - UtAssert_INT32_EQ(CFE_MSG_Init(&TlmBuf->Msg, CFE_FT_TLM_MSGID, sizeof(CFE_FT_TestTlmMessage_t)), CFE_SUCCESS); + UtAssert_NOT_NULL(CmdBuf = CFE_SB_AllocateMessageBuffer(sizeof(CFE_TEST_TestCmdMessage64_t))); + UtAssert_NOT_NULL(TlmBuf = CFE_SB_AllocateMessageBuffer(sizeof(CFE_TEST_TestTlmMessage64_t))); + UtAssert_INT32_EQ(CFE_MSG_Init(&CmdBuf->Msg, CFE_FT_CMD_MSGID, sizeof(CFE_TEST_TestCmdMessage64_t)), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_MSG_Init(&TlmBuf->Msg, CFE_FT_TLM_MSGID, sizeof(CFE_TEST_TestTlmMessage64_t)), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_MSG_SetSequenceCount(&CmdBuf->Msg, 1234), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_MSG_SetSequenceCount(&TlmBuf->Msg, 5678), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_SB_TransmitBuffer(CmdBuf, true), CFE_SUCCESS); @@ -504,10 +491,10 @@ void TestZeroCopyTransmitRecv(void) UtAssert_UINT32_EQ(SeqTlm2, CFE_MSG_GetNextSequenceCount(SeqTlm1)); /* should be +1 from the previous */ /* Send a third message also with increment = false and confirm value */ - UtAssert_NOT_NULL(CmdBuf = CFE_SB_AllocateMessageBuffer(sizeof(CFE_FT_TestCmdMessage_t))); - UtAssert_NOT_NULL(TlmBuf = CFE_SB_AllocateMessageBuffer(sizeof(CFE_FT_TestTlmMessage_t))); - UtAssert_INT32_EQ(CFE_MSG_Init(&CmdBuf->Msg, CFE_FT_CMD_MSGID, sizeof(CFE_FT_TestCmdMessage_t)), CFE_SUCCESS); - UtAssert_INT32_EQ(CFE_MSG_Init(&TlmBuf->Msg, CFE_FT_TLM_MSGID, sizeof(CFE_FT_TestTlmMessage_t)), CFE_SUCCESS); + UtAssert_NOT_NULL(CmdBuf = CFE_SB_AllocateMessageBuffer(sizeof(CFE_TEST_TestCmdMessage64_t))); + UtAssert_NOT_NULL(TlmBuf = CFE_SB_AllocateMessageBuffer(sizeof(CFE_TEST_TestTlmMessage64_t))); + UtAssert_INT32_EQ(CFE_MSG_Init(&CmdBuf->Msg, CFE_FT_CMD_MSGID, sizeof(CFE_TEST_TestCmdMessage64_t)), CFE_SUCCESS); + UtAssert_INT32_EQ(CFE_MSG_Init(&TlmBuf->Msg, CFE_FT_TLM_MSGID, sizeof(CFE_TEST_TestTlmMessage64_t)), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_MSG_SetSequenceCount(&CmdBuf->Msg, 1234), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_MSG_SetSequenceCount(&TlmBuf->Msg, 5678), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_SB_TransmitBuffer(CmdBuf, false), CFE_SUCCESS); @@ -526,6 +513,38 @@ void TestZeroCopyTransmitRecv(void) UtAssert_INT32_EQ(CFE_SB_DeletePipe(PipeId2), CFE_SUCCESS); } +void TestMessageUserDataAccess(void) +{ + CFE_TEST_TestCmdMessage64_t CmdMsg; + CFE_TEST_TestTlmMessage64_t TlmMsg; + + /* Test CFE_SB_GetUserData */ + UtAssert_INT32_EQ( + CFE_MSG_Init(CFE_MSG_PTR(CmdMsg.CommandHeader), CFE_FT_CMD_MSGID, sizeof(CFE_TEST_TestCmdMessage64_t)), + CFE_SUCCESS); + UtAssert_INT32_EQ( + CFE_MSG_Init(CFE_MSG_PTR(TlmMsg.TelemetryHeader), CFE_FT_TLM_MSGID, sizeof(CFE_TEST_TestTlmMessage64_t)), + CFE_SUCCESS); + + UtAssert_ADDRESS_EQ(CFE_SB_GetUserData(CFE_MSG_PTR(CmdMsg.CommandHeader)), &CmdMsg.Payload); + UtAssert_ADDRESS_EQ(CFE_SB_GetUserData(CFE_MSG_PTR(TlmMsg.TelemetryHeader)), &TlmMsg.Payload); + + UtAssert_UINT32_EQ(CFE_SB_GetUserDataLength(CFE_MSG_PTR(CmdMsg.CommandHeader)), sizeof(CmdMsg.Payload)); + UtAssert_UINT32_EQ(CFE_SB_GetUserDataLength(CFE_MSG_PTR(TlmMsg.TelemetryHeader)), sizeof(TlmMsg.Payload)); + + /* The size should be settable to something less, if necessary */ + CFE_SB_SetUserDataLength(CFE_MSG_PTR(CmdMsg.CommandHeader), sizeof(CmdMsg.Payload) - 2); + CFE_SB_SetUserDataLength(CFE_MSG_PTR(TlmMsg.TelemetryHeader), sizeof(TlmMsg.Payload) - 2); + UtAssert_UINT32_EQ(CFE_SB_GetUserDataLength(CFE_MSG_PTR(CmdMsg.CommandHeader)), sizeof(CmdMsg.Payload) - 2); + UtAssert_UINT32_EQ(CFE_SB_GetUserDataLength(CFE_MSG_PTR(TlmMsg.TelemetryHeader)), sizeof(TlmMsg.Payload) - 2); + + /* Bad inputs */ + UtAssert_NULL(CFE_SB_GetUserData(NULL)); + UtAssert_NULL(CFE_SB_GetUserData(NULL)); + UtAssert_ZERO(CFE_SB_GetUserDataLength(NULL)); + UtAssert_ZERO(CFE_SB_GetUserDataLength(NULL)); +} + void TestMiscMessageUtils(void) { char TestString[CFE_FT_STRINGBUF_SIZE + 4]; @@ -600,8 +619,12 @@ void TestMiscMessageUtils(void) void SBSendRecvTestSetup(void) { + CFE_FT_CMD_MSGID = CFE_SB_ValueToMsgId(CFE_TEST_CMD_MID); + CFE_FT_TLM_MSGID = CFE_SB_ValueToMsgId(CFE_TEST_HK_TLM_MID); + UtTest_Add(TestBasicTransmitRecv, NULL, NULL, "Test Basic Transmit/Receive"); UtTest_Add(TestZeroCopyTransmitRecv, NULL, NULL, "Test Zero Copy Transmit/Receive"); UtTest_Add(TestMsgBroadcast, NULL, NULL, "Test Msg Broadcast"); UtTest_Add(TestMiscMessageUtils, NULL, NULL, "Test Miscellaneous Message Utility APIs"); + UtTest_Add(TestMessageUserDataAccess, NULL, NULL, "Test Message UserData APIs"); } diff --git a/modules/cfe_testcase/src/sb_subscription_test.c b/modules/cfe_testcase/src/sb_subscription_test.c index 12cf51eb3..d50cab735 100644 --- a/modules/cfe_testcase/src/sb_subscription_test.c +++ b/modules/cfe_testcase/src/sb_subscription_test.c @@ -35,8 +35,8 @@ * This test procedure should be agnostic to specific MID values, but it should * not overlap/interfere with real MIDs used by other apps. */ -static const CFE_SB_MsgId_t CFE_FT_CMD_MSGID = CFE_SB_MSGID_WRAP_VALUE(CFE_TEST_CMD_MID); -static const CFE_SB_MsgId_t CFE_FT_TLM_MSGID = CFE_SB_MSGID_WRAP_VALUE(CFE_TEST_HK_TLM_MID); +static CFE_SB_MsgId_t CFE_FT_CMD_MSGID; +static CFE_SB_MsgId_t CFE_FT_TLM_MSGID; void TestSubscribeUnsubscribe(void) { @@ -276,6 +276,9 @@ void TestSBMaxDestinations(void) void SBSubscriptionTestSetup(void) { + CFE_FT_CMD_MSGID = CFE_SB_ValueToMsgId(CFE_TEST_CMD_MID); + CFE_FT_TLM_MSGID = CFE_SB_ValueToMsgId(CFE_TEST_HK_TLM_MID); + UtTest_Add(TestSubscribeUnsubscribe, NULL, NULL, "Test SB Subscribe/Unsubscribe"); UtTest_Add(TestSubscribeUnsubscribeLocal, NULL, NULL, "Test SB SubscribeLocal/UnsubscribeLocal"); UtTest_Add(TestSubscribeEx, NULL, NULL, "Test SB SubscribeEx"); diff --git a/modules/cfe_testcase/src/tbl_content_access_test.c b/modules/cfe_testcase/src/tbl_content_access_test.c index c36223616..4a18b0b3d 100644 --- a/modules/cfe_testcase/src/tbl_content_access_test.c +++ b/modules/cfe_testcase/src/tbl_content_access_test.c @@ -33,16 +33,16 @@ /* * Helper function to attempt to load the test table with data and assert with the provided CFE_Status_t */ -void LoadTable(TBL_TEST_Table_t *TestTable, CFE_Status_t ExpectedStatus) +void LoadTable(CFE_TEST_TestTable_t *TestTable, CFE_Status_t ExpectedStatus) { UtAssert_INT32_EQ(CFE_TBL_Load(CFE_FT_Global.TblHandle, CFE_TBL_SRC_ADDRESS, TestTable), ExpectedStatus); } void TestGetAddress(void) { - void * TblPtr; - TBL_TEST_Table_t *TestTblPtr; - TBL_TEST_Table_t TestTable = {1, 2}; + void * TblPtr; + CFE_TEST_TestTable_t *TestTblPtr; + CFE_TEST_TestTable_t TestTable = {1, 2}; CFE_TBL_Handle_t SharedTblHandle = CFE_TBL_BAD_TABLE_HANDLE; const char * SharedTblName = CFE_ASSERT_SHARED_TBL_NAME; @@ -60,7 +60,7 @@ void TestGetAddress(void) UtAssert_INT32_EQ(CFE_TBL_GetAddress(&TblPtr, CFE_FT_Global.TblHandle), CFE_SUCCESS); /* Check table contents */ - TestTblPtr = (TBL_TEST_Table_t *)TblPtr; + TestTblPtr = (CFE_TEST_TestTable_t *)TblPtr; UtAssert_INT32_EQ(TestTblPtr->Int1, TestTable.Int1); UtAssert_INT32_EQ(TestTblPtr->Int2, TestTable.Int2); @@ -78,8 +78,8 @@ void TestGetAddress(void) void TestReleaseAddress(void) { UtPrintf("Testing: CFE_TBL_GetAddress"); - void * TblPtr; - TBL_TEST_Table_t TestTable = {1, 2}; + void * TblPtr; + CFE_TEST_TestTable_t TestTable = {1, 2}; /* Never loaded */ UtAssert_INT32_EQ(CFE_TBL_ReleaseAddress(CFE_FT_Global.TblHandle), CFE_TBL_ERR_NEVER_LOADED); UtAssert_INT32_EQ(CFE_TBL_ReleaseAddress(CFE_TBL_BAD_TABLE_HANDLE), CFE_TBL_ERR_INVALID_HANDLE); @@ -106,12 +106,12 @@ void TestReleaseAddress(void) void TestGetReleaseAddresses(void) { - int numValidTbls = 5; - char TblName[10]; - CFE_TBL_Handle_t TblHandles[numValidTbls + 1]; - void * TblPtrs[numValidTbls + 1]; - TBL_TEST_Table_t TblPtrsList[numValidTbls + 1]; - TBL_TEST_Table_t TestTable = {1, 2}; + int numValidTbls = 5; + char TblName[10]; + CFE_TBL_Handle_t TblHandles[numValidTbls + 1]; + void * TblPtrs[numValidTbls + 1]; + CFE_TEST_TestTable_t TblPtrsList[numValidTbls + 1]; + CFE_TEST_TestTable_t TestTable = {1, 2}; /* Put an invalid handle at the start*/ TblHandles[0] = CFE_TBL_BAD_TABLE_HANDLE; @@ -120,7 +120,7 @@ void TestGetReleaseAddresses(void) { sprintf(TblName, "%d", i); UtAssert_INT32_EQ( - CFE_TBL_Register(&TblHandles[i], TblName, sizeof(TBL_TEST_Table_t), CFE_TBL_OPT_DEFAULT, NULL), + CFE_TBL_Register(&TblHandles[i], TblName, sizeof(CFE_TEST_TestTable_t), CFE_TBL_OPT_DEFAULT, NULL), CFE_SUCCESS); TblPtrs[i] = TblPtrsList + i; } diff --git a/modules/cfe_testcase/src/tbl_content_mang_test.c b/modules/cfe_testcase/src/tbl_content_mang_test.c index ec1135980..d488acf01 100644 --- a/modules/cfe_testcase/src/tbl_content_mang_test.c +++ b/modules/cfe_testcase/src/tbl_content_mang_test.c @@ -55,25 +55,25 @@ static const char TESTTBL_PARTIAL_FILE[] = void TestLoad(void) { - CFE_TBL_Handle_t BadTblHandle; - const char * BadTblName = "BadTableName"; - CFE_TBL_Handle_t DumpTblHandle; - const char * DumpTblName = "DumpOnlyTable"; - CFE_TBL_Handle_t SharedTblHandle; - const char * SharedTblName = CFE_FT_Global.RegisteredTblName; - TBL_TEST_Table_t TestTable = {0xd00d, 0xdad}; - TBL_TEST_Table_t *TablePtr; - CFE_TBL_Handle_t OtherHandle; - void * TempPtr; + CFE_TBL_Handle_t BadTblHandle; + const char * BadTblName = "BadTableName"; + CFE_TBL_Handle_t DumpTblHandle; + const char * DumpTblName = "DumpOnlyTable"; + CFE_TBL_Handle_t SharedTblHandle; + const char * SharedTblName = CFE_FT_Global.RegisteredTblName; + CFE_TEST_TestTable_t TestTable = {0xd00d, 0xdad}; + CFE_TEST_TestTable_t *TablePtr; + CFE_TBL_Handle_t OtherHandle; + void * TempPtr; UtPrintf("Testing: CFE_TBL_Load"); UtAssert_INT32_EQ( - CFE_TBL_Register(&BadTblHandle, BadTblName, sizeof(TBL_TEST_Table_t), CFE_TBL_OPT_DBL_BUFFER, NULL), + CFE_TBL_Register(&BadTblHandle, BadTblName, sizeof(CFE_TEST_TestTable_t), CFE_TBL_OPT_DBL_BUFFER, NULL), CFE_SUCCESS); /* Create a second table handle, to keep things interesting */ - UtAssert_INT32_EQ(CFE_TBL_Register(&OtherHandle, TESTTBL_OTHER_NAME, sizeof(TBL_TEST_Table_t), 0, NULL), + UtAssert_INT32_EQ(CFE_TBL_Register(&OtherHandle, TESTTBL_OTHER_NAME, sizeof(CFE_TEST_TestTable_t), 0, NULL), CFE_SUCCESS); /* Some basic failure checks */ @@ -200,7 +200,7 @@ void TestLoad(void) /* Attempt to load a dump only table */ UtAssert_INT32_EQ( - CFE_TBL_Register(&DumpTblHandle, DumpTblName, sizeof(TBL_TEST_Table_t), CFE_TBL_OPT_DUMP_ONLY, NULL), + CFE_TBL_Register(&DumpTblHandle, DumpTblName, sizeof(CFE_TEST_TestTable_t), CFE_TBL_OPT_DUMP_ONLY, NULL), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_TBL_Load(DumpTblHandle, CFE_TBL_SRC_FILE, TESTTBL_NOMINAL_FILE), CFE_TBL_ERR_DUMP_ONLY); @@ -283,12 +283,12 @@ void TblTest_GenerateTblFiles(void) uint32 PartialSize; union { - uint8 u8; - uint16 u16; - uint32 u32; - CFE_FS_Header_t FsHdr; - CFE_TBL_File_Hdr_t TblHdr; - TBL_TEST_Table_t Content; + uint8 u8; + uint16 u16; + uint32 u32; + CFE_FS_Header_t FsHdr; + CFE_TBL_File_Hdr_t TblHdr; + CFE_TEST_TestTable_t Content; } buf; /* Open the original (correct) table image file for reference */ @@ -443,7 +443,7 @@ void TblTest_GenerateTblFiles(void) UtAssert_INT32_EQ(OS_write(fh2, &buf, sizeof(buf.FsHdr)), sizeof(buf.FsHdr)); UtAssert_INT32_EQ(OS_read(fh1, &buf, sizeof(buf.TblHdr)), sizeof(buf.TblHdr)); PartialOffset = 0; - PartialSize = offsetof(TBL_TEST_Table_t, Int2); + PartialSize = offsetof(CFE_TEST_TestTable_t, Int2); TblTest_UpdateOffset(&buf.TblHdr.Offset, PartialOffset); TblTest_UpdateOffset(&buf.TblHdr.NumBytes, PartialSize); UtAssert_INT32_EQ(OS_write(fh2, &buf, sizeof(buf.TblHdr)), sizeof(buf.TblHdr)); @@ -463,8 +463,8 @@ void TblTest_GenerateTblFiles(void) UtAssert_INT32_EQ(OS_read(fh1, &buf, sizeof(buf.FsHdr)), sizeof(buf.FsHdr)); UtAssert_INT32_EQ(OS_write(fh2, &buf, sizeof(buf.FsHdr)), sizeof(buf.FsHdr)); UtAssert_INT32_EQ(OS_read(fh1, &buf, sizeof(buf.TblHdr)), sizeof(buf.TblHdr)); - PartialOffset = offsetof(TBL_TEST_Table_t, Int2); - PartialSize = sizeof(buf.Content) - offsetof(TBL_TEST_Table_t, Int2); + PartialOffset = offsetof(CFE_TEST_TestTable_t, Int2); + PartialSize = sizeof(buf.Content) - offsetof(CFE_TEST_TestTable_t, Int2); TblTest_UpdateOffset(&buf.TblHdr.Offset, PartialOffset); TblTest_UpdateOffset(&buf.TblHdr.NumBytes, PartialSize); UtAssert_INT32_EQ(OS_write(fh2, &buf, sizeof(buf.TblHdr)), sizeof(buf.TblHdr)); diff --git a/modules/cfe_testcase/src/tbl_information_test.c b/modules/cfe_testcase/src/tbl_information_test.c index 1d530688e..5a57e6e4c 100644 --- a/modules/cfe_testcase/src/tbl_information_test.c +++ b/modules/cfe_testcase/src/tbl_information_test.c @@ -58,7 +58,7 @@ void TestGetInfo(void) UtAssert_INT32_EQ(CFE_TBL_GetInfo(&TblInfo, NULL), CFE_TBL_BAD_ARGUMENT); /* This is only checking some parts of the TblInfo struct */ - size_t expectedSize = sizeof(TBL_TEST_Table_t); + size_t expectedSize = sizeof(CFE_TEST_TestTable_t); uint32 expectedNumUsers = 1; bool expectedTableLoaded = false; bool expectedDumpOnly = false; diff --git a/modules/cfe_testcase/src/tbl_registration_test.c b/modules/cfe_testcase/src/tbl_registration_test.c index 84f848b0a..294f642e8 100644 --- a/modules/cfe_testcase/src/tbl_registration_test.c +++ b/modules/cfe_testcase/src/tbl_registration_test.c @@ -49,23 +49,23 @@ void TestTableRegistration(void) /* invalid table handle arg */ UtAssert_INT32_EQ( - CFE_TBL_Register(NULL, CFE_FT_Global.TblName, sizeof(TBL_TEST_Table_t), CFE_TBL_OPT_DEFAULT, &CallbackFunc), + CFE_TBL_Register(NULL, CFE_FT_Global.TblName, sizeof(CFE_TEST_TestTable_t), CFE_TBL_OPT_DEFAULT, &CallbackFunc), CFE_TBL_BAD_ARGUMENT); /* Successfully create table */ - UtAssert_INT32_EQ(CFE_TBL_Register(&CFE_FT_Global.TblHandle, CFE_FT_Global.TblName, sizeof(TBL_TEST_Table_t), + UtAssert_INT32_EQ(CFE_TBL_Register(&CFE_FT_Global.TblHandle, CFE_FT_Global.TblName, sizeof(CFE_TEST_TestTable_t), CFE_TBL_OPT_DEFAULT, &CallbackFunc), CFE_SUCCESS); /* Duplicate table (should return the same handle) */ - UtAssert_INT32_EQ(CFE_TBL_Register(&OtherHandle, CFE_FT_Global.TblName, sizeof(TBL_TEST_Table_t), + UtAssert_INT32_EQ(CFE_TBL_Register(&OtherHandle, CFE_FT_Global.TblName, sizeof(CFE_TEST_TestTable_t), CFE_TBL_OPT_DEFAULT, &CallbackFunc), CFE_TBL_WARN_DUPLICATE); UtAssert_INT32_EQ(OtherHandle, CFE_FT_Global.TblHandle); /* Duplicate table with different size */ - UtAssert_INT32_EQ(CFE_TBL_Register(&OtherHandle, CFE_FT_Global.TblName, sizeof(TBL_TEST_Table_t) / 2, + UtAssert_INT32_EQ(CFE_TBL_Register(&OtherHandle, CFE_FT_Global.TblName, sizeof(CFE_TEST_TestTable_t) / 2, CFE_TBL_OPT_DEFAULT, &CallbackFunc), CFE_TBL_ERR_DUPLICATE_DIFF_SIZE); @@ -76,10 +76,10 @@ void TestTableRegistration(void) /* Invalid Name */ UtAssert_INT32_EQ( - CFE_TBL_Register(&CFE_FT_Global.TblHandle, BadTblName, sizeof(TBL_TEST_Table_t), CFE_TBL_OPT_DEFAULT, NULL), + CFE_TBL_Register(&CFE_FT_Global.TblHandle, BadTblName, sizeof(CFE_TEST_TestTable_t), CFE_TBL_OPT_DEFAULT, NULL), CFE_TBL_ERR_INVALID_NAME); UtAssert_INT32_EQ( - CFE_TBL_Register(&CFE_FT_Global.TblHandle, "", sizeof(TBL_TEST_Table_t), CFE_TBL_OPT_DEFAULT, NULL), + CFE_TBL_Register(&CFE_FT_Global.TblHandle, "", sizeof(CFE_TEST_TestTable_t), CFE_TBL_OPT_DEFAULT, NULL), CFE_TBL_ERR_INVALID_NAME); /* Invalid Table Size */ @@ -93,13 +93,13 @@ void TestTableRegistration(void) CFE_TBL_ERR_INVALID_SIZE); /* Invalid Table Options */ - UtAssert_INT32_EQ(CFE_TBL_Register(&CFE_FT_Global.TblHandle, CFE_FT_Global.TblName, sizeof(TBL_TEST_Table_t), + UtAssert_INT32_EQ(CFE_TBL_Register(&CFE_FT_Global.TblHandle, CFE_FT_Global.TblName, sizeof(CFE_TEST_TestTable_t), CFE_TBL_OPT_DBL_BUFFER | CFE_TBL_OPT_USR_DEF_ADDR, NULL), CFE_TBL_ERR_INVALID_OPTIONS); - UtAssert_INT32_EQ(CFE_TBL_Register(&CFE_FT_Global.TblHandle, CFE_FT_Global.TblName, sizeof(TBL_TEST_Table_t), + UtAssert_INT32_EQ(CFE_TBL_Register(&CFE_FT_Global.TblHandle, CFE_FT_Global.TblName, sizeof(CFE_TEST_TestTable_t), CFE_TBL_OPT_CRITICAL | CFE_TBL_OPT_DUMP_ONLY, NULL), CFE_TBL_ERR_INVALID_OPTIONS); - UtAssert_INT32_EQ(CFE_TBL_Register(&CFE_FT_Global.TblHandle, CFE_FT_Global.TblName, sizeof(TBL_TEST_Table_t), + UtAssert_INT32_EQ(CFE_TBL_Register(&CFE_FT_Global.TblHandle, CFE_FT_Global.TblName, sizeof(CFE_TEST_TestTable_t), CFE_TBL_OPT_CRITICAL | CFE_TBL_OPT_USR_DEF_ADDR, NULL), CFE_TBL_ERR_INVALID_OPTIONS); } @@ -119,8 +119,8 @@ void TestTableMaxLimits(void) while (numTblsCreated <= CFE_PLATFORM_TBL_MAX_NUM_HANDLES) { snprintf(TblName, sizeof(TblName), "Tbl%u", (unsigned int)numTblsCreated); - CFE_Assert_STATUS_STORE( - CFE_TBL_Register(&Handles[numTblsCreated], TblName, sizeof(TBL_TEST_Table_t), CFE_TBL_OPT_DEFAULT, NULL)); + CFE_Assert_STATUS_STORE(CFE_TBL_Register(&Handles[numTblsCreated], TblName, sizeof(CFE_TEST_TestTable_t), + CFE_TBL_OPT_DEFAULT, NULL)); if (CFE_Assert_STATUS_MAY_BE(CFE_TBL_ERR_REGISTRY_FULL)) { break; @@ -175,7 +175,7 @@ void TestTableMaxLimits(void) /* also confirm not able to register a new table, either */ snprintf(TblName, sizeof(TblName), "Tbl%u", (unsigned int)numTblsCreated); UtAssert_INT32_EQ( - CFE_TBL_Register(&Handles[numTblsCreated], TblName, sizeof(TBL_TEST_Table_t), CFE_TBL_OPT_DEFAULT, NULL), + CFE_TBL_Register(&Handles[numTblsCreated], TblName, sizeof(CFE_TEST_TestTable_t), CFE_TBL_OPT_DEFAULT, NULL), CFE_TBL_ERR_HANDLES_FULL); /* Unregister all table handles */ @@ -206,7 +206,7 @@ void TestTblNonAppContext(void) /* Attempt to register another table */ UtAssert_INT32_EQ( - CFE_TBL_Register(&Handle, "OtherTable", sizeof(TBL_TEST_Table_t), CFE_TBL_OPT_DEFAULT, &CallbackFunc), + CFE_TBL_Register(&Handle, "OtherTable", sizeof(CFE_TEST_TestTable_t), CFE_TBL_OPT_DEFAULT, &CallbackFunc), CFE_ES_ERR_RESOURCEID_NOT_VALID); /* Calling any other API (with a valid handle) should be rejected from this context */ @@ -235,7 +235,7 @@ void TestTableBadContext(void) OS_task_prop_t TaskProp; /* Create one (good) handle first from this task */ - UtAssert_INT32_EQ(CFE_TBL_Register(&CFE_FT_Global.TblHandle, CFE_FT_Global.TblName, sizeof(TBL_TEST_Table_t), + UtAssert_INT32_EQ(CFE_TBL_Register(&CFE_FT_Global.TblHandle, CFE_FT_Global.TblName, sizeof(CFE_TEST_TestTable_t), CFE_TBL_OPT_DEFAULT, &CallbackFunc), CFE_SUCCESS); diff --git a/modules/cfe_testcase/tables/cfe_test_tbl.c b/modules/cfe_testcase/tables/cfe_test_tbl.c index 757f5aba1..dd71344d7 100644 --- a/modules/cfe_testcase/tables/cfe_test_tbl.c +++ b/modules/cfe_testcase/tables/cfe_test_tbl.c @@ -33,6 +33,6 @@ * so any issues with paritial loading/byteswapping are morely likely * to be detected. */ -TBL_TEST_Table_t TestTable = {0xf007, 0xba11}; +CFE_TEST_TestTable_t TestTable = {0xf007, 0xba11}; CFE_TBL_FILEDEF(TestTable, CFE_TEST_APP.TestTable, Table Test Table, cfe_test_tbl.tbl) diff --git a/modules/config/fsw/src/cfe_config_get.c b/modules/config/fsw/src/cfe_config_get.c index 1c47f0bc2..ff98ec0e0 100644 --- a/modules/config/fsw/src/cfe_config_get.c +++ b/modules/config/fsw/src/cfe_config_get.c @@ -29,8 +29,10 @@ */ #include "cfe_config_priv.h" #include "cfe_config_map.h" +#include "cfe_version.h" #include +#include /*---------------------------------------------------------------- * @@ -159,3 +161,17 @@ void CFE_Config_IterateAll(void *Arg, CFE_Config_Callback_t Callback) ++NamePtr; } } + +/*---------------------------------------------------------------- + * + * Defined per public API + * See description in header file for argument/return detail + * + *-----------------------------------------------------------------*/ +void CFE_Config_GetVersionString(char *Buf, size_t Size, const char *Component, + const char *SrcVersion, const char *CodeName, const char *LastOffcRel) +{ + snprintf(Buf, Size, "%s %s %s (Codename %s), Last Official Release: %s %s)", + Component, CFE_REVISION == 0 ? "Development Build" : "Release", SrcVersion, + CodeName, Component, LastOffcRel); +} diff --git a/modules/config/fsw/src/cfe_config_init.c b/modules/config/fsw/src/cfe_config_init.c index 19cde5248..6791b45c4 100644 --- a/modules/config/fsw/src/cfe_config_init.c +++ b/modules/config/fsw/src/cfe_config_init.c @@ -170,6 +170,7 @@ void CFE_Config_SetupModuleVersions(CFE_ConfigName_t *ModuleListSet[], size_t Se void CFE_Config_SetupBasicBuildInfo(void) { const char *KeyVal; + char VersionString[CFE_CFG_MAX_VERSION_STR_LEN]; /* Global mission name */ CFE_Config_SetString(CFE_CONFIGID_MISSION_NAME, GLOBAL_CONFIGDATA.MissionName); @@ -184,7 +185,9 @@ void CFE_Config_SetupBasicBuildInfo(void) CFE_Config_SetValue(CFE_CONFIGID_CORE_VERSION_BUILDNUM, CFE_BUILD_NUMBER); CFE_Config_SetString(CFE_CONFIGID_CORE_VERSION_BASELINE, CFE_BUILD_BASELINE); - CFE_Config_SetString(CFE_CONFIGID_CORE_VERSION_DESCRIPTION, CFE_VERSION_STRING); + CFE_Config_GetVersionString(VersionString, CFE_CFG_MAX_VERSION_STR_LEN, "cFE", + CFE_SRC_VERSION, CFE_BUILD_CODENAME, CFE_LAST_OFFICIAL); + CFE_Config_SetString(CFE_CONFIGID_CORE_VERSION_DESCRIPTION, VersionString); /* * Initialize values from the "target_config" CFE internal object diff --git a/modules/core_api/fsw/inc/cfe_config.h b/modules/core_api/fsw/inc/cfe_config.h index 7307c42e4..4fc3478f2 100644 --- a/modules/core_api/fsw/inc/cfe_config.h +++ b/modules/core_api/fsw/inc/cfe_config.h @@ -119,4 +119,26 @@ CFE_ConfigId_t CFE_Config_GetIdByName(const char *Name); */ void CFE_Config_IterateAll(void *Arg, CFE_Config_Callback_t Callback); +/** + * @brief Obtain the version string for a cFS component or app + * + * Assembles a standardized version string associated with the specified + * component/app. + * + * @param[in] Buf Buffer to place version string in. Will be populated + * with standard version string containing the provided + parameters (i.e.: + * "cFE DEVELOPMENT BUILD equuleus-rc1+dev0 (Codename + equueleus), Last Official Release: cFE 6.7.0" + * @param[in] Size Size of the provided buffer + * @param[in] Component Component for which to get version string + * (i.e. "cFE") + * @param[in] SrcVersion Source version identifier (i.e. "equuleus-rc1+dev0") + * @param[in] CodeName Code name for the build (i.e. "equuleus") + * @param[in] LastOffcRel Last official release (i.e. "6.7.0") + */ +void CFE_Config_GetVersionString(char *Buf, size_t Size, + const char *Component, const char *SrcVersion, + const char *CodeName, const char *LastOffcRel); + #endif /* CFE_CONFIG_H */ diff --git a/modules/core_api/fsw/inc/cfe_version.h b/modules/core_api/fsw/inc/cfe_version.h index 096f9f08c..1304226f0 100644 --- a/modules/core_api/fsw/inc/cfe_version.h +++ b/modules/core_api/fsw/inc/cfe_version.h @@ -26,13 +26,20 @@ #define CFE_VERSION_H /* Development Build Macro Definitions */ -#define CFE_BUILD_NUMBER 434 /**< @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 */ +#define CFE_BUILD_NUMBER 75 /**< @brief Development: Number of development git commits since CFE_BUILD_BASELINE */ +#define CFE_BUILD_BASELINE "equuleus-rc1" /**< @brief Development: Reference git tag for build number */ +#define CFE_BUILD_DEV_CYCLE "equuleus-rc2" /**< @brief Development: Release name for current development cycle */ +#define CFE_BUILD_CODENAME "Equuleus" /**< @brief: Development: Code name for the current build */ /* See \ref cfsversions for definitions */ #define CFE_MAJOR_VERSION 6 /*!< @brief Major version number */ #define CFE_MINOR_VERSION 7 /*!< @brief Minor version number */ -#define CFE_REVISION 99 /*!< @brief Revision version number. Value of 99 indicates a development version.*/ +#define CFE_REVISION 0 /*!< @brief Revision version number. Value of 0 indicates a development version.*/ + +/** + * @brief Last official release. + */ +#define CFE_LAST_OFFICIAL "v6.7.0" /*! * @brief Mission revision. @@ -55,12 +62,10 @@ #define CFE_SRC_VERSION CFE_BUILD_BASELINE "+dev" CFE_STR(CFE_BUILD_NUMBER) /** - * @brief Long Build Version String - * - * Long freeform string identifying the build, see @ref cfsversions for suggested format for development - * and official releases. + * @brief Max Version String length. + * + * Maximum length that a cFE version string can be. */ -#define CFE_VERSION_STRING \ - " cFE DEVELOPMENT BUILD " CFE_SRC_VERSION " (Codename: Draco), Last Official Release: cfe v6.7.0" +#define CFE_CFG_MAX_VERSION_STR_LEN 256 #endif /* CFE_VERSION_H */ diff --git a/modules/core_api/ut-stubs/src/cfe_config_stubs.c b/modules/core_api/ut-stubs/src/cfe_config_stubs.c index 1ac7943a8..87a327692 100644 --- a/modules/core_api/ut-stubs/src/cfe_config_stubs.c +++ b/modules/core_api/ut-stubs/src/cfe_config_stubs.c @@ -108,6 +108,23 @@ uint32 CFE_Config_GetValue(CFE_ConfigId_t ConfigId) return UT_GenStub_GetReturnValue(CFE_Config_GetValue, uint32); } +/* + * ---------------------------------------------------- + * Generated stub function for CFE_Config_GetVersionString() + * ---------------------------------------------------- + */ +void CFE_Config_GetVersionString(char *Buf, size_t Size, const char *Component, const char *SrcVersion, const char *CodeName, const char *LastOffcRel) +{ + UT_GenStub_AddParam(CFE_Config_GetVersionString, char *, Buf); + UT_GenStub_AddParam(CFE_Config_GetVersionString, size_t , Size); + UT_GenStub_AddParam(CFE_Config_GetVersionString, const char *, Component); + UT_GenStub_AddParam(CFE_Config_GetVersionString, const char *, SrcVersion); + UT_GenStub_AddParam(CFE_Config_GetVersionString, const char *, CodeName); + UT_GenStub_AddParam(CFE_Config_GetVersionString, const char *, LastOffcRel); + + UT_GenStub_Execute(CFE_Config_GetVersionString, Basic, NULL); +} + /* * ---------------------------------------------------- * Generated stub function for CFE_Config_IterateAll() diff --git a/modules/es/arch_build.cmake b/modules/es/arch_build.cmake index 28707caa0..fcae78251 100644 --- a/modules/es/arch_build.cmake +++ b/modules/es/arch_build.cmake @@ -15,9 +15,6 @@ set(ES_PLATFORM_CONFIG_FILE_LIST cfe_es_platform_cfg.h ) -message("ES_CFGFILE_SRC_cfe_es_msgids = ${ES_CFGFILE_SRC_cfe_es_msgids}") - - # Create wrappers around the all the config header files # This makes them individually overridable by the missions, without modifying # the distribution default copies diff --git a/modules/es/fsw/src/cfe_es_task.c b/modules/es/fsw/src/cfe_es_task.c index a862ffabf..4f03ba7c4 100644 --- a/modules/es/fsw/src/cfe_es_task.c +++ b/modules/es/fsw/src/cfe_es_task.c @@ -277,6 +277,7 @@ int32 CFE_ES_TaskInit(void) uint32 SizeofCfeSegment; cpuaddr CfeSegmentAddr; uint8 VersionNumber[4]; + char VersionString[CFE_CFG_MAX_VERSION_STR_LEN]; /* ** Initialize task command execution counters @@ -394,8 +395,10 @@ int32 CFE_ES_TaskInit(void) /* ** Task startup event message. */ + CFE_Config_GetVersionString(VersionString, CFE_CFG_MAX_VERSION_STR_LEN, "cFE", + CFE_SRC_VERSION, CFE_BUILD_CODENAME, CFE_LAST_OFFICIAL); Status = CFE_EVS_SendEvent(CFE_ES_INIT_INF_EID, CFE_EVS_EventType_INFORMATION, "cFE ES Initialized: %s", - CFE_VERSION_STRING); + VersionString); if (Status != CFE_SUCCESS) { CFE_ES_WriteToSysLog("%s: Error sending init event:RC=0x%08X\n", __func__, (unsigned int)Status); diff --git a/modules/evs/fsw/src/cfe_evs_task.c b/modules/evs/fsw/src/cfe_evs_task.c index 01352f49d..2d5024784 100644 --- a/modules/evs/fsw/src/cfe_evs_task.c +++ b/modules/evs/fsw/src/cfe_evs_task.c @@ -30,6 +30,7 @@ /* Include Files */ #include "cfe_evs_module_all.h" /* All EVS internal definitions and API */ #include "cfe_version.h" /* cFE version definitions */ +#include "cfe_config.h" /* For version string construction */ #include "cfe_evs_verify.h" #include @@ -260,6 +261,7 @@ int32 CFE_EVS_TaskInit(void) { int32 Status; CFE_ES_AppId_t AppID; + char VersionString[CFE_CFG_MAX_VERSION_STR_LEN]; /* Query and verify the AppID */ Status = CFE_ES_GetAppID(&AppID); @@ -302,7 +304,9 @@ int32 CFE_EVS_TaskInit(void) /* Write the AppID to the global location, now that the rest of initialization is done */ CFE_EVS_Global.EVS_AppID = AppID; - EVS_SendEvent(CFE_EVS_STARTUP_EID, CFE_EVS_EventType_INFORMATION, "cFE EVS Initialized: %s", CFE_VERSION_STRING); + CFE_Config_GetVersionString(VersionString, CFE_CFG_MAX_VERSION_STR_LEN, "cFE", + CFE_SRC_VERSION, CFE_BUILD_CODENAME, CFE_LAST_OFFICIAL); + EVS_SendEvent(CFE_EVS_STARTUP_EID, CFE_EVS_EventType_INFORMATION, "cFE EVS Initialized: %s", VersionString); return CFE_SUCCESS; } @@ -315,7 +319,10 @@ int32 CFE_EVS_TaskInit(void) *-----------------------------------------------------------------*/ int32 CFE_EVS_NoopCmd(const CFE_EVS_NoopCmd_t *data) { - EVS_SendEvent(CFE_EVS_NOOP_EID, CFE_EVS_EventType_INFORMATION, "No-op Cmd Rcvd: %s", CFE_VERSION_STRING); + char VersionString[CFE_CFG_MAX_VERSION_STR_LEN]; + CFE_Config_GetVersionString(VersionString, CFE_CFG_MAX_VERSION_STR_LEN, "cFE", + CFE_SRC_VERSION, CFE_BUILD_CODENAME, CFE_LAST_OFFICIAL); + EVS_SendEvent(CFE_EVS_NOOP_EID, CFE_EVS_EventType_INFORMATION, "No-op Cmd Rcvd: %s", VersionString); return CFE_SUCCESS; } diff --git a/modules/msg/fsw/src/cfe_msg_msgid_v1.c b/modules/msg/fsw/src/cfe_msg_msgid_v1.c index e4574e2fe..b205f18ac 100644 --- a/modules/msg/fsw/src/cfe_msg_msgid_v1.c +++ b/modules/msg/fsw/src/cfe_msg_msgid_v1.c @@ -56,7 +56,7 @@ CFE_Status_t CFE_MSG_SetMsgId(CFE_MSG_Message_t *MsgPtr, CFE_SB_MsgId_t MsgId) { CFE_SB_MsgId_Atom_t msgidval = CFE_SB_MsgIdToValue(MsgId); - if (MsgPtr == NULL || msgidval > CFE_PLATFORM_SB_HIGHEST_VALID_MSGID) + if (MsgPtr == NULL || !CFE_SB_IsValidMsgId(MsgId)) { return CFE_MSG_BAD_ARGUMENT; } diff --git a/modules/msg/fsw/src/cfe_msg_msgid_v2.c b/modules/msg/fsw/src/cfe_msg_msgid_v2.c index 8c8876fae..f402a729d 100644 --- a/modules/msg/fsw/src/cfe_msg_msgid_v2.c +++ b/modules/msg/fsw/src/cfe_msg_msgid_v2.c @@ -88,7 +88,7 @@ CFE_Status_t CFE_MSG_SetMsgId(CFE_MSG_Message_t *MsgPtr, CFE_SB_MsgId_t MsgId) { CFE_SB_MsgId_Atom_t msgidval = CFE_SB_MsgIdToValue(MsgId); - if (MsgPtr == NULL || msgidval > CFE_PLATFORM_SB_HIGHEST_VALID_MSGID) + if (MsgPtr == NULL || !CFE_SB_IsValidMsgId(MsgId)) { return CFE_MSG_BAD_ARGUMENT; } diff --git a/modules/msg/ut-coverage/test_cfe_msg_init.c b/modules/msg/ut-coverage/test_cfe_msg_init.c index a072566ae..a7590f274 100644 --- a/modules/msg/ut-coverage/test_cfe_msg_init.c +++ b/modules/msg/ut-coverage/test_cfe_msg_init.c @@ -50,15 +50,18 @@ void Test_MSG_Init(void) bool hassec; bool is_v1; + msgidval_exp = 1; + msgid_act = CFE_SB_ValueToMsgId(msgidval_exp); + UtPrintf("Bad parameter tests, Null pointer, invalid size, invalid msgid"); - UtAssert_INT32_EQ(CFE_MSG_Init(NULL, CFE_SB_INVALID_MSG_ID, sizeof(cmd)), CFE_MSG_BAD_ARGUMENT); - UtAssert_INT32_EQ(CFE_MSG_Init(CFE_MSG_PTR(cmd), CFE_SB_INVALID_MSG_ID, 0), CFE_MSG_BAD_ARGUMENT); - UtAssert_INT32_EQ( - CFE_MSG_Init(CFE_MSG_PTR(cmd), CFE_SB_ValueToMsgId(CFE_PLATFORM_SB_HIGHEST_VALID_MSGID + 1), sizeof(cmd)), - CFE_MSG_BAD_ARGUMENT); - UtAssert_INT32_EQ(CFE_MSG_Init(CFE_MSG_PTR(cmd), CFE_SB_ValueToMsgId(-1), sizeof(cmd)), CFE_MSG_BAD_ARGUMENT); + UT_SetDefaultReturnValue(UT_KEY(CFE_SB_IsValidMsgId), true); + UtAssert_INT32_EQ(CFE_MSG_Init(NULL, msgid_act, sizeof(cmd)), CFE_MSG_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_MSG_Init(CFE_MSG_PTR(cmd), msgid_act, 0), CFE_MSG_BAD_ARGUMENT); + UT_SetDefaultReturnValue(UT_KEY(CFE_SB_IsValidMsgId), false); + UtAssert_INT32_EQ(CFE_MSG_Init(CFE_MSG_PTR(cmd), msgid_act, sizeof(cmd)), CFE_MSG_BAD_ARGUMENT); UtPrintf("Set to all F's, msgid value = 0"); + UT_SetDefaultReturnValue(UT_KEY(CFE_SB_IsValidMsgId), true); memset(&cmd, 0xFF, sizeof(cmd)); msgidval_exp = 0; diff --git a/modules/msg/ut-coverage/test_cfe_msg_msgid_shared.c b/modules/msg/ut-coverage/test_cfe_msg_msgid_shared.c index 32e962954..0ab6b3310 100644 --- a/modules/msg/ut-coverage/test_cfe_msg_msgid_shared.c +++ b/modules/msg/ut-coverage/test_cfe_msg_msgid_shared.c @@ -39,14 +39,17 @@ void Test_MSG_GetTypeFromMsgId(void) CFE_MSG_Type_t actual = CFE_MSG_Type_Invalid; UtPrintf("Bad parameter tests, Null pointer"); + UT_SetDefaultReturnValue(UT_KEY(CFE_SB_IsValidMsgId), true); memset(&msg, 0, sizeof(msg)); UtAssert_INT32_EQ(CFE_MSG_GetTypeFromMsgId(msgid, NULL), CFE_MSG_BAD_ARGUMENT); UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); UtPrintf("Bad parameter tests, Invalid message ID"); + UT_SetDefaultReturnValue(UT_KEY(CFE_SB_IsValidMsgId), false); UtAssert_INT32_EQ(CFE_MSG_GetTypeFromMsgId(CFE_SB_ValueToMsgId(-1), &actual), CFE_MSG_BAD_ARGUMENT); UtPrintf("Set to all F's, test cmd and tlm"); + UT_SetDefaultReturnValue(UT_KEY(CFE_SB_IsValidMsgId), true); memset(&msg, 0xFF, sizeof(msg)); CFE_UtAssert_SUCCESS(CFE_MSG_SetMsgId(&msg, CFE_SB_ValueToMsgId(CFE_PLATFORM_SB_HIGHEST_VALID_MSGID))); CFE_UtAssert_SUCCESS(CFE_MSG_SetType(&msg, CFE_MSG_Type_Tlm)); diff --git a/modules/msg/ut-coverage/test_cfe_msg_msgid_v1.c b/modules/msg/ut-coverage/test_cfe_msg_msgid_v1.c index 7b56a845b..da0f127e7 100644 --- a/modules/msg/ut-coverage/test_cfe_msg_msgid_v1.c +++ b/modules/msg/ut-coverage/test_cfe_msg_msgid_v1.c @@ -39,22 +39,20 @@ void Test_MSG_MsgId(void) CFE_MSG_ApId_t apid; bool hassec; - UtPrintf("Bad parameter tests, Null pointers and invalid (max valid + 1)"); + UtPrintf("Bad parameter tests, Null pointers and invalid msg ID"); + UT_SetDefaultReturnValue(UT_KEY(CFE_SB_IsValidMsgId), true); memset(&msg, 0, sizeof(msg)); UtAssert_INT32_EQ(CFE_MSG_GetMsgId(NULL, &msgid), CFE_MSG_BAD_ARGUMENT); UtAssert_INT32_EQ(CFE_SB_MsgIdToValue(msgid), 1); UtAssert_INT32_EQ(CFE_MSG_GetMsgId(&msg, NULL), CFE_MSG_BAD_ARGUMENT); UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); UtAssert_INT32_EQ(CFE_MSG_SetMsgId(NULL, msgid), CFE_MSG_BAD_ARGUMENT); - UtAssert_INT32_EQ(CFE_MSG_SetMsgId(&msg, CFE_SB_ValueToMsgId(-1)), CFE_MSG_BAD_ARGUMENT); - UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); - UtAssert_INT32_EQ(CFE_MSG_SetMsgId(&msg, CFE_SB_ValueToMsgId(CFE_PLATFORM_SB_HIGHEST_VALID_MSGID + 1)), - CFE_MSG_BAD_ARGUMENT); - UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); - UtAssert_INT32_EQ(CFE_MSG_SetMsgId(&msg, CFE_SB_ValueToMsgId(0xFFFF)), CFE_MSG_BAD_ARGUMENT); + UT_SetDefaultReturnValue(UT_KEY(CFE_SB_IsValidMsgId), false); + UtAssert_INT32_EQ(CFE_MSG_SetMsgId(&msg, msgid), CFE_MSG_BAD_ARGUMENT); UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); UtPrintf("Set msg to all F's, set msgid to 1 and verify"); + UT_SetDefaultReturnValue(UT_KEY(CFE_SB_IsValidMsgId), true); memset(&msg, 0xFF, sizeof(msg)); CFE_UtAssert_SUCCESS(CFE_MSG_GetMsgId(&msg, &msgid)); UtAssert_INT32_EQ(CFE_SB_MsgIdToValue(msgid), 0xFFFF); diff --git a/modules/msg/ut-coverage/test_cfe_msg_msgid_v2.c b/modules/msg/ut-coverage/test_cfe_msg_msgid_v2.c index 6a07cbe62..6e293cd1c 100644 --- a/modules/msg/ut-coverage/test_cfe_msg_msgid_v2.c +++ b/modules/msg/ut-coverage/test_cfe_msg_msgid_v2.c @@ -47,21 +47,20 @@ void Test_MSG_MsgId(void) local_subsys_flag = MSG_SUBSYS_FLAG; } - UtPrintf("Bad parameter tests, Null pointers and invalid (max valid + 1)"); + UtPrintf("Bad parameter tests, Null pointers and invalid msg ID"); + UT_SetDefaultReturnValue(UT_KEY(CFE_SB_IsValidMsgId), true); memset(&msg, 0, sizeof(msg)); UtAssert_INT32_EQ(CFE_MSG_GetMsgId(NULL, &msgid), CFE_MSG_BAD_ARGUMENT); UtAssert_INT32_EQ(CFE_SB_MsgIdToValue(msgid), 1); UtAssert_INT32_EQ(CFE_MSG_GetMsgId(&msg, NULL), CFE_MSG_BAD_ARGUMENT); UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); UtAssert_INT32_EQ(CFE_MSG_SetMsgId(NULL, msgid), CFE_MSG_BAD_ARGUMENT); - UtAssert_INT32_EQ(CFE_MSG_SetMsgId(&msg, CFE_SB_INVALID_MSG_ID), CFE_MSG_BAD_ARGUMENT); - UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); - UtAssert_INT32_EQ(CFE_MSG_SetMsgId(&msg, CFE_PLATFORM_SB_HIGHEST_VALID_MSGID + 1), CFE_MSG_BAD_ARGUMENT); - UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); - UtAssert_INT32_EQ(CFE_MSG_SetMsgId(&msg, 0xFFFFFFFF), CFE_MSG_BAD_ARGUMENT); + UT_SetDefaultReturnValue(UT_KEY(CFE_SB_IsValidMsgId), false); + UtAssert_INT32_EQ(CFE_MSG_SetMsgId(&msg, msgid), CFE_MSG_BAD_ARGUMENT); UtAssert_INT32_EQ(Test_MSG_NotZero(&msg), 0); UtPrintf("Set msg to all F's, set msgid to 0 and verify"); + UT_SetDefaultReturnValue(UT_KEY(CFE_SB_IsValidMsgId), true); memset(&msg, 0xFF, sizeof(msg)); CFE_UtAssert_SUCCESS(CFE_MSG_GetMsgId(&msg, &msgid)); UtAssert_INT32_EQ(CFE_SB_MsgIdToValue(msgid), 0xFFFF); diff --git a/modules/sb/fsw/src/cfe_sb_task.c b/modules/sb/fsw/src/cfe_sb_task.c index 2f99e48f0..e3168d8a7 100644 --- a/modules/sb/fsw/src/cfe_sb_task.c +++ b/modules/sb/fsw/src/cfe_sb_task.c @@ -30,6 +30,7 @@ #include "cfe_sb_module_all.h" #include "cfe_version.h" +#include "cfe_config.h" /* For version string construction */ #include "cfe_es_msg.h" /* needed for local use of CFE_ES_RestartCmd_t */ #include "cfe_sb_verify.h" @@ -119,6 +120,7 @@ int32 CFE_SB_AppInit(void) uint32 CfgFileEventsToFilter = 0; CFE_ES_MemPoolBuf_t TmpPtr; int32 Status; + char VersionString[CFE_CFG_MAX_VERSION_STR_LEN]; /* Get the assigned Application ID for the SB Task */ CFE_ES_GetAppID(&CFE_SB_Global.AppId); @@ -266,8 +268,10 @@ int32 CFE_SB_AppInit(void) return Status; } + CFE_Config_GetVersionString(VersionString, CFE_CFG_MAX_VERSION_STR_LEN, "cFE", + CFE_SRC_VERSION, CFE_BUILD_CODENAME, CFE_LAST_OFFICIAL); Status = - CFE_EVS_SendEvent(CFE_SB_INIT_EID, CFE_EVS_EventType_INFORMATION, "cFE SB Initialized: %s", CFE_VERSION_STRING); + CFE_EVS_SendEvent(CFE_SB_INIT_EID, CFE_EVS_EventType_INFORMATION, "cFE SB Initialized: %s", VersionString); if (Status != CFE_SUCCESS) { CFE_ES_WriteToSysLog("%s: Error sending init event:RC=0x%08X\n", __func__, (unsigned int)Status); @@ -285,7 +289,10 @@ int32 CFE_SB_AppInit(void) *-----------------------------------------------------------------*/ int32 CFE_SB_NoopCmd(const CFE_SB_NoopCmd_t *data) { - CFE_EVS_SendEvent(CFE_SB_CMD0_RCVD_EID, CFE_EVS_EventType_INFORMATION, "No-op Cmd Rcvd: %s", CFE_VERSION_STRING); + char VersionString[CFE_CFG_MAX_VERSION_STR_LEN]; + CFE_Config_GetVersionString(VersionString, CFE_CFG_MAX_VERSION_STR_LEN, "cFE", + CFE_SRC_VERSION, CFE_BUILD_CODENAME, CFE_LAST_OFFICIAL); + CFE_EVS_SendEvent(CFE_SB_CMD0_RCVD_EID, CFE_EVS_EventType_INFORMATION, "No-op Cmd Rcvd: %s", VersionString); CFE_SB_Global.HKTlmMsg.Payload.CommandCounter++; return CFE_SUCCESS; diff --git a/modules/tbl/fsw/src/cfe_tbl_task.c b/modules/tbl/fsw/src/cfe_tbl_task.c index fa055b8f2..63830fcdc 100644 --- a/modules/tbl/fsw/src/cfe_tbl_task.c +++ b/modules/tbl/fsw/src/cfe_tbl_task.c @@ -32,6 +32,7 @@ */ #include "cfe_tbl_module_all.h" #include "cfe_version.h" +#include "cfe_config.h" /* For version string construction */ #include "cfe_tbl_verify.h" #include @@ -110,6 +111,7 @@ void CFE_TBL_TaskMain(void) int32 CFE_TBL_TaskInit(void) { int32 Status; + char VersionString[CFE_CFG_MAX_VERSION_STR_LEN]; /* ** Initialize global Table Services data @@ -162,8 +164,10 @@ int32 CFE_TBL_TaskInit(void) /* ** Task startup event message */ + CFE_Config_GetVersionString(VersionString, CFE_CFG_MAX_VERSION_STR_LEN, "cFE", + CFE_SRC_VERSION, CFE_BUILD_CODENAME, CFE_LAST_OFFICIAL); Status = CFE_EVS_SendEvent(CFE_TBL_INIT_INF_EID, CFE_EVS_EventType_INFORMATION, "cFE TBL Initialized: %s", - CFE_VERSION_STRING); + VersionString); if (Status != CFE_SUCCESS) { diff --git a/modules/tbl/fsw/src/cfe_tbl_task_cmds.c b/modules/tbl/fsw/src/cfe_tbl_task_cmds.c index 3f4ef27c9..28d87c652 100644 --- a/modules/tbl/fsw/src/cfe_tbl_task_cmds.c +++ b/modules/tbl/fsw/src/cfe_tbl_task_cmds.c @@ -32,6 +32,7 @@ */ #include "cfe_tbl_module_all.h" #include "cfe_version.h" +#include "cfe_config.h" /* For version string construction */ #include @@ -310,8 +311,12 @@ void CFE_TBL_GetTblRegData(void) *-----------------------------------------------------------------*/ int32 CFE_TBL_NoopCmd(const CFE_TBL_NoopCmd_t *data) { + char VersionString[CFE_CFG_MAX_VERSION_STR_LEN]; + /* Acknowledge receipt of NOOP with Event Message */ - CFE_EVS_SendEvent(CFE_TBL_NOOP_INF_EID, CFE_EVS_EventType_INFORMATION, "No-op Cmd Rcvd: %s", CFE_VERSION_STRING); + CFE_Config_GetVersionString(VersionString, CFE_CFG_MAX_VERSION_STR_LEN, "cFE", + CFE_SRC_VERSION, CFE_BUILD_CODENAME, CFE_LAST_OFFICIAL); + CFE_EVS_SendEvent(CFE_TBL_NOOP_INF_EID, CFE_EVS_EventType_INFORMATION, "No-op Cmd Rcvd: %s", VersionString); return CFE_TBL_INC_CMD_CTR; } diff --git a/modules/time/fsw/src/cfe_time_task.c b/modules/time/fsw/src/cfe_time_task.c index 2453a5044..9cbc579ae 100644 --- a/modules/time/fsw/src/cfe_time_task.c +++ b/modules/time/fsw/src/cfe_time_task.c @@ -32,6 +32,7 @@ */ #include "cfe_time_module_all.h" #include "cfe_version.h" +#include "cfe_config.h" /* For version string construction */ #include "cfe_time_verify.h" /* @@ -127,6 +128,7 @@ int32 CFE_TIME_TaskInit(void) int32 OsStatus; osal_id_t TimeBaseId; osal_id_t TimerId; + char VersionString[CFE_CFG_MAX_VERSION_STR_LEN]; Status = CFE_EVS_Register(NULL, 0, 0); if (Status != CFE_SUCCESS) @@ -259,8 +261,10 @@ int32 CFE_TIME_TaskInit(void) return Status; } + CFE_Config_GetVersionString(VersionString, CFE_CFG_MAX_VERSION_STR_LEN, "cFE", + CFE_SRC_VERSION, CFE_BUILD_CODENAME, CFE_LAST_OFFICIAL); Status = CFE_EVS_SendEvent(CFE_TIME_INIT_EID, CFE_EVS_EventType_INFORMATION, "cFE TIME Initialized: %s", - CFE_VERSION_STRING); + VersionString); if (Status != CFE_SUCCESS) { CFE_ES_WriteToSysLog("%s: Error sending init event:RC=0x%08X\n", __func__, (unsigned int)Status); @@ -443,9 +447,13 @@ int32 CFE_TIME_ToneSendCmd(const CFE_TIME_FakeToneCmd_t *data) *-----------------------------------------------------------------*/ int32 CFE_TIME_NoopCmd(const CFE_TIME_NoopCmd_t *data) { + char VersionString[CFE_CFG_MAX_VERSION_STR_LEN]; + CFE_TIME_Global.CommandCounter++; - CFE_EVS_SendEvent(CFE_TIME_NOOP_EID, CFE_EVS_EventType_INFORMATION, "No-op Cmd Rcvd: %s", CFE_VERSION_STRING); + CFE_Config_GetVersionString(VersionString, CFE_CFG_MAX_VERSION_STR_LEN, "cFE", + CFE_SRC_VERSION, CFE_BUILD_CODENAME, CFE_LAST_OFFICIAL); + CFE_EVS_SendEvent(CFE_TIME_NOOP_EID, CFE_EVS_EventType_INFORMATION, "No-op Cmd Rcvd: %s", VersionString); return CFE_SUCCESS; }