Skip to content

Commit

Permalink
Merge pull request #1568 from nasa/integration-candidate
Browse files Browse the repository at this point in the history
cFE Integration candidate: 2021-05-25
  • Loading branch information
astrogeco authored May 26, 2021
2 parents 8443a46 + 6428e82 commit 176e3df
Show file tree
Hide file tree
Showing 35 changed files with 311 additions and 493 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@ The detailed cFE user's guide can be viewed at <https://github.com/nasa/cFS/blob

## Version History

### Development Build: v6.8.0-rc1+dev593

- Uses `int` with %d conversions inUtAssert_True and UtPrintf for platform portability.
- Specifying the special string NULL as the entry point in a startup script results in no entry point being called for the library. Equivalent to leaving the field empty.
- [build system] Adds a hook for an `install_custom.cmake` script that can added to a CPU-specific subdirectory under the "defs" directory. This hook can perform extra installation steps for custom implementations. Tweaks the `add_cfe_tables` function so it can be called from the `install_custom.cmake` script to generate additional table binaries for that CPU.
- [build system] `add_cfe_tables` now uses the "APP_NAME" parameter to associate the table files with the app library, so the same set of include files can be used. Still allows any unique string to be used as "APP_NAME" for backward compatibility. The script will now generate a "Note" message to the user if it does not match an application name.
- If the multiple table feature is used, it actually needs to match the application name, or else the include paths may be incomplete.
- Removes discrepancies (return type, parameter names, etc) between function prototypes and implementation. Also fixes some but not all use of CFE_Status_t in the implementations. Updates ut-stubs accordingly.
- See <>https://github.com/nasa/cFE/pull/1568> and <https://github.com/nasa/cFS/pull/260>


### Development Build: v6.8.0-rc1+dev580

- Adds `CFE_MSG_GetNextSequenceCount` so the auto-increment of the local sequence counter works when sending tlm (and increment is enabled). Updates unit tests and adds the old-style stub. The unit tests check for the correct rollover behavior.Sequence count will roll over based on the mask. Before the fix the sequence counter would "stick" in telemetry until the passed in value rolled over.
Expand Down
165 changes: 93 additions & 72 deletions cmake/arch_build.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -148,80 +148,99 @@ endfunction(add_cfe_app_dependency)
#
function(add_cfe_tables APP_NAME TBL_SRC_FILES)

# 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)

# Create the intermediate table objects using the target compiler,
# then use "elf2cfetbl" to convert to a .tbl file
set(TBL_LIST)
foreach(TBL ${TBL_SRC_FILES} ${ARGN})

# Get name without extension (NAME_WE) and append to list of tables
get_filename_component(TBLWE ${TBL} NAME_WE)

foreach(TGT ${APP_STATIC_TARGET_LIST} ${APP_DYNAMIC_TARGET_LIST})
set(TABLE_DESTDIR "${CMAKE_CURRENT_BINARY_DIR}/tables_${TGT}")
file(MAKE_DIRECTORY ${TABLE_DESTDIR})
list(APPEND TBL_LIST "${TABLE_DESTDIR}/${TBLWE}.tbl")

# 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.
if (EXISTS "${MISSION_DEFS}/tables/${TGT}_${TBLWE}.c")
set(TBL_SRC "${MISSION_DEFS}/tables/${TGT}_${TBLWE}.c")
elseif (EXISTS "${MISSION_SOURCE_DIR}/tables/${TGT}_${TBLWE}.c")
set(TBL_SRC "${MISSION_SOURCE_DIR}/tables/${TGT}_${TBLWE}.c")
elseif (EXISTS "${MISSION_DEFS}/tables/${TBLWE}.c")
set(TBL_SRC "${MISSION_DEFS}/tables/${TBLWE}.c")
elseif (EXISTS "${MISSION_SOURCE_DIR}/tables/${TBLWE}.c")
set(TBL_SRC "${MISSION_SOURCE_DIR}/tables/${TBLWE}.c")
elseif (EXISTS "${MISSION_DEFS}/${TGT}/tables/${TBLWE}.c")
set(TBL_SRC "${MISSION_DEFS}/${TGT}/tables/${TBLWE}.c")
elseif (IS_ABSOLUTE "${TBL}")
set(TBL_SRC "${TBL}")
else()
set(TBL_SRC "${CMAKE_CURRENT_SOURCE_DIR}/${TBL}")
endif()
if (TGTNAME)
set (TABLE_TGTLIST ${TGTNAME})
elseif (TARGET ${APP_NAME})
set (TABLE_TGTLIST ${TGTLIST_${APP_NAME}})
else()
# The first parameter should match the name of an app that was
# previously defined using "add_cfe_app". If target-scope properties
# are used for include directories and compile definitions, this is needed
# to compile tables with the same include path/definitions as the app has.
# However historically this could have been any string, which still works
# if directory-scope properties are used for includes, so this is not
# an error.
message("NOTE: \"${APP_NAME}\" passed to add_cfe_tables is not a previously-defined application target")
set (TABLE_TGTLIST ${APP_STATIC_TARGET_LIST} ${APP_DYNAMIC_TARGET_LIST})
endif()

