Skip to content

Commit 7f6fdfb

Browse files
authored
Merge pull request #936 from nasa/integration-candidate
Integration Candidate 2020-10-07
2 parents 8a7dc8f + 73479f7 commit 7f6fdfb

34 files changed

+2828
-1231
lines changed

README.md

+13
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,24 @@ The detailed cFE user's guide can be viewed at <https://github.com/nasa/cFS/blob
1010

1111
## Version History
1212

13+
### Development Build: 6.8.0-rc1+dev122
14+
15+
- 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.
16+
- 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.
17+
- 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.
18+
- IDs can be put into commands/telemetry and maintain a more consistent format with consistent alignment requirements.
19+
- 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.
20+
- Change from `OS_MAX*` defines to appropriately-scoped CFE defines for array sizing
21+
- 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.
22+
- See <https://github.com/nasa/cFE/pull/936>
23+
1324
### Development Build: 6.8.0-rc1+dev109
25+
1426
- 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.
1527
- See <https://github.com/nasa/cFE/pull/916>
1628

1729
### Development Build: 6.8.0-rc1+dev105
30+
1831
- Removes dependency on CCSDS version define.
1932
- Removes old name and id defines.
2033
- CFE_ES_CalculateCRC default stub behavior.

cmake/sample_defs/cpu1_platform_cfg.h

+35-1
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@
280280
** \par Limits
281281
** These sizes MUST be increasing and MUST be an integral multiple of 4.
282282
** The number of block sizes defined cannot exceed
283-
** #CFE_ES_MAX_MEMPOOL_BLOCK_SIZES
283+
** #CFE_PLATFORM_ES_POOL_MAX_BUCKETS
284284
*/
285285
#define CFE_PLATFORM_SB_MEM_BLOCK_SIZE_01 8
286286
#define CFE_PLATFORM_SB_MEM_BLOCK_SIZE_02 16
@@ -1365,6 +1365,40 @@
13651365
#define CFE_PLATFORM_ES_MAX_PROCESSOR_RESETS 2
13661366

13671367

