Skip to content

Commit

Permalink
Merge pull request #936 from nasa/integration-candidate
Browse files Browse the repository at this point in the history
Integration Candidate 2020-10-07
  • Loading branch information
astrogeco authored Oct 6, 2020
2 parents 8a7dc8f + 73479f7 commit 7f6fdfb
Show file tree
Hide file tree
Showing 34 changed files with 2,828 additions and 1,231 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,24 @@ The detailed cFE user's guide can be viewed at <https://github.com/nasa/cFS/blob

## Version History

### Development Build: 6.8.0-rc1+dev122

- Adds the field `UnregAppID` to track whether an "unregistered" event was generated, un-overloading the EventCount field to serve its primary purpose of counting actual events generated from a valid/registered AppID.
- Move the AppID lookup execution to be early in the `CFE_SB_SendMsgFull` implementation. This avoids double locking between SB+ES and avoids a block-scope local variable.
- Instead of identifying a memory pool by its memory address, use a resource ID. IDs are a constant size, regardless of whether the host machine is 32 or 64 bits.
- IDs can be put into commands/telemetry and maintain a more consistent format with consistent alignment requirements.
- IDs can be independently verified without dereferencing memory. Previously the only way to validate a memory pool was to read the address pointed to, which results in a segfault if the address was bad.
- Change from `OS_MAX*` defines to appropriately-scoped CFE defines for array sizing
- This creates the new `CFE_Status_t` typedef for function's return status codes. Also adds a note to `CFE_TBL_GetStatus` since its behavior will likely change in the future in the hopes of not having a non-zero "info" status.
- See <https://github.com/nasa/cFE/pull/936>

### Development Build: 6.8.0-rc1+dev109

- Add a new typedef `CFE_ES_ResourceID_t` that can replace `uint32` for all ID storage and manipulation. Initially this is just an alias to `uint32` for backward compatibility.
- See <https://github.com/nasa/cFE/pull/916>

### Development Build: 6.8.0-rc1+dev105

- Removes dependency on CCSDS version define.
- Removes old name and id defines.
- CFE_ES_CalculateCRC default stub behavior.
Expand Down
36 changes: 35 additions & 1 deletion cmake/sample_defs/cpu1_platform_cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@
** \par Limits
** These sizes MUST be increasing and MUST be an integral multiple of 4.
** The number of block sizes defined cannot exceed
** #CFE_ES_MAX_MEMPOOL_BLOCK_SIZES
** #CFE_PLATFORM_ES_POOL_MAX_BUCKETS
*/
#define CFE_PLATFORM_SB_MEM_BLOCK_SIZE_01 8
#define CFE_PLATFORM_SB_MEM_BLOCK_SIZE_02 16
Expand Down Expand Up @@ -1365,6 +1365,40 @@
#define CFE_PLATFORM_ES_MAX_PROCESSOR_RESETS 2


/** \cfeescfg Maximum number of block sizes in pool structures
**
** \par Description:
** The upper limit for the number of block sizes supported in the generic
** pool implementation, which in turn implements the memory pools and CDS.
**
** \par Limits:
** Must be at least one. No specific upper limit, but the number is
** anticipated to be reasonably small (i.e. tens, not hundreds). Large
** values have not been tested.
**
** The ES and CDS block size lists must correlate with this value
*/
#define CFE_PLATFORM_ES_POOL_MAX_BUCKETS 17

/** \cfeescfg Maximum number of memory pools
**
** \par Description:
** The upper limit for the number of memory pools than can concurrently
** exist within the system.
**
** The CFE_SB and CFE_TBL core subsystems each define a memory pool.
**
** Individual applications may also create memory pools, so this value
** should be set sufficiently high enough to support the applications
** being used on this platform.
**
** \par Limits:
** Must be at least 2 to support CFE core - SB and TBL pools. No
** specific upper limit.
*/
#define CFE_PLATFORM_ES_MAX_MEMORY_POOLS 10


