Skip to content

Commit

Permalink
Merge pull request #1171 from nasa/integration-candidate
Browse files Browse the repository at this point in the history
cFE Integration candidate: 2021-02-23
  • Loading branch information
astrogeco authored Feb 26, 2021
2 parents c708d64 + f282c36 commit 672b2dc
Show file tree
Hide file tree
Showing 37 changed files with 2,331 additions and 1,548 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,25 @@ The detailed cFE user's guide can be viewed at <https://github.com/nasa/cFS/blob

## Version History

### Development Build: 6.8.0-rc1+dev365

- Implements a generic FS facility to perform file writes as a background job. Applications wanting to use this need to instantiate a state object (metadata) in global memory and two callback APIs, one to get a data record, another to send events. The following file requests are changed to use this facility:
- ES ER Log dump
- SB Pipe Info
- SB Message Map
- SB Route Info
- TBL Registry Dump
- Changes the internal SB member names for consistency and thus fixes propagation of `Depth` and `CurrentDepth` into files:
- `MaxQueueDepth` for maximum depth at queue creation time (previously was QueueDepth or Depth depending on context)
- `CurrentQueueDepth` for the running count (previously was InUse or CurrentDepth depending on context)
- `PeakQueueDepth` for the highest "watermark" (previously was PeakInUse or PeakDepth depending on context)
- Encapsulates all parameters for apps and tasks into a structure object. Cleans up internal APIs to pass this new object rather than individual parameters. Adds details to the relevant record (i.e. a task record has all relevant task details) which eliminates the need to traverse the app record to find some data.
- Enables items in `FILELIST` to be in a target name directory as well as symlinks. `arch_build.cmake` now checks a name-based subdirectory under `${MISSION_DEFS}` for files listed in the `FILELIST` for that target. If file is a symlink, the link should be followed so the correct content is installed, not a symlink.
- Adds documentation on inclusion presence of null terminators for length parameters.
- Shortened `CFE_PLATFORM_ES_DEFAULT_TASK_LOG_FILE` name so it is within the `OSAL_MAX_FILE_NAME` size limit. Will now output task info to default filename if no filename is provided in command.
- Replaces `UT_Stub_SetForceFail` with `UT_Stub_SetDefaultReturnValue`. No behavior change.
- See <https://github.com/nasa/cFE/pull/1171>

### Development Build: 6.8.0-rc1+dev348

- Corrects reference to PSP header file location. Build now succesfully completes the build succeeds again when using `add_psp_module()` in custom CMakeLists file.
Expand Down
7 changes: 6 additions & 1 deletion cmake/arch_build.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -474,14 +474,19 @@ function(process_arch SYSVAR)
add_subdirectory(cmake/target ${TGTNAME})

foreach(INSTFILE ${${TGTNAME}_FILELIST})
if(EXISTS ${MISSION_DEFS}/${TGTNAME}_${INSTFILE})
if(EXISTS ${MISSION_DEFS}/${TGTNAME}/${INSTFILE})
set(FILESRC ${MISSION_DEFS}/${TGTNAME}/${INSTFILE})
elseif(EXISTS ${MISSION_DEFS}/${TGTNAME}_${INSTFILE})
set(FILESRC ${MISSION_DEFS}/${TGTNAME}_${INSTFILE})
elseif(EXISTS ${MISSION_DEFS}/${INSTFILE})
set(FILESRC ${MISSION_DEFS}/${INSTFILE})
else()
set(FILESRC)
endif()
if (FILESRC)
# In case the file is a symlink, follow it to get to the actual file
get_filename_component(FILESRC "${FILESRC}" REALPATH)
message("NOTE: Selected ${FILESRC} as source for ${INSTFILE} on ${TGTNAME}")
install(FILES ${FILESRC} DESTINATION ${TGTNAME}/${INSTALL_SUBDIR} RENAME ${INSTFILE})
else(FILESRC)
message("WARNING: Install file ${INSTFILE} for ${TGTNAME} not found")
Expand Down
2 changes: 1 addition & 1 deletion cmake/sample_defs/cpu1_platform_cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,7 @@
** The length of each string, including the NULL terminator cannot exceed the
** #OS_MAX_PATH_LEN value.
*/
#define CFE_PLATFORM_ES_DEFAULT_TASK_LOG_FILE "/ram/cfe_es_task_info.log"
#define CFE_PLATFORM_ES_DEFAULT_TASK_LOG_FILE "/ram/cfe_es_taskinfo.log"