if (NOT EXISTS "${TBL_SRC}")
message(FATAL_ERROR "ERROR: No source file for table ${TBLWE}")
else()
message("NOTE: Selected ${TBL_SRC} as source for ${TBLWE}")
endif()
# 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)

# Create the intermediate table objects using the target compiler,
# then use "elf2cfetbl" to convert to a .tbl file
foreach(TBL ${TBL_SRC_FILES} ${ARGN})

# Get name without extension (NAME_WE) and append to list of tables
get_filename_component(TBLWE ${TBL} NAME_WE)

foreach(TGT ${TABLE_TGTLIST})
set(TABLE_LIBNAME "${TGT}_${APP_NAME}_${TBLWE}")
set(TABLE_DESTDIR "${CMAKE_CURRENT_BINARY_DIR}/${TABLE_LIBNAME}")
set(TABLE_BINARY "${TABLE_DESTDIR}/${TBLWE}.tbl")
file(MAKE_DIRECTORY ${TABLE_DESTDIR})

# 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.
if (EXISTS "${MISSION_DEFS}/tables/${TGT}_${TBLWE}.c")
set(TBL_SRC "${MISSION_DEFS}/tables/${TGT}_${TBLWE}.c")
elseif (EXISTS "${MISSION_SOURCE_DIR}/tables/${TGT}_${TBLWE}.c")
set(TBL_SRC "${MISSION_SOURCE_DIR}/tables/${TGT}_${TBLWE}.c")
elseif (EXISTS "${MISSION_DEFS}/${TGT}/tables/${TBLWE}.c")
set(TBL_SRC "${MISSION_DEFS}/${TGT}/tables/${TBLWE}.c")
elseif (EXISTS "${MISSION_DEFS}/tables/${TBLWE}.c")
set(TBL_SRC "${MISSION_DEFS}/tables/${TBLWE}.c")
elseif (EXISTS "${MISSION_SOURCE_DIR}/tables/${TBLWE}.c")
set(TBL_SRC "${MISSION_SOURCE_DIR}/tables/${TBLWE}.c")
elseif (IS_ABSOLUTE "${TBL}")
set(TBL_SRC "${TBL}")
else()
set(TBL_SRC "${CMAKE_CURRENT_SOURCE_DIR}/${TBL}")
endif()

if (NOT EXISTS "${TBL_SRC}")
message(FATAL_ERROR "ERROR: No source file for table ${TBLWE}")
else()
message("NOTE: Selected ${TBL_SRC} as source for ${APP_NAME}.${TBLWE} on ${TGT}")

# NOTE: On newer CMake versions this should become an OBJECT library which makes this simpler.
# On older versions one may not referece 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 ${TBL_SRC})
target_link_libraries(${TABLE_LIBNAME} PRIVATE core_api)
if (TARGET ${APP_NAME})
target_include_directories(${TABLE_LIBNAME} PRIVATE $<TARGET_PROPERTY:${APP_NAME},INCLUDE_DIRECTORIES>)
target_compile_definitions(${TABLE_LIBNAME} PRIVATE $<TARGET_PROPERTY:${APP_NAME},COMPILE_DEFINITIONS>)
endif()

# IMPORTANT: This rule assumes that the output filename of elf2cfetbl matches
# the input file name but with a different extension (.o -> .tbl)
# The actual output filename is embedded in the source file (.c), however
# this must match and if it does not the build will break. That's just the
# way it is, because NO make system supports changing rules based on the
# current content of a dependency (rightfully so).
add_custom_command(
OUTPUT ${TABLE_BINARY}
COMMAND ${CMAKE_COMMAND}
-DCMAKE_AR=${CMAKE_AR}
-DTBLTOOL=${MISSION_BINARY_DIR}/tools/elf2cfetbl/elf2cfetbl
-DLIB=$<TARGET_FILE:${TABLE_LIBNAME}>
-P ${CFE_SOURCE_DIR}/cmake/generate_table.cmake
DEPENDS ${MISSION_BINARY_DIR}/tools/elf2cfetbl/elf2cfetbl ${TABLE_LIBNAME}
WORKING_DIRECTORY ${TABLE_DESTDIR}
)

