diff --git a/README.md b/README.md index 6632d7fa4..14deae3ee 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,16 @@ The detailed cFE user's guide can be viewed at + ### Development Build: 6.8.0-rc1+dev164 - Keeps task names under 16 chars to make more debugger friendly, regardless diff --git a/cmake/arch_build.cmake b/cmake/arch_build.cmake index 743fef5bd..e569f500b 100644 --- a/cmake/arch_build.cmake +++ b/cmake/arch_build.cmake @@ -81,7 +81,7 @@ function(add_cfe_app APP_NAME APP_SRC_FILES) # currently this will build an app with either static linkage or shared/module linkage, # but this does not currently support both for a single arch (could be revised if that is needed) - if (APP_INSTALL_LIST) + if (APP_DYNAMIC_TARGET_LIST) set(APPTYPE "MODULE") else() set(APPTYPE "STATIC") @@ -90,9 +90,10 @@ function(add_cfe_app APP_NAME APP_SRC_FILES) # Create the app module add_library(${APP_NAME} ${APPTYPE} ${APP_SRC_FILES} ${ARGN}) - if (APP_INSTALL_LIST) - cfs_app_do_install(${APP_NAME} ${APP_INSTALL_LIST}) - endif (APP_INSTALL_LIST) + # An "install" step is only needed for dynamic/runtime loaded apps + if (APP_DYNAMIC_TARGET_LIST) + cfs_app_do_install(${APP_NAME} ${APP_DYNAMIC_TARGET_LIST}) + endif (APP_DYNAMIC_TARGET_LIST) endfunction(add_cfe_app) @@ -117,7 +118,7 @@ function(add_cfe_tables APP_NAME TBL_SRC_FILES) # Get name without extension (NAME_WE) and append to list of tables get_filename_component(TBLWE ${TBL} NAME_WE) - foreach(TGT ${APP_INSTALL_LIST}) + 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") @@ -162,7 +163,8 @@ function(add_cfe_tables APP_NAME TBL_SRC_FILES) ) # Create the install targets for all the tables install(FILES ${TABLE_DESTDIR}/${TBLWE}.tbl DESTINATION ${TGT}/${INSTALL_SUBDIR}) - endforeach(TGT ${APP_INSTALL_LIST}) + endforeach(TGT ${APP_STATIC_TARGET_LIST} ${APP_DYNAMIC_TARGET_LIST}) + endforeach(TBL ${TBL_SRC_FILES} ${ARGN}) @@ -435,33 +437,34 @@ function(process_arch SYSVAR) endforeach() # Process each app that is used on this system architecture - set(APP_INSTALL_LIST) - foreach(APP ${TGTSYS_${SYSVAR}_STATICAPPS}) - message(STATUS "Building Static App: ${APP}") - add_subdirectory("${${APP}_MISSION_DIR}" apps/${APP}) - endforeach() - - # Process each target that shares this system architecture - # First Pass: Assemble the list of apps that should be compiled - foreach(APP ${TGTSYS_${SYSVAR}_APPS}) + # First Pass: Assemble the list of apps that should be compiled + foreach(APP ${TGTSYS_${SYSVAR}_APPS} ${TGTSYS_${SYSVAR}_STATICAPPS}) set(TGTLIST_${APP}) endforeach() foreach(TGTNAME ${TGTSYS_${SYSVAR}}) # Append to the app install list for this CPU - foreach(APP ${${TGTNAME}_APPLIST}) + foreach(APP ${${TGTNAME}_APPLIST} ${${TGTNAME}_STATIC_APPLIST}) list(APPEND TGTLIST_${APP} ${TGTNAME}) endforeach(APP ${${TGTNAME}_APPLIST}) endforeach(TGTNAME ${TGTSYS_${SYSVAR}}) + foreach(APP ${TGTSYS_${SYSVAR}_STATICAPPS}) + set(APP_STATIC_TARGET_LIST ${TGTLIST_${APP}}) + message(STATUS "Building Static App: ${APP} targets=${APP_STATIC_TARGET_LIST}") + add_subdirectory("${${APP}_MISSION_DIR}" apps/${APP}) + endforeach() + unset(APP_STATIC_TARGET_LIST) + # Process each app that is used on this system architecture foreach(APP ${TGTSYS_${SYSVAR}_APPS}) - set(APP_INSTALL_LIST ${TGTLIST_${APP}}) - message(STATUS "Building App: ${APP} install=${APP_INSTALL_LIST}") + set(APP_DYNAMIC_TARGET_LIST ${TGTLIST_${APP}}) + message(STATUS "Building Dynamic App: ${APP} targets=${APP_DYNAMIC_TARGET_LIST}") add_subdirectory("${${APP}_MISSION_DIR}" apps/${APP}) endforeach() + unset(APP_DYNAMIC_TARGET_LIST) # Process each target that shares this system architecture # Second Pass: Build and link final target executable diff --git a/cmake/sample_defs/sample_mission_cfg.h b/cmake/sample_defs/sample_mission_cfg.h index 85d57ad2f..09a12ea17 100644 --- a/cmake/sample_defs/sample_mission_cfg.h +++ b/cmake/sample_defs/sample_mission_cfg.h @@ -173,7 +173,7 @@ #define CFE_MISSION_TIME_DEF_STCF_SECS 1000000 #define CFE_MISSION_TIME_DEF_STCF_SUBS 0 -#define CFE_MISSION_TIME_DEF_LEAPS 32 +#define CFE_MISSION_TIME_DEF_LEAPS 37 #define CFE_MISSION_TIME_DEF_DELAY_SECS 0 #define CFE_MISSION_TIME_DEF_DELAY_SUBS 1000 diff --git a/fsw/cfe-core/src/es/cfe_es_apps.c b/fsw/cfe-core/src/es/cfe_es_apps.c index 3800a898c..d0b1bbb0d 100644 --- a/fsw/cfe-core/src/es/cfe_es_apps.c +++ b/fsw/cfe-core/src/es/cfe_es_apps.c @@ -370,7 +370,8 @@ int32 CFE_ES_LoadModule(const CFE_ES_ModuleLoadParams_t* LoadParams, CFE_ES_Modu */ StatusCode = OS_ModuleLoad ( &ModuleId, LoadParams->Name, - LoadParams->FileName ); + LoadParams->FileName, + OS_MODULE_FLAG_GLOBAL_SYMBOLS ); if (StatusCode != OS_SUCCESS) { diff --git a/fsw/cfe-core/src/inc/cfe_evs.h b/fsw/cfe-core/src/inc/cfe_evs.h index 8e1e1846c..044c5b539 100644 --- a/fsw/cfe-core/src/inc/cfe_evs.h +++ b/fsw/cfe-core/src/inc/cfe_evs.h @@ -60,6 +60,15 @@ #define OS_PRINTF(m,n) #endif +/* +** Utility macros to make for simpler/more compact/readable code. +*/ +#define CFE_EVS_Send(E,T,...) CFE_EVS_SendEvent((E), CFE_EVS_EventType_##T, __VA_ARGS__) +#define CFE_EVS_SendDbg(E,...) CFE_EVS_Send(E, DEBUG, __VA_ARGS__) +#define CFE_EVS_SendInfo(E,...) CFE_EVS_Send(E, INFORMATION, __VA_ARGS__) +#define CFE_EVS_SendErr(E,...) CFE_EVS_Send(E, ERROR, __VA_ARGS__) +#define CFE_EVS_SendCrit(E,...) CFE_EVS_Send(E, CRITICAL, __VA_ARGS__) + /** \name Common Event Filter Mask Values */ /** \{ */ #define CFE_EVS_NO_FILTER 0x0000 /**< \brief Stops any filtering. All messages are sent. */ diff --git a/fsw/cfe-core/src/inc/cfe_msg_api.h b/fsw/cfe-core/src/inc/cfe_msg_api.h index a2a5d1e92..3dfe24b4f 100644 --- a/fsw/cfe-core/src/inc/cfe_msg_api.h +++ b/fsw/cfe-core/src/inc/cfe_msg_api.h @@ -44,20 +44,19 @@ * \brief Initialize a message * * \par Description - * This routine initialize a message. If Clear is true the - * message is cleard and constant header defaults are set. - * The bits from MsgId and message size are always set. + * This routine initialize a message. The entire message is + * set to zero (based on size), defaults are set, then the + * size and bits from MsgId are set. * * \param[in, out] MsgPtr A pointer to the buffer that contains the message. * \param[in] MsgId MsgId that corresponds to message * \param[in] Size Total size of the mesage (used to set length field) - * \param[in] Clear Boolean to clear and set defaults * * \return Execution status, see \ref CFEReturnCodes * \retval #CFE_SUCCESS \copybrief CFE_SUCCESS * \retval #CFE_MSG_BAD_ARGUMENT \copybrief CFE_MSG_BAD_ARGUMENT */ -CFE_Status_t CFE_MSG_Init(CFE_MSG_Message_t *MsgPtr, CFE_SB_MsgId_t MsgId, CFE_MSG_Size_t Size, bool Clear); +CFE_Status_t CFE_MSG_Init(CFE_MSG_Message_t *MsgPtr, CFE_SB_MsgId_t MsgId, CFE_MSG_Size_t Size); /*****************************************************************************/ /** diff --git a/fsw/cfe-core/src/inc/cfe_version.h b/fsw/cfe-core/src/inc/cfe_version.h index 2ec743a0b..ff3e993e7 100644 --- a/fsw/cfe-core/src/inc/cfe_version.h +++ b/fsw/cfe-core/src/inc/cfe_version.h @@ -35,7 +35,7 @@ /* Development Build Macro Definitions */ -#define CFE_BUILD_NUMBER 164 /*!< Development Build: Number of commits since baseline */ +#define CFE_BUILD_NUMBER 179 /*!< 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 */ /* Version Macro Definitions */ diff --git a/fsw/cfe-core/src/sb/cfe_sb_util.c b/fsw/cfe-core/src/sb/cfe_sb_util.c index 1cc61fbc5..6086f22b1 100644 --- a/fsw/cfe-core/src/sb/cfe_sb_util.c +++ b/fsw/cfe-core/src/sb/cfe_sb_util.c @@ -51,7 +51,7 @@ void CFE_SB_InitMsg(void *MsgPtr, bool Clear ) { - CFE_MSG_Init((CFE_MSG_Message_t *)MsgPtr, MsgId, Length, Clear); + CFE_MSG_Init((CFE_MSG_Message_t *)MsgPtr, MsgId, Length); } /* end CFE_SB_InitMsg */ diff --git a/fsw/cfe-core/unit-test/es_UT.c b/fsw/cfe-core/unit-test/es_UT.c index 52f3e1b3f..b0416ad2a 100644 --- a/fsw/cfe-core/unit-test/es_UT.c +++ b/fsw/cfe-core/unit-test/es_UT.c @@ -1494,7 +1494,7 @@ void TestApps(void) UtAppRecPtr->StartParams.Priority = 255; UtAppRecPtr->StartParams.StackSize = 8192; UtAppRecPtr->StartParams.ExceptionAction = 0; - OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL); + OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0); UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_EXIT; Id = CFE_ES_AppRecordGetID(UtAppRecPtr); @@ -1511,7 +1511,7 @@ void TestApps(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_EXIT; UT_SetDeferredRetcode(UT_KEY(CFE_EVS_CleanUpApp), 1, -1); - OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL); + OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0); Id = CFE_ES_AppRecordGetID(UtAppRecPtr); CFE_ES_ProcessControlRequest(Id); UT_Report(__FILE__, __LINE__, @@ -1527,7 +1527,7 @@ void TestApps(void) UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_DELETE; UT_SetDeferredRetcode(UT_KEY(CFE_EVS_CleanUpApp), 1, -1); - OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL); + OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0); Id = CFE_ES_AppRecordGetID(UtAppRecPtr); CFE_ES_ProcessControlRequest(Id); UT_Report(__FILE__, __LINE__, @@ -1543,7 +1543,7 @@ void TestApps(void) UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_RESTART; UT_SetDeferredRetcode(UT_KEY(CFE_EVS_CleanUpApp), 1, -1); - OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL); + OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0); Id = CFE_ES_AppRecordGetID(UtAppRecPtr); CFE_ES_ProcessControlRequest(Id); UT_Report(__FILE__, __LINE__, @@ -1558,7 +1558,7 @@ void TestApps(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_RESTART; - OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL); + OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0); UT_SetForceFail(UT_KEY(OS_TaskCreate), OS_ERROR); Id = CFE_ES_AppRecordGetID(UtAppRecPtr); CFE_ES_ProcessControlRequest(Id); @@ -1574,7 +1574,7 @@ void TestApps(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_RELOAD; - OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL); + OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0); UT_SetDeferredRetcode(UT_KEY(CFE_EVS_CleanUpApp), 1, -1); Id = CFE_ES_AppRecordGetID(UtAppRecPtr); CFE_ES_ProcessControlRequest(Id); @@ -1590,7 +1590,7 @@ void TestApps(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_RELOAD; - OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL); + OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0); UT_SetForceFail(UT_KEY(OS_TaskCreate), OS_ERROR); Id = CFE_ES_AppRecordGetID(UtAppRecPtr); CFE_ES_ProcessControlRequest(Id); @@ -1614,7 +1614,7 @@ void TestApps(void) UtAppRecPtr->StartParams.Priority = 255; UtAppRecPtr->StartParams.StackSize = 8192; UtAppRecPtr->StartParams.ExceptionAction = 0; - OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL); + OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0); UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_ERROR; Id = CFE_ES_AppRecordGetID(UtAppRecPtr); @@ -1632,7 +1632,7 @@ void TestApps(void) UT_SetDeferredRetcode(UT_KEY(CFE_EVS_CleanUpApp), 1, -1); UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_APP_ERROR; - OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL); + OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0); Id = CFE_ES_AppRecordGetID(UtAppRecPtr); CFE_ES_ProcessControlRequest(Id); UT_Report(__FILE__, __LINE__, @@ -1655,7 +1655,7 @@ void TestApps(void) UtAppRecPtr->StartParams.ExceptionAction = 0; UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_DELETE; - OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL); + OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0); Id = CFE_ES_AppRecordGetID(UtAppRecPtr); CFE_ES_ProcessControlRequest(Id); UT_Report(__FILE__, __LINE__, @@ -1678,7 +1678,7 @@ void TestApps(void) UtAppRecPtr->StartParams.ExceptionAction = 0; UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_RESTART; - OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL); + OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0); Id = CFE_ES_AppRecordGetID(UtAppRecPtr); CFE_ES_ProcessControlRequest(Id); UT_Report(__FILE__, __LINE__, @@ -1701,7 +1701,7 @@ void TestApps(void) UtAppRecPtr->StartParams.ExceptionAction = 0; UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_RELOAD; - OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL); + OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0); Id = CFE_ES_AppRecordGetID(UtAppRecPtr); CFE_ES_ProcessControlRequest(Id); UT_Report(__FILE__, __LINE__, @@ -1726,7 +1726,7 @@ void TestApps(void) UtAppRecPtr->StartParams.ExceptionAction = 0; UtAppRecPtr->ControlReq.AppControlRequest = CFE_ES_RunStatus_SYS_EXCEPTION; - OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL); + OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0); Id = CFE_ES_AppRecordGetID(UtAppRecPtr); CFE_ES_ProcessControlRequest(Id); UT_Report(__FILE__, __LINE__, @@ -1795,7 +1795,7 @@ void TestApps(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); ES_UT_SetupForOSCleanup(); - OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL); + OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0); UT_SetForceFail(UT_KEY(OS_TaskDelete), OS_ERROR); UT_SetForceFail(UT_KEY(OS_close), OS_ERROR); Id = CFE_ES_AppRecordGetID(UtAppRecPtr); @@ -1809,7 +1809,7 @@ void TestApps(void) */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); - OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL); + OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, NULL, NULL); ES_UT_SetupForOSCleanup(); UT_SetDeferredRetcode(UT_KEY(OS_MutSemDelete), 1, OS_ERROR); @@ -1824,7 +1824,7 @@ void TestApps(void) */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); - OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL); + OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0); UT_SetDeferredRetcode(UT_KEY(OS_ModuleUnload), 1, OS_ERROR); Id = CFE_ES_AppRecordGetID(UtAppRecPtr); UT_Report(__FILE__, __LINE__, @@ -1837,7 +1837,7 @@ void TestApps(void) */ ES_ResetUnitTest(); ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); - OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL); + OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0); UT_SetDeferredRetcode(UT_KEY(CFE_EVS_CleanUpApp), 1, -1); Id = CFE_ES_AppRecordGetID(UtAppRecPtr); UT_Report(__FILE__, __LINE__, @@ -2009,12 +2009,12 @@ void TestApps(void) ES_ResetUnitTest(); /* Setup an entry which will be deleted */ ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); - OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL); + OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0); /* Setup a second entry which will NOT be deleted */ ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, NULL, &UtTaskRecPtr); ES_UT_SetupMemPoolId(&UtPoolRecPtr); UtPoolRecPtr->OwnerAppID = CFE_ES_AppRecordGetID(UtAppRecPtr); - OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL); + OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0); /* Associate a child task with the app to be deleted */ ES_UT_SetupChildTaskId(UtAppRecPtr, NULL, NULL); Id = CFE_ES_AppRecordGetID(UtAppRecPtr); @@ -2037,7 +2037,7 @@ void TestApps(void) ES_ResetUnitTest(); /* Setup an entry which will be deleted */ ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); - OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL); + OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0); ES_UT_SetupMemPoolId(&UtPoolRecPtr); UtPoolRecPtr->OwnerAppID = CFE_ES_AppRecordGetID(UtAppRecPtr); UtPoolRecPtr->PoolID = CFE_ES_ResourceID_FromInteger(99999); /* Mismatch */ @@ -2058,10 +2058,10 @@ void TestApps(void) /* Setup an entry which will be deleted */ ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, NULL); - OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL); + OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0); /* Setup a second entry which will NOT be deleted */ ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, NULL, &UtTaskRecPtr); - OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL); + OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, NULL, NULL, 0); /* Associate a child task with the app to be deleted */ ES_UT_SetupChildTaskId(UtAppRecPtr, NULL, NULL); @@ -2118,7 +2118,7 @@ void TestApps(void) ES_UT_SetupSingleAppId(CFE_ES_AppType_EXTERNAL, CFE_ES_AppState_RUNNING, NULL, &UtAppRecPtr, &UtTaskRecPtr); OS_ModuleLoad(&UtAppRecPtr->ModuleInfo.ModuleId, "UT", - "ut-module"); + "ut-module", 0); Id = CFE_ES_AppRecordGetID(UtAppRecPtr); UT_Report(__FILE__, __LINE__, CFE_ES_CleanUpApp(Id) == CFE_SUCCESS && diff --git a/fsw/cfe-core/ut-stubs/ut_es_stubs.c b/fsw/cfe-core/ut-stubs/ut_es_stubs.c index f9c26c407..e0212fff1 100644 --- a/fsw/cfe-core/ut-stubs/ut_es_stubs.c +++ b/fsw/cfe-core/ut-stubs/ut_es_stubs.c @@ -34,6 +34,7 @@ */ #include #include "cfe.h" +#include "private/cfe_private.h" #include "utstubs.h" #include "utassert.h" @@ -970,7 +971,7 @@ int32 CFE_ES_RestoreFromCDS(void *RestoreToMemory, CFE_ES_CDSHandle_t Handle) ** ******************************************************************************/ int32 CFE_ES_RegisterCDSEx(CFE_ES_CDSHandle_t *HandlePtr, - int32 BlockSize, + CFE_ES_CDS_Offset_t UserBlockSize, const char *Name, bool CriticalTbl) { diff --git a/fsw/cfe-core/ut-stubs/ut_evs_stubs.c b/fsw/cfe-core/ut-stubs/ut_evs_stubs.c index cfff1a4bd..3fe8038c9 100644 --- a/fsw/cfe-core/ut-stubs/ut_evs_stubs.c +++ b/fsw/cfe-core/ut-stubs/ut_evs_stubs.c @@ -34,6 +34,7 @@ */ #include #include "cfe.h" +#include "private/cfe_private.h" #include "utstubs.h" #include "uttools.h" diff --git a/fsw/cfe-core/ut-stubs/ut_msg_stubs.c b/fsw/cfe-core/ut-stubs/ut_msg_stubs.c index 77e14b03e..c7d4cc8a0 100644 --- a/fsw/cfe-core/ut-stubs/ut_msg_stubs.c +++ b/fsw/cfe-core/ut-stubs/ut_msg_stubs.c @@ -414,12 +414,11 @@ int32 CFE_MSG_GetTypeFromMsgId(CFE_SB_MsgId_t MsgId, CFE_MSG_Type_t *Type) * Stub implementation of CFE_MSG_Init * ----------------------------------------------------------- */ -int32 CFE_MSG_Init(CFE_MSG_Message_t *MsgPtr, CFE_SB_MsgId_t MsgId, CFE_MSG_Size_t Size, bool Clear) +int32 CFE_MSG_Init(CFE_MSG_Message_t *MsgPtr, CFE_SB_MsgId_t MsgId, CFE_MSG_Size_t Size) { UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_MSG_Init), MsgPtr); UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_MSG_Init), MsgId); UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_MSG_Init), Size); - UT_Stub_RegisterContextGenericArg(UT_KEY(CFE_MSG_Init), Clear); int32 status; diff --git a/fsw/cfe-core/ut-stubs/ut_sb_stubs.c b/fsw/cfe-core/ut-stubs/ut_sb_stubs.c index 1683dc65b..eff6d89cf 100644 --- a/fsw/cfe-core/ut-stubs/ut_sb_stubs.c +++ b/fsw/cfe-core/ut-stubs/ut_sb_stubs.c @@ -34,6 +34,7 @@ */ #include #include "cfe.h" +#include "private/cfe_private.h" #include "utstubs.h" typedef struct diff --git a/fsw/cfe-core/ut-stubs/ut_tbl_stubs.c b/fsw/cfe-core/ut-stubs/ut_tbl_stubs.c index 32a3b2144..b0befc23c 100644 --- a/fsw/cfe-core/ut-stubs/ut_tbl_stubs.c +++ b/fsw/cfe-core/ut-stubs/ut_tbl_stubs.c @@ -23,6 +23,7 @@ */ #include #include "cfe.h" +#include "private/cfe_private.h" #include "utstubs.h" /* diff --git a/fsw/cfe-core/ut-stubs/ut_time_stubs.c b/fsw/cfe-core/ut-stubs/ut_time_stubs.c index 48508d43f..a52720d0c 100644 --- a/fsw/cfe-core/ut-stubs/ut_time_stubs.c +++ b/fsw/cfe-core/ut-stubs/ut_time_stubs.c @@ -35,6 +35,7 @@ #include #include #include "cfe_time.h" +#include "private/cfe_private.h" #include "utstubs.h" /* diff --git a/modules/msg/src/cfe_msg_init.c b/modules/msg/src/cfe_msg_init.c index b64e2d0f6..664b8c3dc 100644 --- a/modules/msg/src/cfe_msg_init.c +++ b/modules/msg/src/cfe_msg_init.c @@ -29,7 +29,7 @@ /****************************************************************************** * Top level message initialization - See API and header file for details */ -int32 CFE_MSG_Init(CFE_MSG_Message_t *MsgPtr, CFE_SB_MsgId_t MsgId, CFE_MSG_Size_t Size, bool Clear) +int32 CFE_MSG_Init(CFE_MSG_Message_t *MsgPtr, CFE_SB_MsgId_t MsgId, CFE_MSG_Size_t Size) { int32 status; @@ -39,12 +39,9 @@ int32 CFE_MSG_Init(CFE_MSG_Message_t *MsgPtr, CFE_SB_MsgId_t MsgId, CFE_MSG_Size return CFE_MSG_BAD_ARGUMENT; } - /* Clear and set defaults if request */ - if (Clear) - { - memset(MsgPtr, 0, Size); - CFE_MSG_InitDefaultHdr(MsgPtr); - } + /* Clear and set defaults */ + memset(MsgPtr, 0, Size); + CFE_MSG_InitDefaultHdr(MsgPtr); /* Set values input */ status = CFE_MSG_SetMsgId(MsgPtr, MsgId); diff --git a/modules/msg/unit-test-coverage/test_cfe_msg_ccsdsext.c b/modules/msg/unit-test-coverage/test_cfe_msg_ccsdsext.c index f8bfe369c..05ee2438f 100644 --- a/modules/msg/unit-test-coverage/test_cfe_msg_ccsdsext.c +++ b/modules/msg/unit-test-coverage/test_cfe_msg_ccsdsext.c @@ -49,29 +49,29 @@ /* Extended header initialization specific coverage */ void Test_MSG_Init_Ext(void) { - CFE_MSG_Message_t msg; - CFE_SB_MsgId_Atom_t msgidval_exp; - CFE_MSG_HeaderVersion_t hdrver; - CFE_MSG_Subsystem_t subsys; - CFE_MSG_EDSVersion_t edsver; - CFE_MSG_System_t system; - CFE_MSG_Endian_t endian; - bool is_v1; - int sc_id = 0xab; - - /* Get msgid version by checking if msgid sets header version */ + CFE_MSG_Message_t msg; + CFE_SB_MsgId_Atom_t msgidval_exp; + CFE_MSG_Subsystem_t subsys; + CFE_MSG_EDSVersion_t edsver; + CFE_MSG_System_t system; + CFE_MSG_Endian_t endian; + bool hassec; + bool is_v1; + int sc_id = 0xab; + + /* Get msgid version by checking if msgid sets "has secondary" field*/ memset(&msg, 0xFF, sizeof(msg)); ASSERT_EQ(CFE_MSG_SetMsgId(&msg, CFE_SB_ValueToMsgId(0)), CFE_SUCCESS); - ASSERT_EQ(CFE_MSG_GetHeaderVersion(&msg, &hdrver), CFE_SUCCESS); - is_v1 = (hdrver == 0); + ASSERT_EQ(CFE_MSG_GetHasSecondaryHeader(&msg, &hassec), CFE_SUCCESS); + is_v1 = !hassec; /* Set up return */ - UT_SetDeferredRetcode(UT_KEY(CFE_PSP_GetSpacecraftId), 1, sc_id); + UT_SetForceFail(UT_KEY(CFE_PSP_GetSpacecraftId), sc_id); - UtPrintf("Set to all F's, msgid value = 0, and run with clearing"); + UtPrintf("Set to all F's, msgid value = 0"); memset(&msg, 0xFF, sizeof(msg)); msgidval_exp = 0; - ASSERT_EQ(CFE_MSG_Init(&msg, CFE_SB_ValueToMsgId(msgidval_exp), sizeof(msg), true), CFE_SUCCESS); + ASSERT_EQ(CFE_MSG_Init(&msg, CFE_SB_ValueToMsgId(msgidval_exp), sizeof(msg)), CFE_SUCCESS); Test_MSG_PrintMsg(&msg, 0); /* Default EDS version check */ @@ -100,21 +100,38 @@ void Test_MSG_Init_Ext(void) /* Confirm the rest of the fields not already explicitly checked */ ASSERT_EQ(Test_MSG_Ext_NotZero(&msg) & ~(MSG_EDSVER_FLAG | MSG_ENDIAN_FLAG | MSG_SUBSYS_FLAG | MSG_SYSTEM_FLAG), 0); - UtPrintf("Set to all 0, max msgid value, and run without clearing"); + UtPrintf("Set to all 0, max msgid value"); memset(&msg, 0, sizeof(msg)); msgidval_exp = CFE_PLATFORM_SB_HIGHEST_VALID_MSGID; - ASSERT_EQ(CFE_MSG_Init(&msg, CFE_SB_ValueToMsgId(msgidval_exp), sizeof(msg), false), CFE_SUCCESS); + ASSERT_EQ(CFE_MSG_Init(&msg, CFE_SB_ValueToMsgId(msgidval_exp), sizeof(msg)), CFE_SUCCESS); Test_MSG_PrintMsg(&msg, 0); + /* Default EDS version check */ + ASSERT_EQ(CFE_MSG_GetEDSVersion(&msg, &edsver), CFE_SUCCESS); + ASSERT_EQ(edsver, CFE_PLATFORM_EDSVER); + + /* Default system check */ + ASSERT_EQ(CFE_MSG_GetSystem(&msg, &system), CFE_SUCCESS); + ASSERT_EQ(system, sc_id); + + /* Default endian check */ + ASSERT_EQ(CFE_MSG_GetEndian(&msg, &endian), CFE_SUCCESS); +#if (CFE_PLATFORM_ENDIAN == CCSDS_LITTLE_ENDIAN) + ASSERT_EQ(endian, CFE_MSG_Endian_Little); +#else + ASSERT_EQ(endian, CFE_MSG_Endian_Big); +#endif + /* Default subsystem check */ ASSERT_EQ(CFE_MSG_GetSubsystem(&msg, &subsys), CFE_SUCCESS); if (is_v1) - ASSERT_EQ(subsys, 0); + ASSERT_EQ(subsys, CFE_PLATFORM_DEFAULT_SUBSYS); else - ASSERT_EQ(subsys, 0xFF); + ASSERT_EQ(subsys, CFE_PLATFORM_DEFAULT_SUBSYS | ((msgidval_exp >> 8) & 0xFF)); /* Confirm the rest of the fields not already explicitly checked */ - ASSERT_EQ(Test_MSG_Ext_NotZero(&msg) & ~MSG_SUBSYS_FLAG, 0); + ASSERT_EQ(Test_MSG_Ext_NotZero(&msg) & ~(MSG_EDSVER_FLAG | MSG_ENDIAN_FLAG | MSG_SUBSYS_FLAG | MSG_SYSTEM_FLAG), 0); + } void Test_MSG_EDSVersion(void) diff --git a/modules/msg/unit-test-coverage/test_cfe_msg_init.c b/modules/msg/unit-test-coverage/test_cfe_msg_init.c index 972e82973..33964762e 100644 --- a/modules/msg/unit-test-coverage/test_cfe_msg_init.c +++ b/modules/msg/unit-test-coverage/test_cfe_msg_init.c @@ -50,44 +50,21 @@ void Test_MSG_Init(void) CFE_MSG_HeaderVersion_t hdrver; CFE_MSG_ApId_t apid; CFE_MSG_SegmentationFlag_t segflag; - unsigned int flag_exp; bool hassec; bool is_v1; UtPrintf("Bad parameter tests, Null pointer, invalid size, invalid msgid"); - memset(&msg, 0, sizeof(msg)); - ASSERT_EQ(CFE_MSG_Init(NULL, CFE_SB_ValueToMsgId(0), sizeof(msg), false), CFE_MSG_BAD_ARGUMENT); - ASSERT_EQ(CFE_MSG_Init(&msg, CFE_SB_ValueToMsgId(0), 0, false), CFE_MSG_BAD_ARGUMENT); - ASSERT_EQ(CFE_MSG_Init(&msg, CFE_SB_ValueToMsgId(CFE_PLATFORM_SB_HIGHEST_VALID_MSGID + 1), sizeof(msg), false), + ASSERT_EQ(CFE_MSG_Init(NULL, CFE_SB_ValueToMsgId(0), sizeof(msg)), CFE_MSG_BAD_ARGUMENT); + ASSERT_EQ(CFE_MSG_Init(&msg, CFE_SB_ValueToMsgId(0), 0), CFE_MSG_BAD_ARGUMENT); + ASSERT_EQ(CFE_MSG_Init(&msg, CFE_SB_ValueToMsgId(CFE_PLATFORM_SB_HIGHEST_VALID_MSGID + 1), sizeof(msg)), CFE_MSG_BAD_ARGUMENT); - ASSERT_EQ(CFE_MSG_Init(&msg, CFE_SB_ValueToMsgId(-1), sizeof(msg), false), CFE_MSG_BAD_ARGUMENT); - ASSERT_EQ(Test_MSG_NotZero(&msg), 0); + ASSERT_EQ(CFE_MSG_Init(&msg, CFE_SB_ValueToMsgId(-1), sizeof(msg)), CFE_MSG_BAD_ARGUMENT); - UtPrintf("Set to all F's, msgid value = 0, and run without clearing"); + UtPrintf("Set to all F's, msgid value = 0"); memset(&msg, 0xFF, sizeof(msg)); msgidval_exp = 0; - ASSERT_EQ(CFE_MSG_Init(&msg, CFE_SB_ValueToMsgId(msgidval_exp), sizeof(msg), false), CFE_SUCCESS); - Test_MSG_PrintMsg(&msg, 0); - - /* Get msgid version by checking if header version was set */ - ASSERT_EQ(CFE_MSG_GetHeaderVersion(&msg, &hdrver), CFE_SUCCESS); - is_v1 = (hdrver == 0); - - flag_exp = MSG_TYPE_FLAG | MSG_LENGTH_FLAG | MSG_APID_FLAG; - if (is_v1) - flag_exp |= MSG_HDRVER_FLAG | MSG_HASSEC_FLAG; - - ASSERT_EQ(Test_MSG_Pri_NotF(&msg), flag_exp); - ASSERT_EQ(CFE_MSG_GetMsgId(&msg, &msgid_act), CFE_SUCCESS); - ASSERT_EQ(CFE_SB_MsgIdToValue(msgid_act), msgidval_exp); - ASSERT_EQ(CFE_MSG_GetSize(&msg, &size), CFE_SUCCESS); - ASSERT_EQ(size, sizeof(msg)); - UtPrintf("Set to all F's, msgid value = 0, and run with clearing"); - memset(&msg, 0xFF, sizeof(msg)); - msgidval_exp = 0; - - ASSERT_EQ(CFE_MSG_Init(&msg, CFE_SB_ValueToMsgId(msgidval_exp), sizeof(msg), true), CFE_SUCCESS); + ASSERT_EQ(CFE_MSG_Init(&msg, CFE_SB_ValueToMsgId(msgidval_exp), sizeof(msg)), CFE_SUCCESS); Test_MSG_PrintMsg(&msg, 0); ASSERT_EQ(CFE_MSG_GetMsgId(&msg, &msgid_act), CFE_SUCCESS); ASSERT_EQ(CFE_SB_MsgIdToValue(msgid_act), msgidval_exp); @@ -99,49 +76,52 @@ void Test_MSG_Init(void) ASSERT_EQ(CFE_MSG_GetApId(&msg, &apid), CFE_SUCCESS); ASSERT_EQ(CFE_MSG_GetHeaderVersion(&msg, &hdrver), CFE_SUCCESS); ASSERT_EQ(CFE_MSG_GetHasSecondaryHeader(&msg, &hassec), CFE_SUCCESS); + + /* A zero msgid will set hassec to false for v1 */ + is_v1 = !hassec; + if (!is_v1) { ASSERT_EQ(apid, CFE_PLATFORM_DEFAULT_APID & TEST_DEFAULT_APID_MASK); ASSERT_EQ(hdrver, CFE_MISSION_CCSDSVER); - ASSERT_EQ(hassec, true); } else { ASSERT_EQ(apid, 0); ASSERT_EQ(hdrver, 0); - ASSERT_EQ(hassec, false); } /* Confirm the rest of the fields not already explicitly checked */ ASSERT_EQ(Test_MSG_Pri_NotZero(&msg) & ~(MSG_APID_FLAG | MSG_HDRVER_FLAG | MSG_HASSEC_FLAG), MSG_LENGTH_FLAG | MSG_SEGMENT_FLAG); - UtPrintf("Set to all 0, max msgid value, and run without clearing"); + UtPrintf("Set to all 0, max msgid value"); memset(&msg, 0, sizeof(msg)); msgidval_exp = CFE_PLATFORM_SB_HIGHEST_VALID_MSGID; - ASSERT_EQ(CFE_MSG_Init(&msg, CFE_SB_ValueToMsgId(msgidval_exp), sizeof(msg), false), CFE_SUCCESS); + + ASSERT_EQ(CFE_MSG_Init(&msg, CFE_SB_ValueToMsgId(msgidval_exp), sizeof(msg)), CFE_SUCCESS); Test_MSG_PrintMsg(&msg, 0); ASSERT_EQ(CFE_MSG_GetMsgId(&msg, &msgid_act), CFE_SUCCESS); ASSERT_EQ(CFE_SB_MsgIdToValue(msgid_act), msgidval_exp); ASSERT_EQ(CFE_MSG_GetSize(&msg, &size), CFE_SUCCESS); ASSERT_EQ(size, sizeof(msg)); + ASSERT_EQ(CFE_MSG_GetSegmentationFlag(&msg, &segflag), CFE_SUCCESS); + ASSERT_EQ(segflag, CFE_MSG_SegFlag_Unsegmented); ASSERT_EQ(CFE_MSG_GetApId(&msg, &apid), CFE_SUCCESS); + ASSERT_EQ(CFE_MSG_GetHeaderVersion(&msg, &hdrver), CFE_SUCCESS); ASSERT_EQ(CFE_MSG_GetHasSecondaryHeader(&msg, &hassec), CFE_SUCCESS); + ASSERT_EQ(hassec, true); if (!is_v1) { ASSERT_EQ(apid & TEST_DEFAULT_APID_MASK, CFE_PLATFORM_DEFAULT_APID & TEST_DEFAULT_APID_MASK); - ASSERT_EQ(hassec, false); + ASSERT_EQ(hdrver, CFE_MISSION_CCSDSVER); } else { ASSERT_EQ(apid, 0x7FF); - ASSERT_EQ(hassec, true); + ASSERT_EQ(hdrver, 0); } - ASSERT_EQ(Test_MSG_Pri_NotZero(&msg) & ~(MSG_APID_FLAG | MSG_HASSEC_FLAG), MSG_TYPE_FLAG | MSG_LENGTH_FLAG); - - /* Zero (no default) header version check */ - ASSERT_EQ(CFE_MSG_GetHeaderVersion(&msg, &hdrver), CFE_SUCCESS); - ASSERT_EQ(hdrver, 0); + ASSERT_EQ(Test_MSG_Pri_NotZero(&msg) & ~MSG_HDRVER_FLAG, MSG_APID_FLAG | MSG_HASSEC_FLAG | MSG_TYPE_FLAG | MSG_LENGTH_FLAG | MSG_SEGMENT_FLAG); }