1368+
/** \cfeescfg Maximum number of block sizes in pool structures
1369+
**
1370+
** \par Description:
1371+
** The upper limit for the number of block sizes supported in the generic
1372+
** pool implementation, which in turn implements the memory pools and CDS.
1373+
**
1374+
** \par Limits:
1375+
** Must be at least one. No specific upper limit, but the number is
1376+
** anticipated to be reasonably small (i.e. tens, not hundreds). Large
1377+
** values have not been tested.
1378+
**
1379+
** The ES and CDS block size lists must correlate with this value
1380+
*/
1381+
#define CFE_PLATFORM_ES_POOL_MAX_BUCKETS 17
1382+
1383+
/** \cfeescfg Maximum number of memory pools
1384+
**
1385+
** \par Description:
1386+
** The upper limit for the number of memory pools than can concurrently
1387+
** exist within the system.
1388+
**
1389+
** The CFE_SB and CFE_TBL core subsystems each define a memory pool.
1390+
**
1391+
** Individual applications may also create memory pools, so this value
1392+
** should be set sufficiently high enough to support the applications
1393+
** being used on this platform.
1394+
**
1395+
** \par Limits:
1396+
** Must be at least 2 to support CFE core - SB and TBL pools. No
1397+
** specific upper limit.
1398+
*/
1399+
#define CFE_PLATFORM_ES_MAX_MEMORY_POOLS 10
1400+
1401+
13681402
/**
13691403
** \cfeescfg Define Default ES Memory Pool Block Sizes
13701404
**

docs/src/cfe_es.dox

+1-1
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,7 @@
760760
<LI> <B>Number of Free Bytes</B> - The total number of bytes in the Memory Pool that have never
761761
been allocated to a Memory Block<BR>
762762
<LI> <B>Block Statistics</B> - For each specified size of memory block (of which there are
763-
#CFE_ES_MAX_MEMPOOL_BLOCK_SIZES), the following statistics are kept<BR>
763+
#CFE_ES_DEFAULT_MEMPOOL_BLOCK_SIZES), the following statistics are kept<BR>
764764
<UL>
765765
<LI> <B>Block Size</B> - The size, in bytes, of all blocks of this type<BR>
766766
<LI> <B>Number of Blocks Allocated</B> - The number of this sized block which are currently

fsw/cfe-core/src/es/cfe_es_apps.c

+39-5
Original file line numberDiff line numberDiff line change
@@ -1088,6 +1088,8 @@ int32 CFE_ES_CleanUpApp(CFE_ES_AppRecord_t *AppRecPtr)
10881088
CFE_ES_ResourceID_t CurrTaskId;
10891089
int32 ReturnCode = CFE_SUCCESS;
10901090
CFE_ES_TaskRecord_t *TaskRecPtr;
1091+
CFE_ES_MemPoolRecord_t *MemPoolRecPtr;
1092+
CFE_ES_MemHandle_t PoolId;
10911093
CFE_ES_ResourceID_t AppId;
10921094

10931095
/*
@@ -1191,6 +1193,38 @@ int32 CFE_ES_CleanUpApp(CFE_ES_AppRecord_t *AppRecPtr)
11911193

11921194
CFE_ES_AppRecordSetFree(AppRecPtr);
11931195

1196+
/*
1197+
** Delete any memory pools associated with this app
1198+
*/
1199+
MemPoolRecPtr = CFE_ES_Global.MemPoolTable;
1200+
for ( i = 0; i < CFE_PLATFORM_ES_MAX_MEMORY_POOLS; i++ )
1201+
{
1202+
if ( CFE_ES_MemPoolRecordIsUsed(MemPoolRecPtr) &&
1203+
CFE_ES_ResourceID_Equal(MemPoolRecPtr->OwnerAppID, AppId))
1204+
{
1205+
PoolId = CFE_ES_MemPoolRecordGetID(MemPoolRecPtr);
1206+
1207+
/*
1208+
* This needs to release the lock first because
1209+
* CFE_ES_PoolDelete acquires the lock.
1210+
*/
1211+
CFE_ES_UnlockSharedData(__func__, __LINE__);
1212+
Status = CFE_ES_PoolDelete(PoolId);
1213+
CFE_ES_LockSharedData(__func__, __LINE__);
1214+
1215+
if ( Status != CFE_SUCCESS )
1216+
{
1217+
CFE_ES_SysLogWrite_Unsync("CFE_ES_MemPoolCleanupApp: delete pool %lu returned Error: 0x%08X\n",
1218+
CFE_ES_ResourceID_ToInteger(PoolId), (unsigned int)Status);
1219+
ReturnCode = CFE_ES_APP_CLEANUP_ERR;
1220+
}
1221+
}
1222+
1223+
++MemPoolRecPtr;
1224+
} /* end for */
1225+
1226+
1227+
11941228
CFE_ES_UnlockSharedData(__func__,__LINE__);
11951229

11961230
return(ReturnCode);
@@ -1531,9 +1565,9 @@ int32 CFE_ES_GetTaskInfoInternal(CFE_ES_TaskRecord_t *TaskRecPtr, CFE_ES_TaskInf
15311565
** Get the Application ID and Task Name
15321566
*/
15331567
TaskInfoPtr->AppId = TaskRecPtr->AppId;
1534-
strncpy((char *)TaskInfoPtr->TaskName,
1535-
(char *)TaskRecPtr->TaskName,OS_MAX_API_NAME);
1536-
TaskInfoPtr->TaskName[OS_MAX_API_NAME - 1] = '\0';
1568+
strncpy((char*)TaskInfoPtr->TaskName, TaskRecPtr->TaskName,
1569+
sizeof(TaskInfoPtr->TaskName)-1);
1570+
TaskInfoPtr->TaskName[sizeof(TaskInfoPtr->TaskName)-1] = '\0';
15371571

15381572
/*
15391573
** Store away the Task ID ( for the QueryAllTasks Cmd )
@@ -1551,9 +1585,9 @@ int32 CFE_ES_GetTaskInfoInternal(CFE_ES_TaskRecord_t *TaskRecPtr, CFE_ES_TaskInf
15511585
AppRecPtr = CFE_ES_LocateAppRecordByID(TaskRecPtr->AppId);
15521586
if (CFE_ES_AppRecordIsMatch(AppRecPtr, TaskRecPtr->AppId))
15531587
{
1554-
strncpy((char*)TaskInfoPtr->AppName,
1555-
(char*)AppRecPtr->StartParams.Name,
1588+
strncpy((char*)TaskInfoPtr->AppName, AppRecPtr->StartParams.Name,
15561589
sizeof(TaskInfoPtr->AppName)-1);
1590+
TaskInfoPtr->AppName[sizeof(TaskInfoPtr->AppName)-1] = '\0';
15571591
ReturnCode = CFE_SUCCESS;
15581592
}
15591593
else

0 commit comments

Comments
 (0)