# Add a custom target to invoke the elf2cfetbl tool to generate the tbl file,
# and install that binary file to the staging area.
add_custom_target(${TABLE_LIBNAME}_tbl ALL DEPENDS ${TABLE_BINARY})
install(FILES ${TABLE_BINARY} DESTINATION ${TGT}/${INSTALL_SUBDIR})
endif()
endforeach()
endforeach()

# NOTE: On newer CMake versions this should become an OBJECT library which makes this simpler.
# On older versions one may not referece 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(${TGT}_${TBLWE}-obj STATIC ${TBL_SRC})
target_link_libraries(${TGT}_${TBLWE}-obj PRIVATE core_api)

# IMPORTANT: This rule assumes that the output filename of elf2cfetbl matches
# the input file name but with a different extension (.o -> .tbl)
# The actual output filename is embedded in the source file (.c), however
# this must match and if it does not the build will break. That's just the
# way it is, because NO make system supports changing rules based on the
# current content of a dependency (rightfully so).
add_custom_command(
OUTPUT "${TABLE_DESTDIR}/${TBLWE}.tbl"
COMMAND ${CMAKE_COMMAND}
-DCMAKE_AR=${CMAKE_AR}
-DTBLTOOL=${MISSION_BINARY_DIR}/tools/elf2cfetbl/elf2cfetbl
-DLIB=$<TARGET_FILE:${TGT}_${TBLWE}-obj>
-P ${CFE_SOURCE_DIR}/cmake/generate_table.cmake
DEPENDS ${MISSION_BINARY_DIR}/tools/elf2cfetbl/elf2cfetbl ${TGT}_${TBLWE}-obj
WORKING_DIRECTORY ${TABLE_DESTDIR}
)
# Create the install targets for all the tables
install(FILES ${TABLE_DESTDIR}/${TBLWE}.tbl DESTINATION ${TGT}/${INSTALL_SUBDIR})
endforeach(TGT ${APP_STATIC_TARGET_LIST} ${APP_DYNAMIC_TARGET_LIST})


endforeach(TBL ${TBL_SRC_FILES} ${ARGN})

# Make a custom target that depends on all the tables
add_custom_target(${APP_NAME}_tables ALL DEPENDS ${TBL_LIST})

endfunction(add_cfe_tables)

Expand Down Expand Up @@ -689,6 +708,8 @@ function(process_arch SYSVAR)
# Target to generate the actual executable file
add_subdirectory(cmake/target ${TGTNAME})

include(${MISSION_DEFS}/${TGTNAME}/install_custom.cmake OPTIONAL)

foreach(INSTFILE ${${TGTNAME}_FILELIST})
if(EXISTS ${MISSION_DEFS}/${TGTNAME}/${INSTFILE})
set(FILESRC ${MISSION_DEFS}/${TGTNAME}/${INSTFILE})
Expand Down
1 change: 1 addition & 0 deletions cmake/generate_table.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ if (NOT RESULT EQUAL 0)
endif()

# Finally invoke the table tool (elf2cfetbl) on the object
message("Executing Process: ${TBLTOOL} ${OBJNAME}")
execute_process(COMMAND ${TBLTOOL} "${OBJNAME}"
RESULT_VARIABLE RESULT
)
Expand Down
3 changes: 2 additions & 1 deletion modules/cfe_testcase/src/es_task_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ void TestCreateChild(void)

OS_TaskDelay(500);

UtAssert_True(countCopy == count || countCopy == count + 1, "countCopy (%d) == count (%d)", countCopy, count);
UtAssert_True(countCopy == count || countCopy == count + 1, "countCopy (%d) == count (%d)", (int)countCopy,
(int)count);
}

void TestExitChild(void)
Expand Down
2 changes: 1 addition & 1 deletion modules/cfe_testcase/src/time_current_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ void TestGetTime(void)
OS_GetLocalTime(&end);

CFE_TIME_Print(timeBuf1, Time);
UtPrintf("The current time is (%d) %s", Time.Seconds, timeBuf1);
UtPrintf("The current time is (%ld) %s", (long)Time.Seconds, timeBuf1);

difference = OS_TimeSubtract(end, start);

