diff --git a/cmake/target/CMakeLists.txt b/cmake/target/CMakeLists.txt index 849c487b7..200f6cee7 100644 --- a/cmake/target/CMakeLists.txt +++ b/cmake/target/CMakeLists.txt @@ -48,15 +48,24 @@ string(CONCAT GENERATED_FILE_CONTENT configure_file(${CFE_SOURCE_DIR}/cmake/cfe_generated_file.h.in ${CMAKE_CURRENT_BINARY_DIR}/cfe_psp_module_list.c) -# Generate a list of modules that will be statically linked into this CFE core target -set(GENERATED_ENTRIES) -foreach(DEP ${MISSION_CORE_MODULES} ${${TGTNAME}_STATIC_APPLIST} ${${TGTNAME}_PSP_MODULELIST}) - list(APPEND GENERATED_ENTRIES "\"${DEP}\",\n") +# Generate lists of modules that will be statically linked into this CFE core target +set(GENERATED_ENTRIES_CORE_MODULES) +foreach(DEP ${MISSION_CORE_MODULES}) + list(APPEND GENERATED_ENTRIES_CORE_MODULES "\"{ ${DEP}\" },\n") +endforeach() + +set(GENERATED_ENTRIES_STATIC_APPS) +foreach(DEP ${${TGTNAME}_STATIC_APPLIST}) + list(APPEND GENERATED_ENTRIES_STATIC_APPS "{ \"${DEP}\" },\n") endforeach() string(CONCAT GENERATED_FILE_CONTENT - "const char *CFE_STATIC_MODULE_LIST[] = {\n" - ${GENERATED_ENTRIES} + "CFE_ConfigName_t CFE_CORE_MODULE_LIST[] = {\n" + ${GENERATED_ENTRIES_CORE_MODULES} + "NULL /* End of list */\n" + "};\n" + "CFE_ConfigName_t CFE_STATIC_APP_LIST[] = {\n" + ${GENERATED_ENTRIES_STATIC_APPS} "NULL /* End of list */\n" "};\n" ) diff --git a/cmake/target/inc/target_config.h b/cmake/target/inc/target_config.h index e5047fb51..51935f396 100644 --- a/cmake/target/inc/target_config.h +++ b/cmake/target/inc/target_config.h @@ -191,7 +191,8 @@ typedef const struct CFE_ConfigKeyValue_t *BuildEnvironment; /**< Environment details of build system at the last time CFE core was built */ CFE_ConfigKeyValue_t *ModuleVersionList; /**< List of module versions at the last time CFE core was built */ - CFE_ConfigName_t *StaticModuleList; /**< List of module names statically linked into CFE core */ + CFE_ConfigName_t *CoreModuleList; /**< List of CFE core support module names that are statically linked */ + CFE_ConfigName_t *StaticAppList; /**< List of additional CFS Applications that are statically linked into this binary */ } Target_ConfigData; diff --git a/cmake/target/src/target_config.c b/cmake/target/src/target_config.c index 2de87346e..ceb7494cd 100644 --- a/cmake/target/src/target_config.c +++ b/cmake/target/src/target_config.c @@ -82,7 +82,16 @@ extern const char CFE_MISSION_CONFIG[]; /**< Configuration name used for bui * - functions it provides may be used by CFE core apps * - it cannot be updated/changed without rebuilding CFE core. */ -extern CFE_ConfigName_t CFE_STATIC_MODULE_LIST[]; +extern CFE_ConfigName_t CFE_CORE_MODULE_LIST[]; + +/** + * A list of CFS apps which are also statically linked with this binary. + * + * These apps can be started without dynamically loading any modules, + * however the entry point must be separately provided in order to avoid + * needing any support from the OS dynamic loader subsystem. + */ +extern CFE_ConfigName_t CFE_STATIC_APP_LIST[]; /** * A key-value table containing certain environment information from the build system @@ -173,6 +182,7 @@ Target_ConfigData GLOBAL_CONFIGDATA = .PspModuleList = CFE_PSP_MODULE_LIST, .BuildEnvironment = CFE_BUILD_ENV_TABLE, .ModuleVersionList = CFE_MODULE_VERSION_TABLE, - .StaticModuleList = CFE_STATIC_MODULE_LIST + .CoreModuleList = CFE_CORE_MODULE_LIST, + .StaticAppList = CFE_STATIC_APP_LIST, }; diff --git a/fsw/cfe-core/src/es/cfe_es_task.c b/fsw/cfe-core/src/es/cfe_es_task.c index dd9e05db9..34fab74a3 100644 --- a/fsw/cfe-core/src/es/cfe_es_task.c +++ b/fsw/cfe-core/src/es/cfe_es_task.c @@ -212,22 +212,15 @@ const char *CFE_ES_FindConfigKeyValue(const CFE_ConfigKeyValue_t *ConfigList, co return ValuePtr; } -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* */ -/* CFE_ES_GenerateVersionEvents() -- Send CFE_ES_VERSION_INF_EID's */ -/* */ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -int32 CFE_ES_GenerateVersionEvents(void) +int32 CFE_ES_GenerateSingleVersionEvent(const char *ModuleType, const char *ModuleName) { int32 Status; const char *VersionString; - CFE_ConfigName_t *ModuleNamePtr; /* The mission version which should appear in the version list under the mission name */ - VersionString = CFE_ES_FindConfigKeyValue(GLOBAL_CONFIGDATA.ModuleVersionList, GLOBAL_CONFIGDATA.MissionName); + VersionString = CFE_ES_FindConfigKeyValue(GLOBAL_CONFIGDATA.ModuleVersionList, ModuleName); - /* If NULL that means the mission config is either uncontrolled or there was no way to determine it */ + /* If NULL that means the source code was either uncontrolled or there was no way to determine its version */ if (VersionString == NULL) { VersionString = "[unknown]"; @@ -237,43 +230,67 @@ int32 CFE_ES_GenerateVersionEvents(void) * Advertise the mission version information */ Status = CFE_EVS_SendEvent(CFE_ES_VERSION_INF_EID, CFE_EVS_EventType_INFORMATION, - "Version Info: Mission %s, version %s", - GLOBAL_CONFIGDATA.MissionName, VersionString); + "Version Info: %s %s, version %s", + ModuleType, ModuleName, VersionString); + + return Status; +} + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/* */ +/* CFE_ES_GenerateVersionEvents() -- Send CFE_ES_VERSION_INF_EID's */ +/* */ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +void CFE_ES_GenerateVersionEvents(void) +{ + int32 Status; + CFE_ConfigName_t *ModuleNamePtr; + CFE_StaticModuleLoadEntry_t *StaticModulePtr; + + /* + * Advertise the mission version information + */ + Status = CFE_ES_GenerateSingleVersionEvent("Mission", GLOBAL_CONFIGDATA.MissionName); if ( Status != CFE_SUCCESS ) { - CFE_ES_WriteToSysLog("ES:Error sending version event:RC=0x%08X\n", (unsigned int)Status); - return(Status); + CFE_ES_WriteToSysLog("ES:Error sending mission version event:RC=0x%08X\n", (unsigned int)Status); } /* - * Also Advertise the version information for all statically-linked modules. + * Also Advertise the version information for all statically-linked core modules. * Send a separate CFE_ES_VERSION_INF_EID for every component. - * - * (do not report dynamically-linked components here, as this only would show - * the version that was present at the time CFE core was linked, not necessarily - * the same as the version that is on the disk) */ - ModuleNamePtr = GLOBAL_CONFIGDATA.StaticModuleList; + ModuleNamePtr = GLOBAL_CONFIGDATA.CoreModuleList; if (ModuleNamePtr != NULL) { while (Status == CFE_SUCCESS && ModuleNamePtr->Name != NULL) { - VersionString = CFE_ES_FindConfigKeyValue(GLOBAL_CONFIGDATA.ModuleVersionList, ModuleNamePtr->Name); - - if (VersionString == NULL) + Status = CFE_ES_GenerateSingleVersionEvent("Core Module", ModuleNamePtr->Name); + if ( Status != CFE_SUCCESS ) { - VersionString = "[unknown]"; + CFE_ES_WriteToSysLog("ES:Error sending core module version event:RC=0x%08X\n", (unsigned int)Status); } - - Status = CFE_EVS_SendEvent(CFE_ES_VERSION_INF_EID, CFE_EVS_EventType_INFORMATION, - "Version Info: Component %s, version %s", - ModuleNamePtr->Name, VersionString); - ++ModuleNamePtr; } } - return Status; + /* + * Advertise PSP module versions + */ + StaticModulePtr = GLOBAL_CONFIGDATA.PspModuleList; + if (StaticModulePtr != NULL) + { + while (Status == CFE_SUCCESS && StaticModulePtr->Name != NULL) + { + Status = CFE_ES_GenerateSingleVersionEvent("PSP Module", StaticModulePtr->Name); + if ( Status != CFE_SUCCESS ) + { + CFE_ES_WriteToSysLog("ES:Error sending PSP module version event:RC=0x%08X\n", (unsigned int)Status); + } + ++StaticModulePtr; + } + } } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -282,7 +299,7 @@ int32 CFE_ES_GenerateVersionEvents(void) /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -int32 CFE_ES_GenerateBuildInfoEvents(void) +void CFE_ES_GenerateBuildInfoEvents(void) { int32 Status; const char *BuildDate; @@ -311,8 +328,10 @@ int32 CFE_ES_GenerateBuildInfoEvents(void) Status = CFE_EVS_SendEvent(CFE_ES_BUILD_INF_EID, CFE_EVS_EventType_INFORMATION, "Build %s by %s@%s, config %s", BuildDate, BuildUser, BuildHost, GLOBAL_CONFIGDATA.Config); - - return Status; + if ( Status != CFE_SUCCESS ) + { + CFE_ES_WriteToSysLog("ES:Error sending build info event:RC=0x%08X\n", (unsigned int)Status); + } } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -466,19 +485,11 @@ int32 CFE_ES_TaskInit(void) return(Status); } - Status = CFE_ES_GenerateVersionEvents(); - if (Status != CFE_SUCCESS) - { - CFE_ES_WriteToSysLog("ES:Error sending version event:RC=0x%08X\n", (unsigned int)Status); - return (Status); - } - - Status = CFE_ES_GenerateBuildInfoEvents(); - if (Status != CFE_SUCCESS) - { - CFE_ES_WriteToSysLog("ES:Error sending build info event:RC=0x%08X\n", (unsigned int)Status); - return (Status); - } + /* + * Generate all module version and build info events. + */ + CFE_ES_GenerateVersionEvents(); + CFE_ES_GenerateBuildInfoEvents(); /* * Initialize the "background task" which is a low priority child task