/**
** \cfeescfg Default System Log Filename
Expand Down
12 changes: 11 additions & 1 deletion cmake/sample_defs/sample_mission_cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
** messages sent. If the pkt length field indicates the message is larger
** than this define, SB sends an event and rejects the send.
**
**
** \par Limits
** This parameter has a lower limit of 6 (CCSDS primary header size). There
** are no restrictions on the upper limit however, the maximum message size is
Expand Down Expand Up @@ -247,6 +246,7 @@
** portion of a Full CDS Name of the following form:
** "ApplicationName.CDSName"
**
** This length does not need to include an extra character for NULL termination.
**
** \par Limits
** This value should be kept as a multiple of 4, to maintain alignment of
Expand All @@ -264,6 +264,8 @@
** Indicates the maximum length (in characters) of the formatted text
** string portion of an event message
**
** This length does not need to include an extra character for NULL termination.
**
** \par Limits
** Not Applicable
*/
Expand Down Expand Up @@ -299,6 +301,8 @@
** ('TblName') portion of a Full Table Name of the following
** form: "ApplicationName.TblName"
**
** This length does not need to include an extra character for NULL termination.
**
** \par Limits
** This value should be kept as a multiple of 4, to maintain alignment of
** any possible neighboring fields without implicit padding.
Expand Down Expand Up @@ -531,6 +535,8 @@
**
** This affects only the layout of command/telemetry messages and table definitions;
** internal allocation may use the platform-specific OS_MAX_PATH_LEN value.
**
** This length must include an extra character for NULL termination.
**
** \par Limits
** All CPUs within the same SB domain (mission) and ground tools must share the
Expand All @@ -557,6 +563,8 @@
** This affects only the layout of command/telemetry messages and table definitions;
** internal allocation may use the platform-specific OS_MAX_FILE_LEN value.
**
** This length must include an extra character for NULL termination.
**
** \par Limits
** All CPUs within the same SB domain (mission) and ground tools must share the
** same definition.
Expand All @@ -582,6 +590,8 @@
** This affects only the layout of command/telemetry messages and table definitions;
** internal allocation may use the platform-specific OS_MAX_API_LEN value.
**
** This length must include an extra character for NULL termination.
**
** \par Limits
** All CPUs within the same SB domain (mission) must share the same definition
** Note this affects the size of messages, so it must not cause any message
Expand Down
186 changes: 87 additions & 99 deletions fsw/cfe-core/src/es/cfe_es_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -1015,15 +1015,15 @@ int32 CFE_ES_GetAppInfo(CFE_ES_AppInfo_t *AppInfo, CFE_ES_AppId_t AppId)
AppInfo->ResourceId = CFE_RESOURCEID_UNWRAP(AppId); /* make into a generic resource ID */
AppInfo->Type = AppRecPtr->Type;

strncpy(AppInfo->Name, CFE_ES_AppRecordGetName(AppRecPtr), sizeof(AppInfo->Name)-1);

CFE_ES_CopyModuleBasicInfo(&AppRecPtr->StartParams.BasicInfo, AppInfo);
CFE_ES_CopyModuleStatusInfo(&AppRecPtr->ModuleInfo, AppInfo);
CFE_ES_CopyModuleStatusInfo(&AppRecPtr->LoadStatus, AppInfo);

AppInfo->StackSize = AppRecPtr->StartParams.StackSize;
AppInfo->ExceptionAction = AppRecPtr->StartParams.ExceptionAction;
AppInfo->Priority = AppRecPtr->StartParams.Priority;
AppInfo->MainTaskId = AppRecPtr->MainTaskId;

ModuleId = AppRecPtr->ModuleInfo.ModuleId;
ModuleId = AppRecPtr->LoadStatus.ModuleId;

/*
** Calculate the number of child tasks
Expand All @@ -1042,6 +1042,10 @@ int32 CFE_ES_GetAppInfo(CFE_ES_AppInfo_t *AppInfo, CFE_ES_AppId_t AppId)
strncpy(AppInfo->MainTaskName, TaskRecPtr->TaskName,
sizeof(AppInfo->MainTaskName) - 1);
AppInfo->MainTaskName[sizeof(AppInfo->MainTaskName) - 1] = '\0';

AppInfo->StackSize = TaskRecPtr->StartParams.StackSize;
AppInfo->Priority = TaskRecPtr->StartParams.Priority;

}
else
{
Expand Down Expand Up @@ -1105,10 +1109,12 @@ int32 CFE_ES_GetLibInfo(CFE_ES_AppInfo_t *LibInfo, CFE_ES_LibId_t LibId)
LibInfo->ResourceId = CFE_RESOURCEID_UNWRAP(LibId); /* make into generic ID */
LibInfo->Type = CFE_ES_AppType_LIBRARY;