Expand Down
36 changes: 18 additions & 18 deletions modules/core_api/fsw/inc/cfe_es.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,14 @@ CFE_Status_t CFE_ES_AppID_ToIndex(CFE_ES_AppId_t AppID, uint32 *Idx);
* back to the original LibID value. The caller should retain the original ID
* for future use.
*
* @param[in] LibID Library ID to convert
* @param[in] LibId Library ID to convert
* @param[out] Idx Buffer where the calculated index will be stored
*
* @return Execution status, see @ref CFEReturnCodes
* @retval #CFE_SUCCESS @copybrief CFE_SUCCESS
* @retval #CFE_ES_ERR_RESOURCEID_NOT_VALID @copybrief CFE_ES_ERR_RESOURCEID_NOT_VALID
*/
int32 CFE_ES_LibID_ToIndex(CFE_ES_LibId_t LibID, uint32 *Idx);
int32 CFE_ES_LibID_ToIndex(CFE_ES_LibId_t LibId, uint32 *Idx);

/**
* @brief Obtain an index value correlating to an ES Task ID
Expand Down Expand Up @@ -162,14 +162,14 @@ CFE_Status_t CFE_ES_TaskID_ToIndex(CFE_ES_TaskId_t TaskID, uint32 *Idx);
* back to the original CounterID value. The caller should retain the original ID
* for future use.
*
* @param[in] CounterID Counter ID to convert
* @param[in] CounterId Counter ID to convert
* @param[out] Idx Buffer where the calculated index will be stored
*
* @return Execution status, see @ref CFEReturnCodes
* @retval #CFE_SUCCESS @copybrief CFE_SUCCESS
* @retval #CFE_ES_ERR_RESOURCEID_NOT_VALID @copybrief CFE_ES_ERR_RESOURCEID_NOT_VALID
*/
CFE_Status_t CFE_ES_CounterID_ToIndex(CFE_ES_CounterId_t CounterID, uint32 *Idx);
CFE_Status_t CFE_ES_CounterID_ToIndex(CFE_ES_CounterId_t CounterId, uint32 *Idx);

/** @} */

Expand Down Expand Up @@ -357,7 +357,7 @@ void CFE_ES_ExitApp(uint32 ExitStatus);
** \par Assumptions, External Events, and Notes:
** None
**
** \param[in] ExitStatus A pointer to a variable containing the Application's
** \param[in] RunStatus A pointer to a variable containing the Application's
** desired run status. Acceptable values are:
** \arg #CFE_ES_RunStatus_APP_RUN - \copybrief CFE_ES_RunStatus_APP_RUN
** \arg #CFE_ES_RunStatus_APP_EXIT - \copybrief CFE_ES_RunStatus_APP_EXIT
Expand All @@ -370,7 +370,7 @@ void CFE_ES_ExitApp(uint32 ExitStatus);
** \sa #CFE_ES_ExitApp
**
******************************************************************************/
bool CFE_ES_RunLoop(uint32 *ExitStatus);
bool CFE_ES_RunLoop(uint32 *RunStatus);

/*****************************************************************************/
/**
Expand Down Expand Up @@ -1029,9 +1029,9 @@ void CFE_ES_ProcessAsyncEvent(void);
** This is indicated by a #CFE_SUCCESS return code, and in this case the calling application should
** ensure that it also calls CFE_ES_CopyToCDS() to fill the block with valid data.
**
** \param[in, out] HandlePtr Pointer Application's variable that will contain the CDS Memory Block Handle.
** HandlePtr is the handle of the CDS block that can be used in
** #CFE_ES_CopyToCDS and #CFE_ES_RestoreFromCDS.
** \param[in, out] CDSHandlePtr Pointer Application's variable that will contain the CDS Memory Block Handle.
** HandlePtr is the handle of the CDS block that can be used in
** #CFE_ES_CopyToCDS and #CFE_ES_RestoreFromCDS.
**
** \param[in] BlockSize The number of bytes needed in the CDS.
**
Expand All @@ -1050,7 +1050,7 @@ void CFE_ES_ProcessAsyncEvent(void);
** \sa #CFE_ES_CopyToCDS, #CFE_ES_RestoreFromCDS
**
******************************************************************************/
CFE_Status_t CFE_ES_RegisterCDS(CFE_ES_CDSHandle_t *HandlePtr, size_t BlockSize, const char *Name);
CFE_Status_t CFE_ES_RegisterCDS(CFE_ES_CDSHandle_t *CDSHandlePtr, size_t BlockSize, const char *Name);

