Skip to content

Commit

Permalink
Update #1170, separate list for static apps
Browse files Browse the repository at this point in the history
  • Loading branch information
jphickey committed Feb 18, 2021
1 parent 3aa80ed commit 42b3a69
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 55 deletions.
21 changes: 15 additions & 6 deletions cmake/target/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
3 changes: 2 additions & 1 deletion cmake/target/inc/target_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
14 changes: 12 additions & 2 deletions cmake/target/src/target_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
};

103 changes: 57 additions & 46 deletions fsw/cfe-core/src/es/cfe_es_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]";
Expand All @@ -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;
}
}
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
Expand All @@ -282,7 +299,7 @@ int32 CFE_ES_GenerateVersionEvents(void)
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

int32 CFE_ES_GenerateBuildInfoEvents(void)
void CFE_ES_GenerateBuildInfoEvents(void)
{
int32 Status;
const char *BuildDate;
Expand Down Expand Up @@ -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);
}
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 42b3a69

Please sign in to comment.