/**
** \cfeescfg Define Default ES Memory Pool Block Sizes
**
Expand Down
2 changes: 1 addition & 1 deletion docs/src/cfe_es.dox
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@
<LI> <B>Number of Free Bytes</B> - The total number of bytes in the Memory Pool that have never
been allocated to a Memory Block<BR>
<LI> <B>Block Statistics</B> - For each specified size of memory block (of which there are
#CFE_ES_MAX_MEMPOOL_BLOCK_SIZES), the following statistics are kept<BR>
#CFE_ES_DEFAULT_MEMPOOL_BLOCK_SIZES), the following statistics are kept<BR>
<UL>
<LI> <B>Block Size</B> - The size, in bytes, of all blocks of this type<BR>
<LI> <B>Number of Blocks Allocated</B> - The number of this sized block which are currently
Expand Down
44 changes: 39 additions & 5 deletions fsw/cfe-core/src/es/cfe_es_apps.c
Original file line number Diff line number Diff line change
Expand Up @@ -1088,6 +1088,8 @@ int32 CFE_ES_CleanUpApp(CFE_ES_AppRecord_t *AppRecPtr)
CFE_ES_ResourceID_t CurrTaskId;
int32 ReturnCode = CFE_SUCCESS;
CFE_ES_TaskRecord_t *TaskRecPtr;
CFE_ES_MemPoolRecord_t *MemPoolRecPtr;
CFE_ES_MemHandle_t PoolId;
CFE_ES_ResourceID_t AppId;

/*
Expand Down Expand Up @@ -1191,6 +1193,38 @@ int32 CFE_ES_CleanUpApp(CFE_ES_AppRecord_t *AppRecPtr)

CFE_ES_AppRecordSetFree(AppRecPtr);

/*
** Delete any memory pools associated with this app
*/
MemPoolRecPtr = CFE_ES_Global.MemPoolTable;
for ( i = 0; i < CFE_PLATFORM_ES_MAX_MEMORY_POOLS; i++ )
{
if ( CFE_ES_MemPoolRecordIsUsed(MemPoolRecPtr) &&
CFE_ES_ResourceID_Equal(MemPoolRecPtr->OwnerAppID, AppId))
{
PoolId = CFE_ES_MemPoolRecordGetID(MemPoolRecPtr);

/*
* This needs to release the lock first because
* CFE_ES_PoolDelete acquires the lock.
*/
CFE_ES_UnlockSharedData(__func__, __LINE__);
Status = CFE_ES_PoolDelete(PoolId);
CFE_ES_LockSharedData(__func__, __LINE__);

if ( Status != CFE_SUCCESS )
{
CFE_ES_SysLogWrite_Unsync("CFE_ES_MemPoolCleanupApp: delete pool %lu returned Error: 0x%08X\n",
CFE_ES_ResourceID_ToInteger(PoolId), (unsigned int)Status);
ReturnCode = CFE_ES_APP_CLEANUP_ERR;
}
}

++MemPoolRecPtr;
} /* end for */



CFE_ES_UnlockSharedData(__func__,__LINE__);

return(ReturnCode);
Expand Down Expand Up @@ -1531,9 +1565,9 @@ int32 CFE_ES_GetTaskInfoInternal(CFE_ES_TaskRecord_t *TaskRecPtr, CFE_ES_TaskInf
** Get the Application ID and Task Name
*/
TaskInfoPtr->AppId = TaskRecPtr->AppId;
strncpy((char *)TaskInfoPtr->TaskName,
(char *)TaskRecPtr->TaskName,OS_MAX_API_NAME);
TaskInfoPtr->TaskName[OS_MAX_API_NAME - 1] = '\0';
strncpy((char*)TaskInfoPtr->TaskName, TaskRecPtr->TaskName,
sizeof(TaskInfoPtr->TaskName)-1);
TaskInfoPtr->TaskName[sizeof(TaskInfoPtr->TaskName)-1] = '\0';

/*
** Store away the Task ID ( for the QueryAllTasks Cmd )
Expand All @@ -1551,9 +1585,9 @@ int32 CFE_ES_GetTaskInfoInternal(CFE_ES_TaskRecord_t *TaskRecPtr, CFE_ES_TaskInf
AppRecPtr = CFE_ES_LocateAppRecordByID(TaskRecPtr->AppId);
if (CFE_ES_AppRecordIsMatch(AppRecPtr, TaskRecPtr->AppId))
{
strncpy((char*)TaskInfoPtr->AppName,
(char*)AppRecPtr->StartParams.Name,
strncpy((char*)TaskInfoPtr->AppName, AppRecPtr->StartParams.Name,
sizeof(TaskInfoPtr->AppName)-1);
TaskInfoPtr->AppName[sizeof(TaskInfoPtr->AppName)-1] = '\0';
ReturnCode = CFE_SUCCESS;
}
else
Expand Down
Loading

0 comments on commit 7f6fdfb

Please sign in to comment.