From dd43aafed4642ef0d643a1f363922bd674d53dda Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Tue, 19 Dec 2023 09:32:33 -0500 Subject: [PATCH] Fix #2483, clean up and move table build scripts Clean up the logic associated with building tables. In particular, the real function that sets up the intermediate library and targets is moved to be part of the table tool itself (elf2cfetbl) rather than part of CFE. This way, its implementation can change based on the way the tool works, rather than trying to make everything work like elf2cfetbl does. --- cmake/arch_build.cmake | 124 +---- cmake/generate_git_module_version.cmake | 6 +- cmake/mission_build.cmake | 140 +++-- cmake/sample_defs/eds/cfe-topicids.xml | 117 ++++ cmake/sample_defs/eds/config.xml | 561 ++++++++++++++++++++ cmake/tables/elf2cfetbl_rules.mk | 10 - cmake/tables/generate_elf_table_rules.cmake | 34 -- cmake/tables/table_rule_template.d.in | 10 - cmake/tables/tabletool_rule.mk | 15 - 9 files changed, 782 insertions(+), 235 deletions(-) create mode 100644 cmake/sample_defs/eds/cfe-topicids.xml create mode 100644 cmake/sample_defs/eds/config.xml delete mode 100644 cmake/tables/elf2cfetbl_rules.mk delete mode 100644 cmake/tables/generate_elf_table_rules.cmake delete mode 100644 cmake/tables/table_rule_template.d.in delete mode 100644 cmake/tables/tabletool_rule.mk 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)/$(<)"