Skip to content

Commit

Permalink
Merge pull request nasa#615 from nasa/integration-candidate
Browse files Browse the repository at this point in the history
Integration Candidate 2020-04-08
  • Loading branch information
astrogeco authored Apr 20, 2020
2 parents 60a5f65 + 3b44a41 commit 0648a47
Show file tree
Hide file tree
Showing 11 changed files with 138 additions and 68 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ This repository contains NASA's Core Flight Executive (cFE), which is a framewor
This is a collection of services and associated framework to be located in the `cfe` subdirectory of a cFS Mission Tree. The Core Flight System is bundled at https://github.com/nasa/cFS, which includes build and execution instructions.

## Version Notes

- 6.7.13: DEVELOPMENT
- RTEMS builds without error.
- Use the INTERFACE_COMPILE_DEFINITIONS and INTERFACE_INCLUDE_DIRECTORIES properties from the osal target and apply them to the entire CFE build as a directory-scope property. No impact until these are set in OSAL.
- Minor other updates (see https://github.com/nasa/cFE/pull/615)
- 6.7.12: DEVELOPMENT
- Cmd code (and checksum) are always in the same place (matches GSFC spec for command secondary header)
- No impact to behavior. Previously the perf log dump file frequently contained errors due to out of order or otherwise corrupted entries, which is now fixed.
Expand Down
14 changes: 14 additions & 0 deletions cmake/arch_build.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,20 @@ function(process_arch SYSVAR)
include_directories(${MISSION_SOURCE_DIR}/cfe/fsw/cfe-core/src/inc)
include_directories(${MISSION_SOURCE_DIR}/cfe/cmake/target/inc)

# propagate any OSAL interface compile definitions and include directories to this build
# This is set as a directory property here at the top level so it will apply to all code.
# This includes MODULE libraries that do not directly/statically link with OSAL but still
# should be compiled with these flags.
get_target_property(OSAL_COMPILE_DEFINITIONS osal INTERFACE_COMPILE_DEFINITIONS)
get_target_property(OSAL_INCLUDE_DIRECTORIES osal INTERFACE_INCLUDE_DIRECTORIES)

if (OSAL_COMPILE_DEFINITIONS)
set_directory_properties(PROPERTIES COMPILE_DEFINITIONS "${OSAL_COMPILE_DEFINITIONS}")
endif (OSAL_COMPILE_DEFINITIONS)
if (OSAL_INCLUDE_DIRECTORIES)
include_directories(${OSAL_INCLUDE_DIRECTORIES})
endif (OSAL_INCLUDE_DIRECTORIES)

# Append the PSP and OSAL selections to the Doxyfile so it will be included
# in the generated documentation automatically.
# Also extract the "-D" options within CFLAGS and inform Doxygen about these
Expand Down
64 changes: 43 additions & 21 deletions cmake/sample_defs/toolchain-i686-rtems4.11.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,41 @@
# the pc-rtems PSP.

# Basic cross system configuration
SET(RTEMS_TOOLS_TOP "/opt/rtems-4.11")
SET(RTEMS_BSP_TOP "/opt/x-tools/rtems-4.11" CACHE PATH "Rtems install directory")
set(CMAKE_SYSTEM_NAME RTEMS)
set(CMAKE_SYSTEM_PROCESSOR i386)
set(CMAKE_SYSTEM_VERSION 4.11)

SET(CMAKE_SYSTEM_NAME RTEMS)
SET(CMAKE_SYSTEM_VERSION 1)
SET(CMAKE_SYSTEM_PROCESSOR i686)
# The TOOLS and BSP are allowed to be installed in different locations.
# If the README was followed they will both be installed under $HOME
# By default it is assumed the BSP is installed to the same directory as the tools
SET(RTEMS_TOOLS_PREFIX "$ENV{HOME}/rtems-${CMAKE_SYSTEM_VERSION}" CACHE PATH
"RTEMS tools install directory")
SET(RTEMS_BSP_PREFIX "${RTEMS_TOOLS_PREFIX}" CACHE PATH
"RTEMS BSP install directory")

# specify the cross compiler
SET(CMAKE_C_COMPILER ${RTEMS_TOOLS_TOP}/bin/i386-rtems4.11-gcc)
SET(CMAKE_CXX_COMPILER ${RTEMS_TOOLS_TOP}/bin/i386-rtems4.11-g++)
SET(CMAKE_LINKER ${RTEMS_TOOLS_TOP}/bin/i386-rtems4.11-ld)
# The BSP that will be used for this build
set(RTEMS_BSP "pc686")

# where is the target environment
SET(CMAKE_FIND_ROOT_PATH ${RTEMS_TOOLS_TOP}/i386-rtems4.11
${RTEMS_TOOLS_TOP}/lib/gcc/i386-rtems4.11/4.8.2 ${RTEMS_BSP_TOP}/i386-rtems4.11/pc686)
# specify the cross compiler - adjust accord to compiler installation
# This uses the compiler-wrapper toolchain that buildroot produces
SET(SDKHOSTBINDIR "${RTEMS_TOOLS_PREFIX}/bin")
set(TARGETPREFIX "${CMAKE_SYSTEM_PROCESSOR}-rtems${CMAKE_SYSTEM_VERSION}-")
set(RTEMS_BSP_C_FLAGS "-march=i686 -mtune=i686 -fno-common")
set(RTEMS_BSP_CXX_FLAGS ${RTEMS_BSP_C_FLAGS})

SET(CMAKE_C_COMPILER "${RTEMS_TOOLS_PREFIX}/bin/${TARGETPREFIX}gcc")
SET(CMAKE_CXX_COMPILER "${RTEMS_TOOLS_PREFIX}/bin/${TARGETPREFIX}g++")
SET(CMAKE_LINKER "${RTEMS_TOOLS_PREFIX}/bin/${TARGETPREFIX}ld")
SET(CMAKE_ASM_COMPILER "${RTEMS_TOOLS_PREFIX}/bin/${TARGETPREFIX}as")
SET(CMAKE_STRIP "${RTEMS_TOOLS_PREFIX}/bin/${TARGETPREFIX}strip")
SET(CMAKE_NM "${RTEMS_TOOLS_PREFIX}/bin/${TARGETPREFIX}nm")
SET(CMAKE_AR "${RTEMS_TOOLS_PREFIX}/bin/${TARGETPREFIX}ar")
SET(CMAKE_OBJDUMP "${RTEMS_TOOLS_PREFIX}/bin/${TARGETPREFIX}objdump")
SET(CMAKE_OBJCOPY "${RTEMS_TOOLS_PREFIX}/bin/${TARGETPREFIX}objcopy")

# Note that CEXP is not a shared library loader - it will not support code compiled with -fPIC
# Also exception handling is very iffy. These two options disable eh_frame creation.
set(CMAKE_C_COMPILE_OPTIONS_PIC -fno-exceptions -fno-asynchronous-unwind-tables)

# search for programs in the build host directories
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
Expand All @@ -41,14 +61,16 @@ SET(CFE_SYSTEM_PSPNAME pc-rtems)
SET(OSAL_SYSTEM_BSPTYPE pc-rtems)
SET(OSAL_SYSTEM_OSTYPE rtems)

# Forces the "Init" symbol to be undefined so it can be defined in a library
SET(CFE_ENTRY_SYM Init)

SET(CMAKE_C_FLAGS_INIT "-march=i686 -B${RTEMS_BSP_TOP}/i386-rtems4.11/pc686/lib"
CACHE STRING "C Flags required by platform")
# Info regarding the RELOCADDR:
#+--------------------------------------------------------------------------+
#| Set the value of RELOCADDR to the address where you want your image to
#| load. If you'll be using GRUB to load the images it will have to be >=
#| 0x100000 (1024K). If you are using NetBoot to load the images it can be
#| >= 0x10000 (64K) AND <= 0x97C00 (607K) OR >= 0x100000 (1024K). The memory
#| top is of course another limit. Make sure there is enough space before the
#| upper memory limits for the image and the memory allocated by it to fit.
#| Make sure the value you choose is aligned to 4 bytes.
#+--------------------------------------------------------------------------+
set(RTEMS_RELOCADDR 0x00100000)

# For RTEMS also install rtems-grub.cfg that allows booting using QEMU
macro(target_add_hook TGTNAME)
install(FILES ${MISSION_DEFS}/${TGTNAME}_rtems-grub.cfg DESTINATION ${TGTNAME} RENAME rtems-grub.cfg)
endmacro()

23 changes: 23 additions & 0 deletions fsw/cfe-core/src/inc/cfe_sb.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,15 @@

#define CFE_SB_INVALID_MSG_ID 0xFFFF /**< \brief Initializer for #CFE_SB_MsgId_t values that will not match any real MsgId */

/**
* \defgroup CFESBPktTypeDefs cFE SB Packet Type Defines
* \{
*/
#define CFE_SB_PKTTYPE_INVALID 0 /**< \brief #CFE_SB_GetPktType response if message type can not be determined */
#define CFE_SB_PKTTYPE_CMD 1 /**< \brief #CFE_SB_GetPktType response for command packets */
#define CFE_SB_PKTTYPE_TLM 2 /**< \brief #CFE_SB_GetPktType response for telemetry packets */
/** \} */

/*
** Macro Definitions
*/
Expand Down Expand Up @@ -1358,6 +1367,20 @@ static inline CFE_SB_MsgId_t CFE_SB_ValueToMsgId(CFE_SB_MsgId_Atom_t MsgIdValue)
{
return MsgIdValue;
}

/*****************************************************************************/
/**
* \brief Identifies packet type given message ID
*
* Provides the packet type associated with the given message ID
*
* \return Packet type
* \retval #CFE_SB_PKTTYPE_CMD Command packet type
* \retval #CFE_SB_PKTTYPE_TLM Telemetry packet type
* \retval #CFE_SB_PKTTYPE_INVALID Invalid/unknown packet type
*/
uint32 CFE_SB_GetPktType(CFE_SB_MsgId_t MsgId);

/**@}*/

#endif /* _cfe_sb_ */
Expand Down
2 changes: 1 addition & 1 deletion fsw/cfe-core/src/inc/cfe_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
*/
#define CFE_MAJOR_VERSION 6
#define CFE_MINOR_VERSION 7
#define CFE_REVISION 12
#define CFE_REVISION 13


#endif /* _cfe_version_ */
2 changes: 1 addition & 1 deletion fsw/cfe-core/src/sb/cfe_sb_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -1296,7 +1296,7 @@ int32 CFE_SB_SendMsgFull(CFE_SB_Msg_t *MsgPtr,
RtgTblPtr = CFE_SB_GetRoutePtrFromIdx(RtgTblIdx);

/* For Tlm packets, increment the seq count if requested */
if((CFE_SB_GetPktType(MsgId)==CFE_SB_TLM) &&
if((CFE_SB_GetPktType(MsgId)==CFE_SB_PKTTYPE_TLM) &&
(TlmCntIncrements==CFE_SB_INCREMENT_TLM)){
RtgTblPtr->SeqCnt++;
CFE_SB_SetMsgSeqCnt((CFE_SB_Msg_t *)BufDscPtr->Buffer,
Expand Down
38 changes: 37 additions & 1 deletion fsw/cfe-core/src/sb/cfe_sb_msg_id_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
** combination of bits from the primary header SID (StreamId) and the secondary header APID Qualifiers
**
** Implementation is based on CCSDS Space Packet Protocol 133.0.B-1 with Technical Corrigendum 2, September 2012
** The extended secondary header is expected in an upcoming revision of 133.0.B-1
** Multi-mission Interoperable extended secondary headers should be registered in Space
** Assigned Numbers Authority (SANA). The process for SANA registration is documented in
** 133.0.B-2. Mission specific headers need not be registered
**
** For MESSAGE_FORMAT_IS_CCSDS_VER_2 the default setup will combine:
** 1 bit for the command/telemetry flag
Expand Down Expand Up @@ -185,3 +187,37 @@ void CFE_SB_SetMsgId(CFE_SB_MsgPtr_t MsgPtr,

#endif
}/* end CFE_SB_SetMsgId */

/*
* Function: CFE_SB_GetPktType - See API and header file for details
*/
uint32 CFE_SB_GetPktType(CFE_SB_MsgId_t MsgId)
{

CFE_SB_MsgId_Atom_t Val = MsgId;
uint8 PktType;

if (CFE_SB_IsValidMsgId(MsgId))
{
#ifndef MESSAGE_FORMAT_IS_CCSDS_VER_2
if (CFE_TST(Val,12))
{
PktType = CFE_SB_PKTTYPE_CMD;
} else {
PktType = CFE_SB_PKTTYPE_TLM;
}
#else
if (CFE_SB_RD_TYPE_FROM_MSGID(Val) == 1)
{
PktType = CFE_SB_PKTTYPE_CMD;
} else {
PktType = CFE_SB_PKTTYPE_TLM;
}
#endif /* MESSAGE_FORMAT_IS_CCSDS_VER_2 */
} else {
PktType = CFE_SB_PKTTYPE_INVALID;
}

return PktType;

}/* end CFE_SB_GetPktType */
30 changes: 0 additions & 30 deletions fsw/cfe-core/src/sb/cfe_sb_priv.c
Original file line number Diff line number Diff line change
Expand Up @@ -659,36 +659,6 @@ char *CFE_SB_GetAppTskName(uint32 TaskId,char *FullName){

}/* end CFE_SB_GetAppTskName */


/******************************************************************************
** Function: CFE_SB_GetPktType()
**
** Purpose:
** For CCSDS packets, this function returns the state of the cmd/tlm bit(12).
** For cmd pkts, the state is 1. For tlm pkts, the state is 0.
**
** Arguments:
**
** Return:
** None
*/
uint8 CFE_SB_GetPktType(CFE_SB_MsgId_t MsgId)
{

#ifdef MESSAGE_FORMAT_IS_CCSDS
CFE_SB_MsgId_Atom_t Val = MsgId;

#ifndef MESSAGE_FORMAT_IS_CCSDS_VER_2
return CFE_TST(Val,12);
#else
return CFE_SB_RD_TYPE_FROM_MSGID(Val);
#endif /* MESSAGE_FORMAT_IS_CCSDS_VER_2 */

#endif /* MESSAGE_FORMAT_IS_CCSDS */

}/* end CFE_SB_GetPktType */


/******************************************************************************
** Function: CFE_SB_RequestToSendEvent()
**
Expand Down
4 changes: 0 additions & 4 deletions fsw/cfe-core/src/sb/cfe_sb_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,6 @@
#define CFE_SB_GLOBAL 0
#define CFE_SB_LOCAL 1

#define CFE_SB_TLM 0
#define CFE_SB_CMD 1

#define CFE_SB_SEND_ZEROCOPY 0
#define CFE_SB_SEND_ONECOPY 1

Expand Down Expand Up @@ -391,7 +388,6 @@ int32 CFE_SB_ZeroCopyReleaseAppId(uint32 AppId);
int32 CFE_SB_DecrBufUseCnt(CFE_SB_BufferD_t *bd);
int32 CFE_SB_ValidateMsgId(CFE_SB_MsgId_t MsgId);
int32 CFE_SB_ValidatePipeId(CFE_SB_PipeId_t PipeId);
uint8 CFE_SB_GetPktType(CFE_SB_MsgId_t MsgId);
void CFE_SB_IncrCmdCtr(int32 status);
void CFE_SB_FileWriteByteCntErr(const char *Filename,uint32 Requested,uint32 Actual);
void CFE_SB_SetSubscriptionReporting(uint32 state);
Expand Down
15 changes: 6 additions & 9 deletions fsw/cfe-core/unit-test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,13 @@ foreach(MODULE ${CFE_CORE_MODULES})

# Compile the unit(s) under test as an object library
# this allows easy configuration of special flags and include paths
# in particular this should use the UT_C_FLAGS for coverage instrumentation
# in particular this should use the UT_COVERAGE_COMPILE_FLAGS for coverage instrumentation
add_library(ut_${UT_TARGET_NAME}_object OBJECT
${CFE_MODULE_FILES})

# Apply the UT_C_FLAGS to the units under test
# Apply the UT_COVERAGE_COMPILE_FLAGS to the units under test
# This should enable coverage analysis on platforms that support this
set_target_properties(ut_${UT_TARGET_NAME}_object PROPERTIES
COMPILE_FLAGS "${UT_C_FLAGS}")
target_compile_options(ut_${UT_TARGET_NAME}_object PRIVATE ${UT_COVERAGE_COMPILE_FLAGS})

# For this object target only, the "override" includes should be injected
# into the include path BEFORE any other include path. This is so the
Expand All @@ -61,16 +60,14 @@ foreach(MODULE ${CFE_CORE_MODULES})
${MODULE}_UT.c
$<TARGET_OBJECTS:ut_${UT_TARGET_NAME}_object>)

# Also add the UT_COVERAGE_LINK_FLAGS to the link command
# This should enable coverage analysis on platforms that support this
target_link_libraries(${UT_TARGET_NAME}_UT
${UT_COVERAGE_LINK_FLAGS}
ut_${CFE_CORE_TARGET}_support
ut_cfe-core_stubs
ut_assert)

# Also add the C FLAGS to the link command
# This should enable coverage analysis on platforms that support this
set_target_properties(${UT_TARGET_NAME}_UT PROPERTIES
LINK_FLAGS "${UT_C_FLAGS}")

add_test(${UT_TARGET_NAME}_UT ${UT_TARGET_NAME}_UT)
install(TARGETS ${UT_TARGET_NAME}_UT DESTINATION ${TGTNAME}/${UT_INSTALL_SUBDIR})
endforeach(MODULE ${CFE_CORE_MODULES})
Expand Down
9 changes: 9 additions & 0 deletions fsw/cfe-core/ut-stubs/ut_sb_stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -873,3 +873,12 @@ void CFE_SB_SetTotalMsgLength (CFE_SB_MsgPtr_t MsgPtr,uint16 TotalLength)
UT_Stub_CopyFromLocal(UT_KEY(CFE_SB_SetTotalMsgLength), &TotalLength, sizeof(TotalLength));
}

uint32 CFE_SB_GetPktType(CFE_SB_MsgId_t MsgId)
{
int32 status;

status = UT_DEFAULT_IMPL(CFE_SB_GetPktType);

return status;
}

0 comments on commit 0648a47

Please sign in to comment.