/*****************************************************************************/
/**
Expand Down Expand Up @@ -1311,7 +1311,7 @@ int32 CFE_ES_PoolDelete(CFE_ES_MemHandle_t PoolID);
** \param[in, out] BufPtr A pointer to the Application's pointer in which will be stored the address of the
** allocated memory buffer. *BufPtr is the address of the requested buffer.
**
** \param[in] PoolID The handle to the memory pool as returned by #CFE_ES_PoolCreate or #CFE_ES_PoolCreateNoSem.
** \param[in] Handle The handle to the memory pool as returned by #CFE_ES_PoolCreate or #CFE_ES_PoolCreateNoSem.
**
** \param[in] Size The size of the buffer requested. NOTE: The size allocated may be larger.
**
Expand All @@ -1324,7 +1324,7 @@ int32 CFE_ES_PoolDelete(CFE_ES_MemHandle_t PoolID);
*#CFE_ES_GetPoolBufInfo
**
******************************************************************************/
int32 CFE_ES_GetPoolBuf(CFE_ES_MemPoolBuf_t *BufPtr, CFE_ES_MemHandle_t PoolID, size_t Size);
int32 CFE_ES_GetPoolBuf(CFE_ES_MemPoolBuf_t *BufPtr, CFE_ES_MemHandle_t Handle, size_t Size);

/*****************************************************************************/
/**
Expand All @@ -1336,9 +1336,9 @@ int32 CFE_ES_GetPoolBuf(CFE_ES_MemPoolBuf_t *BufPtr, CFE_ES_MemHandle_t PoolID,
** \par Assumptions, External Events, and Notes:
** None
**
** \param[in] PoolID The handle to the memory pool as returned by #CFE_ES_PoolCreate or #CFE_ES_PoolCreateNoSem.
** \param[in] Handle The handle to the memory pool as returned by #CFE_ES_PoolCreate or #CFE_ES_PoolCreateNoSem.
**
** \param[in] BufPtr A pointer to the memory buffer to provide status for.
** \param[in] BufPtr A pointer to the memory buffer to provide status for.
**
** \return Execution status, see \ref CFEReturnCodes
** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS
Expand All @@ -1350,7 +1350,7 @@ int32 CFE_ES_GetPoolBuf(CFE_ES_MemPoolBuf_t *BufPtr, CFE_ES_MemHandle_t PoolID,
*#CFE_ES_PutPoolBuf
**
******************************************************************************/
CFE_Status_t CFE_ES_GetPoolBufInfo(CFE_ES_MemHandle_t PoolID, CFE_ES_MemPoolBuf_t BufPtr);
CFE_Status_t CFE_ES_GetPoolBufInfo(CFE_ES_MemHandle_t Handle, CFE_ES_MemPoolBuf_t BufPtr);

/*****************************************************************************/
/**
Expand All @@ -1362,9 +1362,9 @@ CFE_Status_t CFE_ES_GetPoolBufInfo(CFE_ES_MemHandle_t PoolID, CFE_ES_MemPoolBuf_
** \par Assumptions, External Events, and Notes:
** None
**
** \param[in] PoolID The handle to the memory pool as returned by #CFE_ES_PoolCreate or #CFE_ES_PoolCreateNoSem.
** \param[in] Handle The handle to the memory pool as returned by #CFE_ES_PoolCreate or #CFE_ES_PoolCreateNoSem.
**
** \param[in] BufPtr A pointer to the memory buffer to be released.
** \param[in] BufPtr A pointer to the memory buffer to be released.
**
** \return Bytes released, or error code \ref CFEReturnCodes
** \retval #CFE_ES_ERR_RESOURCEID_NOT_VALID \copybrief CFE_ES_ERR_RESOURCEID_NOT_VALID
Expand All @@ -1374,7 +1374,7 @@ CFE_Status_t CFE_ES_GetPoolBufInfo(CFE_ES_MemHandle_t PoolID, CFE_ES_MemPoolBuf_
*#CFE_ES_GetPoolBufInfo
**
******************************************************************************/
int32 CFE_ES_PutPoolBuf(CFE_ES_MemHandle_t PoolID, CFE_ES_MemPoolBuf_t BufPtr);
int32 CFE_ES_PutPoolBuf(CFE_ES_MemHandle_t Handle, CFE_ES_MemPoolBuf_t BufPtr);

/*****************************************************************************/
/**
Expand Down
Loading

0 comments on commit 176e3df

Please sign in to comment.