CFE_ES_CopyModuleBasicInfo(&LibRecPtr->BasicInfo, LibInfo);
CFE_ES_CopyModuleStatusInfo(&LibRecPtr->ModuleInfo, LibInfo);
strncpy(LibInfo->Name, CFE_ES_LibRecordGetName(LibRecPtr), sizeof(LibInfo->Name)-1);

ModuleId = LibRecPtr->ModuleInfo.ModuleId;
CFE_ES_CopyModuleBasicInfo(&LibRecPtr->LoadParams, LibInfo);
CFE_ES_CopyModuleStatusInfo(&LibRecPtr->LoadStatus, LibInfo);

ModuleId = LibRecPtr->LoadStatus.ModuleId;

Status = CFE_SUCCESS;
}
Expand Down Expand Up @@ -1243,108 +1249,90 @@ int32 CFE_ES_CreateChildTask(CFE_ES_TaskId_t *TaskIdPtr,
CFE_ES_TaskPriority_Atom_t Priority,
uint32 Flags)
{
int32 ReturnCode;
CFE_ES_AppRecord_t * AppRecPtr;
CFE_ES_AppId_t ParentAppId;
CFE_ES_TaskId_t SelfTaskId;
CFE_ES_TaskStartParams_t Params;

int32 Result;
CFE_ES_AppRecord_t *AppRecPtr;
CFE_ES_TaskRecord_t *TaskRecPtr;
int32 ReturnCode;
CFE_ES_TaskId_t SelfTaskId;
CFE_ES_TaskId_t LocalChildTaskId;
osal_id_t OsalId;
ParentAppId = CFE_ES_APPID_UNDEFINED;

/*
** Validate some of the arguments
*/
if ( TaskIdPtr == NULL )
{
if (TaskName == NULL)
{
CFE_ES_WriteToSysLog("CFE_ES_CreateChildTask: Task Id and Name Pointer Parameters are NULL.\n");
ReturnCode = CFE_ES_BAD_ARGUMENT;
}
else
{
CFE_ES_WriteToSysLog("CFE_ES_CreateChildTask: Task Id Pointer Parameter is NULL for Task '%s'.\n",TaskName);
ReturnCode = CFE_ES_BAD_ARGUMENT;
}
}
else if ( TaskName == NULL )
{
CFE_ES_WriteToSysLog("CFE_ES_CreateChildTask: TaskName Parameter is NULL\n");
ReturnCode = CFE_ES_BAD_ARGUMENT;
}
else if ( FunctionPtr == NULL )
{
CFE_ES_WriteToSysLog("CFE_ES_CreateChildTask: Function Pointer Parameter is NULL for Task '%s'\n",TaskName);
ReturnCode = CFE_ES_BAD_ARGUMENT;
}
else
{

CFE_ES_LockSharedData(__func__,__LINE__);
memset(&Params, 0, sizeof(Params));
Params.Priority = Priority;
Params.StackSize = StackSize;

/*
** Get the App Record of the calling Application
*/
AppRecPtr = CFE_ES_GetAppRecordByContext();
if (AppRecPtr == NULL)
{
CFE_ES_SysLogWrite_Unsync("CFE_ES_CreateChildTask: Invalid calling context when creating Task '%s'\n",TaskName);
ReturnCode = CFE_ES_ERR_RESOURCEID_NOT_VALID;
}
else /* else AppId is valid */
{
/*
** First, Make sure the Calling Task is a cFE Main task.
** TaskID must be the same as the Parent Task ID.
*/
OsalId = OS_TaskGetId();
SelfTaskId = CFE_ES_TaskId_FromOSAL(OsalId);
if ( CFE_RESOURCEID_TEST_EQUAL(SelfTaskId, AppRecPtr->MainTaskId) )
{
/*
** Step 2: Create the new task using the OS API call
*/
Result = OS_TaskCreate(&OsalId, TaskName, FunctionPtr, StackPtr,
StackSize, Priority, OS_FP_ENABLED );

/*
** Step 3: Record the task information in the task table
*/
if ( Result == OS_SUCCESS )
{
LocalChildTaskId = CFE_ES_TaskId_FromOSAL(OsalId);
TaskRecPtr = CFE_ES_LocateTaskRecordByID(LocalChildTaskId);
/*
** Validate some of the arguments
*/
if (TaskIdPtr == NULL)
{
if (TaskName == NULL)
{
CFE_ES_WriteToSysLog("CFE_ES_CreateChildTask: Task Id and Name Pointer Parameters are NULL.\n");
ReturnCode = CFE_ES_BAD_ARGUMENT;
}
else
{
CFE_ES_WriteToSysLog("CFE_ES_CreateChildTask: Task Id Pointer Parameter is NULL for Task '%s'.\n",
TaskName);
ReturnCode = CFE_ES_BAD_ARGUMENT;
}
}
else if (TaskName == NULL)
{
CFE_ES_WriteToSysLog("CFE_ES_CreateChildTask: TaskName Parameter is NULL\n");
ReturnCode = CFE_ES_BAD_ARGUMENT;
}
else if (FunctionPtr == NULL)
{
CFE_ES_WriteToSysLog("CFE_ES_CreateChildTask: Function Pointer Parameter is NULL for Task '%s'\n", TaskName);
ReturnCode = CFE_ES_BAD_ARGUMENT;
}
else
{
/*
** First, Make sure the Calling Task is a cFE Main task.
** TaskID must be the same as the Parent Task ID.
*/
SelfTaskId = CFE_ES_TaskId_FromOSAL(OS_TaskGetId());

CFE_ES_TaskRecordSetUsed(TaskRecPtr, CFE_RESOURCEID_UNWRAP(LocalChildTaskId));
TaskRecPtr->AppId = CFE_ES_AppRecordGetID(AppRecPtr);
strncpy(TaskRecPtr->TaskName,TaskName,sizeof(TaskRecPtr->TaskName) - 1);
TaskRecPtr->TaskName[sizeof(TaskRecPtr->TaskName) - 1] = '\0';
CFE_ES_Global.RegisteredTasks++;
CFE_ES_LockSharedData(__func__, __LINE__);

*TaskIdPtr = CFE_ES_TaskRecordGetID(TaskRecPtr);
ReturnCode = CFE_SUCCESS;
}
else
{
CFE_ES_SysLogWrite_Unsync("CFE_ES_CreateChildTask: Error calling OS_TaskCreate for Task '%s' RC = 0x%08X\n",TaskName,(unsigned int)Result);
ReturnCode = CFE_ES_ERR_CHILD_TASK_CREATE;
}
}
else
{
CFE_ES_SysLogWrite_Unsync("CFE_ES_CreateChildTask: Error: Cannot call from a Child Task (for Task '%s').\n",TaskName);
/*
** Get the App Record of the calling Application
*/
AppRecPtr = CFE_ES_GetAppRecordByContext();
if (AppRecPtr == NULL)
{
CFE_ES_SysLogWrite_Unsync("CFE_ES_CreateChildTask: Invalid calling context when creating Task '%s'\n",
TaskName);
ReturnCode = CFE_ES_ERR_RESOURCEID_NOT_VALID;
}
else if (!CFE_RESOURCEID_TEST_EQUAL(SelfTaskId, AppRecPtr->MainTaskId))
{
CFE_ES_SysLogWrite_Unsync("CFE_ES_CreateChildTask: Error: Cannot call from a Child Task (for Task '%s').\n",
TaskName);
ReturnCode = CFE_ES_ERR_CHILD_TASK_CREATE;
}
else
{
ParentAppId = CFE_ES_AppRecordGetID(AppRecPtr);
ReturnCode = CFE_SUCCESS;
} /* end If AppID is valid */

} /* end if Calling task is a main task */

}/* end If AppID is valid */
CFE_ES_UnlockSharedData(__func__, __LINE__);

CFE_ES_UnlockSharedData(__func__,__LINE__);
} /* end if parameter checking */

} /* end if parameter checking */
/*
** Step 2: Create the new task if the parameter validation succeeded
*/
if (ReturnCode == CFE_SUCCESS)
{
ReturnCode = CFE_ES_StartAppTask(TaskIdPtr, TaskName, FunctionPtr, &Params, ParentAppId);
}

return(ReturnCode);
return (ReturnCode);

} /* End of CFE_ES_CreateChildTask() */

Expand Down
Loading

0 comments on commit 672b2dc

Please sign in to comment.