diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 000000000..2da34ba85 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,3 @@ +# Contributing Guide + +Please see our [top-level contributing guide](https://github.com/nasa/cFS/blob/main/CONTRIBUTING.md) for more information on how to contribute. \ No newline at end of file diff --git a/README.md b/README.md index baad5e009..fc7e8f1ec 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,19 @@ The detailed cFE user's guide can be viewed at with " in local #includes +- Adds CONTRIBUING.md that links to the main cFS contributing guide. +- See + ### Development Build: v6.8.0-rc1+dev412 - Apply standard code style and format diff --git a/cmake/target/inc/target_config.h b/cmake/target/inc/target_config.h index a256315bd..495036318 100644 --- a/cmake/target/inc/target_config.h +++ b/cmake/target/inc/target_config.h @@ -34,8 +34,8 @@ #ifndef TARGET_CONFIG_H_ #define TARGET_CONFIG_H_ -#include -#include +#include "common_types.h" +#include "cfe_psp_configdata.h" /** * Prototype for the main system entry function implemented in CFE ES diff --git a/docs/cFE Application Developers Guide.md b/docs/cFE Application Developers Guide.md index 7af4c8ab3..28ae5a10f 100644 --- a/docs/cFE Application Developers Guide.md +++ b/docs/cFE Application Developers Guide.md @@ -488,12 +488,12 @@ deciding on whether to create multiple Applications versus a single Application with multiple Tasks, the Application Developer should keep in mind these facts: -- Child Tasks can only execute at a priority equal to or less than the - priority of the Application's Main Task. +- When the Application exits it is the responsiabilty of the + Main Task to safely stop all of its Child Tasks. - If the Main Task of an Application is stopped, either through detection of an exception or via command, all Child Tasks are also - stopped. + forcibly stopped in an unsafe manner. Child Tasks can be useful in both "Software Only" and "Hardware Servicing" applications. @@ -1393,6 +1393,9 @@ on the Software Bus. Depending on the implementation, different ranges and values are supported, and the values effect the message header differently. +If you are using the default, MsgID maps directly to the CCSDS Stream ID. +When using the default, for commands use 0x18xx and telemetry use 0x08xx + ### 6.1.2 Pipes The destinations to which SB Messages are sent are called *pipes*. These diff --git a/modules/cfe_assert/inc/cfe_assert.h b/modules/cfe_assert/inc/cfe_assert.h index 8dde70a4f..89f0d3d6c 100644 --- a/modules/cfe_assert/inc/cfe_assert.h +++ b/modules/cfe_assert/inc/cfe_assert.h @@ -30,7 +30,7 @@ /************************************************************************ ** Includes *************************************************************************/ -#include +#include "common_types.h" /************************************************************************ ** Type Definitions diff --git a/modules/cfe_assert/src/cfe_assert_init.c b/modules/cfe_assert/src/cfe_assert_init.c index d1923785a..e4c2fa59f 100644 --- a/modules/cfe_assert/src/cfe_assert_init.c +++ b/modules/cfe_assert/src/cfe_assert_init.c @@ -29,7 +29,7 @@ * Includes */ -#include +#include "cfe.h" #include "cfe_assert.h" diff --git a/modules/cfe_assert/src/cfe_assert_io.c b/modules/cfe_assert/src/cfe_assert_io.c index 5c01213c3..cff4893a0 100644 --- a/modules/cfe_assert/src/cfe_assert_io.c +++ b/modules/cfe_assert/src/cfe_assert_io.c @@ -30,7 +30,7 @@ #include #include -#include +#include "cfe.h" #include "utbsp.h" #include "uttest.h" diff --git a/modules/cfe_testcase/src/cfe_test.h b/modules/cfe_testcase/src/cfe_test.h index 45f98e890..efa2b2c82 100644 --- a/modules/cfe_testcase/src/cfe_test.h +++ b/modules/cfe_testcase/src/cfe_test.h @@ -33,7 +33,7 @@ * Includes */ -#include +#include "cfe.h" #include "uttest.h" #include "utassert.h" diff --git a/modules/cfe_testrunner/inc/cfe_testrunner.h b/modules/cfe_testrunner/inc/cfe_testrunner.h index 8502714af..cfcaa6b64 100644 --- a/modules/cfe_testrunner/inc/cfe_testrunner.h +++ b/modules/cfe_testrunner/inc/cfe_testrunner.h @@ -30,7 +30,7 @@ /************************************************************************ ** Includes *************************************************************************/ -#include +#include "common_types.h" /************************************************************************ ** Type Definitions diff --git a/modules/cfe_testrunner/src/cfe_testrunner_main.c b/modules/cfe_testrunner/src/cfe_testrunner_main.c index c12153a23..bd0c32416 100644 --- a/modules/cfe_testrunner/src/cfe_testrunner_main.c +++ b/modules/cfe_testrunner/src/cfe_testrunner_main.c @@ -29,7 +29,7 @@ * Includes */ -#include +#include "cfe.h" #include "cfe_testrunner.h" diff --git a/modules/core_api/fsw/inc/cfe_endian.h b/modules/core_api/fsw/inc/cfe_endian.h index fd425c40a..6b120dab7 100644 --- a/modules/core_api/fsw/inc/cfe_endian.h +++ b/modules/core_api/fsw/inc/cfe_endian.h @@ -34,6 +34,30 @@ */ #include "common_types.h" +/* + * SOFTWARE_BIG/LITTLE_BIT_ORDER COMPATIBILITY MACRO - + * + * This is provided only for backward compatibilty. Do not write any new code that + * uses this macro. + */ +#if !defined(SOFTWARE_BIG_BIT_ORDER) && !defined(SOFTWARE_LITTLE_BIT_ORDER) + +#if defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN || defined(__BIG_ENDIAN__) || defined(__ARMEB__) || \ + defined(__THUMBEB__) || defined(__AARCH64EB__) || defined(_MIBSEB) || defined(__MIBSEB) || defined(__MIBSEB__) +/* It is a big-endian target architecture */ +#define SOFTWARE_BIG_BIT_ORDER +#elif defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN || defined(__LITTLE_ENDIAN__) || defined(__ARMEL__) || \ + defined(__THUMBEL__) || defined(__AARCH64EL__) || defined(_MIPSEL) || defined(__MIPSEL) || defined(__MIPSEL__) || \ + defined(__i386) || defined(__i386__) || defined(__i686) || defined(__i686__) || defined(__x86_64) || \ + defined(__x86_64__) +/* It is a little-endian target architecture */ +#define SOFTWARE_LITTLE_BIT_ORDER +#else +#error Unknown byte order on this platform +#endif + +#endif /* !defined(SOFTWARE_BIG_BIT_ORDER) && !defined(SOFTWARE_LITTLE_BIT_ORDER) */ + /* Macro to convert 16/32 bit types from platform "endianness" to Big Endian */ #ifdef SOFTWARE_BIG_BIT_ORDER #define CFE_MAKE_BIG16(n) (n) diff --git a/modules/core_api/fsw/inc/cfe_tbl_filedef.h b/modules/core_api/fsw/inc/cfe_tbl_filedef.h index 4dd4d16a2..1bd32212b 100644 --- a/modules/core_api/fsw/inc/cfe_tbl_filedef.h +++ b/modules/core_api/fsw/inc/cfe_tbl_filedef.h @@ -49,8 +49,8 @@ #ifndef _cfe_tbl_filedef_ #define _cfe_tbl_filedef_ -#include -#include +#include "cfe_mission_cfg.h" +#include "common_types.h" #include "cfe_tbl_extern_typedefs.h" /* for "CFE_TBL_FileHdr_t" definition */ #include "cfe_fs_extern_typedefs.h" /* for "CFE_FS_HDR_DESC_MAX_LEN" definition */ diff --git a/modules/core_api/fsw/inc/cfe_version.h b/modules/core_api/fsw/inc/cfe_version.h index ccd34295d..bd9d3fbd8 100644 --- a/modules/core_api/fsw/inc/cfe_version.h +++ b/modules/core_api/fsw/inc/cfe_version.h @@ -32,7 +32,7 @@ */ /* Development Build Macro Definitions */ -#define CFE_BUILD_NUMBER 412 /*!< Development Build: Number of commits since baseline */ +#define CFE_BUILD_NUMBER 436 /*!< Development Build: Number of commits since baseline */ #define CFE_BUILD_BASELINE \ "v6.8.0-rc1" /*!< Development Build: git tag that is the base for the current development \ */ diff --git a/modules/core_private/fsw/inc/cfe_es_erlog_typedef.h b/modules/core_private/fsw/inc/cfe_es_erlog_typedef.h index dbc240898..7d5813812 100644 --- a/modules/core_private/fsw/inc/cfe_es_erlog_typedef.h +++ b/modules/core_private/fsw/inc/cfe_es_erlog_typedef.h @@ -31,11 +31,11 @@ #ifndef CFE_ES_ERLOG_TYPEDEF_H_ #define CFE_ES_ERLOG_TYPEDEF_H_ -#include -#include +#include "common_types.h" +#include "cfe_platform_cfg.h" -#include /* Needed for CFE_TIME_SysTime_t */ -#include /* Needed for CFE_ES_AppId_t */ +#include "cfe_time_extern_typedefs.h" /* Needed for CFE_TIME_SysTime_t */ +#include "cfe_es_extern_typedefs.h" /* Needed for CFE_ES_AppId_t */ #define CFE_ES_ERLOG_DESCRIPTION_MAX_LENGTH 80 diff --git a/modules/core_private/fsw/inc/cfe_es_perfdata_typedef.h b/modules/core_private/fsw/inc/cfe_es_perfdata_typedef.h index 795a7053c..44bf2f5a6 100644 --- a/modules/core_private/fsw/inc/cfe_es_perfdata_typedef.h +++ b/modules/core_private/fsw/inc/cfe_es_perfdata_typedef.h @@ -30,7 +30,7 @@ #ifndef CFE_ES_PERFDATA_TYPEDEF_H_ #define CFE_ES_PERFDATA_TYPEDEF_H_ -#include +#include "common_types.h" #include "cfe_mission_cfg.h" /* Required for CFE_MISSION_ES_PERF_MAX_IDS */ #include "cfe_platform_cfg.h" /* Required for CFE_PLATFORM_ES_PERF_DATA_BUFFER_SIZE */ diff --git a/modules/core_private/fsw/inc/cfe_es_resetdata_typedef.h b/modules/core_private/fsw/inc/cfe_es_resetdata_typedef.h index 6bfc87041..9bd462adf 100644 --- a/modules/core_private/fsw/inc/cfe_es_resetdata_typedef.h +++ b/modules/core_private/fsw/inc/cfe_es_resetdata_typedef.h @@ -31,7 +31,7 @@ #ifndef CFE_ES_RESETDATA_TYPEDEF_H_ #define CFE_ES_RESETDATA_TYPEDEF_H_ -#include +#include "common_types.h" #include "cfe_time_resetvars_typedef.h" /* Required for CFE_TIME_ResetVars_t definition */ #include "cfe_es_erlog_typedef.h" /* Required for CFE_ES_ERLog_t definition */ diff --git a/modules/core_private/fsw/inc/cfe_evs_log_typedef.h b/modules/core_private/fsw/inc/cfe_evs_log_typedef.h index 0cb4fa3d7..76cb28435 100644 --- a/modules/core_private/fsw/inc/cfe_evs_log_typedef.h +++ b/modules/core_private/fsw/inc/cfe_evs_log_typedef.h @@ -31,8 +31,8 @@ #ifndef CFE_EVS_LOG_TYPEDEF_H_ #define CFE_EVS_LOG_TYPEDEF_H_ -#include -#include +#include "common_types.h" +#include "cfe_platform_cfg.h" #include "cfe_evs_msg.h" /* Required for CFE_EVS_LongEventTlm_t definition */ diff --git a/modules/es/fsw/src/cfe_es_syslog.c b/modules/es/fsw/src/cfe_es_syslog.c index 61db46384..3d203e9f2 100644 --- a/modules/es/fsw/src/cfe_es_syslog.c +++ b/modules/es/fsw/src/cfe_es_syslog.c @@ -417,7 +417,7 @@ void CFE_ES_SysLog_vsnprintf(char *Buffer, size_t BufferSize, const char *SpecSt * * Strip off all trailing whitespace, and add back a single newline */ - while (StringLen > 0 && isspace((int)Buffer[StringLen - 1])) + while (StringLen > 0 && isspace((unsigned char)Buffer[StringLen - 1])) { --StringLen; } diff --git a/modules/es/fsw/src/cfe_es_task.c b/modules/es/fsw/src/cfe_es_task.c index b9154e9a2..c559c6625 100644 --- a/modules/es/fsw/src/cfe_es_task.c +++ b/modules/es/fsw/src/cfe_es_task.c @@ -1990,12 +1990,12 @@ int32 CFE_ES_DumpCDSRegistryCmd(const CFE_ES_DumpCDSRegistryCmd_t *data) /* a byte count discrepancy has been*/ /* detected during the file write */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -void CFE_ES_FileWriteByteCntErr(const char *Filename, size_t Requested, size_t Actual) +void CFE_ES_FileWriteByteCntErr(const char *Filename, size_t Requested, int32 Status) { CFE_EVS_SendEvent(CFE_ES_FILEWRITE_ERR_EID, CFE_EVS_EventType_ERROR, - "File write,byte cnt err,file %s,request=%u,actual=%u", Filename, (unsigned int)Requested, - (unsigned int)Actual); + "File write,byte cnt err,file %s,request=%u,status=0x%08x", Filename, (unsigned int)Requested, + (unsigned int)Status); } /* End of CFE_ES_FileWriteByteCntErr() */ diff --git a/modules/es/fsw/src/cfe_es_task.h b/modules/es/fsw/src/cfe_es_task.h index 2dd8f25e2..5a5c8ffdb 100644 --- a/modules/es/fsw/src/cfe_es_task.h +++ b/modules/es/fsw/src/cfe_es_task.h @@ -197,7 +197,7 @@ int32 CFE_ES_DumpCDSRegistryCmd(const CFE_ES_DumpCDSRegistryCmd_t *data); */ bool CFE_ES_ValidateHandle(CFE_ES_MemHandle_t Handle); bool CFE_ES_VerifyCmdLength(CFE_MSG_Message_t *MsgPtr, size_t ExpectedLength); -void CFE_ES_FileWriteByteCntErr(const char *Filename, size_t Requested, size_t Actual); +void CFE_ES_FileWriteByteCntErr(const char *Filename, size_t Requested, int32 Status); /*************************************************************************/ diff --git a/modules/evs/fsw/src/cfe_evs_utils.c b/modules/evs/fsw/src/cfe_evs_utils.c index de93e565f..b59350851 100644 --- a/modules/evs/fsw/src/cfe_evs_utils.c +++ b/modules/evs/fsw/src/cfe_evs_utils.c @@ -393,8 +393,11 @@ void EVS_GenerateEventTelemetry(EVS_AppData_t *AppDataPtr, uint16 EventID, uint1 ExpandedLength = vsnprintf((char *)LongEventTlm.Payload.Message, sizeof(LongEventTlm.Payload.Message), MsgSpec, ArgPtr); - /* Were any characters truncated in the buffer? */ - if (ExpandedLength >= sizeof(LongEventTlm.Payload.Message)) + /* + * If vsnprintf is bigger than message size, mark with truncation character + * Note negative returns (error from vsnprintf) will just leave the message as-is + */ + if (ExpandedLength >= (int)sizeof(LongEventTlm.Payload.Message)) { /* Mark character before zero terminator to indicate truncation */ LongEventTlm.Payload.Message[sizeof(LongEventTlm.Payload.Message) - 2] = CFE_EVS_MSG_TRUNCATED; diff --git a/modules/msg/fsw/src/cfe_msg_msgid_v1.c b/modules/msg/fsw/src/cfe_msg_msgid_v1.c index 47c002a0c..fe8ef8156 100644 --- a/modules/msg/fsw/src/cfe_msg_msgid_v1.c +++ b/modules/msg/fsw/src/cfe_msg_msgid_v1.c @@ -65,8 +65,9 @@ int32 CFE_MSG_SetMsgId(CFE_MSG_Message_t *MsgPtr, CFE_SB_MsgId_t MsgId) return CFE_MSG_BAD_ARGUMENT; } - MsgPtr->CCSDS.Pri.StreamId[0] = (uint8)(msgidval >> 8); - MsgPtr->CCSDS.Pri.StreamId[1] = (uint8)(msgidval); + /* Shift and mask bytes to be endian agnostic */ + MsgPtr->CCSDS.Pri.StreamId[0] = (msgidval >> 8) & 0xFF; + MsgPtr->CCSDS.Pri.StreamId[1] = msgidval & 0xFF; return 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 b3bccb2e8..e3511ac7c 100644 --- a/modules/tbl/fsw/src/cfe_tbl_task_cmds.c +++ b/modules/tbl/fsw/src/cfe_tbl_task_cmds.c @@ -360,6 +360,7 @@ int32 CFE_TBL_LoadCmd(const CFE_TBL_LoadCmd_t *data) CFE_TBL_File_Hdr_t TblFileHeader; osal_id_t FileDescriptor; int32 Status; + int16 RegIndex; CFE_TBL_RegistryRec_t * RegRecPtr; CFE_TBL_LoadBuff_t * WorkingBufferPtr; char LoadFilename[OS_MAX_PATH_LEN]; @@ -379,9 +380,9 @@ int32 CFE_TBL_LoadCmd(const CFE_TBL_LoadCmd_t *data) if (Status == CFE_SUCCESS) { /* Locate specified table in registry */ - Status = CFE_TBL_FindTableInRegistry(TblFileHeader.TableName); + RegIndex = CFE_TBL_FindTableInRegistry(TblFileHeader.TableName); - if (Status == CFE_TBL_NOT_FOUND) + if (RegIndex == CFE_TBL_NOT_FOUND) { CFE_EVS_SendEvent(CFE_TBL_NO_SUCH_TABLE_ERR_EID, CFE_EVS_EventType_ERROR, "Unable to locate '%s' in Table Registry", TblFileHeader.TableName); @@ -389,7 +390,7 @@ int32 CFE_TBL_LoadCmd(const CFE_TBL_LoadCmd_t *data) else { /* Translate the registry index into a record pointer */ - RegRecPtr = &CFE_TBL_Global.Registry[Status]; + RegRecPtr = &CFE_TBL_Global.Registry[RegIndex]; if (RegRecPtr->DumpOnly) { @@ -1321,7 +1322,7 @@ int32 CFE_TBL_DeleteCDSCmd(const CFE_TBL_DeleteCDSCmd_t *data) char TableName[CFE_TBL_MAX_FULL_NAME_LEN]; CFE_TBL_CritRegRec_t * CritRegRecPtr = NULL; uint32 i; - uint32 RegIndex; + int16 RegIndex; int32 Status; /* Make sure all strings are null terminated before attempting to process them */ diff --git a/modules/tbl/ut-coverage/tbl_UT.c b/modules/tbl/ut-coverage/tbl_UT.c index 3d788f8a0..9f8921246 100644 --- a/modules/tbl/ut-coverage/tbl_UT.c +++ b/modules/tbl/ut-coverage/tbl_UT.c @@ -2589,7 +2589,7 @@ void Test_CFE_TBL_Manage(void) { int32 RtnCode; bool EventsCorrect; - int32 RegIndex; + int16 RegIndex; CFE_TBL_RegistryRec_t * RegRecPtr; CFE_TBL_LoadBuff_t * WorkingBufferPtr; UT_Table1_t TestTable1;